弹出窗体勾选多条记录自动添加到明细表
作者:C/S框架网  发布日期:2016-10-08 17:17:30
  弹出窗体勾选多条记录自动添加到明细表



SearchCallBack.cs

C# Code:

namespace CSFrameworkV4_5.Library.CommonClass
{
   
   /// <summary>
   /// 回调函数,当选择一个条记录后关闭窗体时调用
   /// </summary>
   /// <param name="resultRow">当前选择的条记</param>
   public delegate void SearchCallBack(DataRow resultRow);
   
   /// <summary>
   /// 回调函数,当选择多条记录后关闭窗体时调用
   /// </summary>
   /// <param name="resultTable"></param>
   public delegate void SearchCallBackTable(DataTable resultTable);
   
   
}

//来源:C/S框架网(www.csframework.com) QQ:1980854898


frmSO.cs

C# Code:

private void OnStockCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
   //打开产品查询窗体
   frmFuzzySearchProduct.ExecuteTable(sender as ButtonEdit, this.SearchStockCallBackTable);
}


//来源:C/S框架网(www.csframework.com) QQ:1980854898



C# Code:


/// <summary>
/// 勾选记录对话框回调函数
/// </summary>
/// <param name="resultTable">返回的表</param>
private void SearchStockCallBackTable(DataTable resultTable)
{
   if (resultTable == null || resultTable.Rows.Count == 0) return;
   
   foreach (DataRow resultRow in resultTable.Rows)
   {
      DataRow row = _BLL.CurrentBusiness.Tables[tb_SOs.__TableName].NewRow();
      string order = new GenerateSortID().Generate(gvDetail, colD_Queue); //生成排序编号
      
      row[tb_SOs.Queue] = order; //排序编号
      row[tb_SOs.StockCode] = resultRow[tb_Product.ProductCode];
      row[tb_SOs.StockName] = resultRow[tb_Product.ProductName]; //参考字段,["StockName"]相同
      row[tb_SOs.Price] = resultRow[tb_Product.SellPrice];
      row[tb_SOs.Qty] = 1;
      
      _BLL.CurrentBusiness.Tables[tb_SOs.__TableName].Rows.Add(row); //增加一条明细记录
   }
   
   gcDetail.RefreshDataSource();
}

//来源:C/S框架网(www.csframework.com) QQ:1980854898




贴图图片





贴图图片
点击下载附件 (VIP会员下载) 点击下载附件 (如下载失败,请邮件通知我们寄回给您,或QQ:23404761留言.)
上一篇 下一篇