/// <summary> /// 保存数据 /// </summary> /// <param name="dsMaster"></param> /// <param name="dsSlaver"></param> /// <param name="dsUpdateSlaver"></param> /// <returns></returns> private bool Save(DataSet dsMaster, DataSet dsSlaver, DataSet dsUpdateSlaver) { DataSet[] dsData = new DataSet[2]; dsData[0] = dsMaster; dsData[1] = dsUpdateSlaver; string[] strSQL = new string[2]; strSQL[0] = "select * from t_Certificate where F_ID = " + decID.ToString(); strSQL[1] = "select * from t_CertificateDetail where F_ID = " + decID.ToString(); DataLib.DataHelper myHelper = new DataLib.DataHelper(); if (myHelper.SaveMuteData1(dsData, strSQL, GetParm()).Length == 0) { //DataLib.SysVar.SetLog(this.Text, "保存", "保存" + editControl1.GetValue().ToString()); MessageBox.Show("数据保存成功!!", "提示"); //DataBind(); //strBillID = editControl1.GetValue().ToString(); //decID = dsMaster.AcceptChanges(); dsSlaver.AcceptChanges(); Status(2); return(true); } else { return(false); } }
protected override bool Save(DataSet dsMaster, DataSet dsSlaver, DataSet dsUpdateSlaver) { //return base.Save(dsMaster, dsSlaver, dsUpdateSlaver); string strHalfSQL = "", strItemSQL = "", strDeptSQL = ""; DataSet dsUpdateHalf = SaveHalf(dsMaster, dsSlaver, dsUpdateSlaver, ref strHalfSQL); DataSet dsUpdateItem = SaveItem(dsMaster, dsSlaver, dsUpdateSlaver, ref strItemSQL); DataSet dsUpdateDept = SaveDept(dsMaster, dsSlaver, dsUpdateSlaver, ref strDeptSQL); DataSet[] dsData = new DataSet[5]; dsData[0] = dsMaster; dsData[1] = dsUpdateSlaver; dsData[2] = dsUpdateHalf; dsData[3] = dsUpdateItem; dsData[4] = dsUpdateDept; string[] strSQL = new string[5]; strSQL[0] = strMasterSQL; strSQL[1] = strSaveSlaverSQL; strSQL[2] = strHalfSQL; strSQL[3] = strItemSQL; strSQL[4] = strDeptSQL; DataLib.DataHelper myHelper = new DataLib.DataHelper(); if (myHelper.SaveMuteData1(dsData, strSQL, GetParm()).Length == 0) { MessageBox.Show("数据保存成功!!", "提示"); strBillID = editControl1.GetValue().ToString(); dsMaster.AcceptChanges(); dsSlaver.AcceptChanges(); ((DataView)binHalf.DataSource).Table.AcceptChanges(); ((DataView)binItem.DataSource).Table.AcceptChanges(); ((DataView)binDept.DataSource).Table.AcceptChanges(); SetStatus(2); return(true); } else { return(false); } }
protected override bool Save(DataSet dsMaster, DataSet dsSlaver, DataSet dsUpdateSlaver) { //return base.Save(dsMaster, dsSlaver, dsUpdateSlaver); DataLib.DataHelper myHelper = new DataLib.DataHelper(); string strItemSQL = "select * from t_OutBillItem where F_BillID = @Value"; DataSet dsUpdateItem = myHelper.GetOtherDs(strItemSQL, GetParm()); foreach (DataRow dr in dsUpdateItem.Tables[0].Rows) { dr.Delete(); } DataSet dsItem = ((DataView)binItem.DataSource).Table.DataSet; DataTable dt = dsItem.Tables[0]; foreach (DataRow dr in dt.Rows) { DataRow drNew = dsUpdateItem.Tables[0].NewRow(); int intCnt = dt.Columns.Count; for (int i = 0; i < intCnt; i++) { if (dt.Columns[i].ColumnName == "F_BillID") { drNew["F_BillID"] = dsMaster.Tables[0].Rows[0]["F_BillID"].ToString(); } else { if (dsUpdateItem.Tables[0].Columns.IndexOf(dt.Columns[i].ColumnName) > 0) { drNew[dt.Columns[i].ColumnName] = dr[dt.Columns[i].ColumnName]; } } } dsUpdateItem.Tables[0].Rows.Add(drNew); } DataSet[] dsData = new DataSet[3]; dsData[0] = dsMaster; dsData[1] = dsUpdateSlaver; dsData[2] = dsUpdateItem; string[] strSQL = new string[3]; strSQL[0] = strMasterSQL; strSQL[1] = strSaveSlaverSQL; strSQL[2] = strItemSQL; if (myHelper.SaveMuteData1(dsData, strSQL, GetParm()).Length == 0) { MessageBox.Show("数据保存成功!!", "提示"); strBillID = editControl1.GetValue().ToString(); dsMaster.AcceptChanges(); dsSlaver.AcceptChanges(); dsItem.AcceptChanges(); SetStatus(2); return(true); } else { return(false); } }