private void Query() { if (!StaticFunctions.CheckSave(gcQuery, dtShow)) { return; } gridCMain.Select(); string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strQueryFlag }); DataSet dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } frmDataTable = dtAdd.Tables[0]; if (drMain["MainGvShowIcon"].ToString() == "True") { DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; } else if (drMain["MainGvShowPic"].ToString() == "True") { DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; foreach (DataRow dr in frmDataTable.Rows) { dr["Icon"] = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); } } if (drMain["IsAddChildGv"].ToString() == "True" && strRelationsKeyId != string.Empty && dtAdd.Tables.Count >= 2) { dtAdd.Relations.Add("gridCMainChildGrid", frmDataTable.Columns[strRelationsKeyId], dtAdd.Tables[1].Columns[strRelationsKeyId]); } dtAdd.AcceptChanges(); gridCMain.DataSource = frmDataTable.DefaultView;//可能引发gridView1_FocusedRowChanged gridVMain.BestFitColumns(); SetMoreInfo(false); }
private void btnOk_Click(object sender, EventArgs e) { if (!StaticFunctions.CheckSave(gcQuery, dtShow, strReportName)) { return; } try { this.Cursor = Cursors.WaitCursor; btnOk.Enabled = false; string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, strReportName, out strSpParmName); if (!string.IsNullOrEmpty(strParas)) { string[] strParaVals = strParas.Split("&".ToCharArray()); foreach (string strParVal in strParaVals) { string[] strPVal = strParVal.Split("=".ToCharArray()); if (strPVal.Length == 2) { strSpParmName += strSpParmName == string.Empty ? strPVal[0] : "," + strPVal[0]; lisSpParmValue.Add(strPVal[1]); } } } if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "EUser_Id,EDept_Id,Fy_Id").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), }); DataSet dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } ShowReports(dtAdd); } catch (Exception err) { MessageBox.Show("错误:" + err.Message); } finally { btnOk.Enabled = true; this.Cursor = Cursors.Default; } }
private void Query() { if (!StaticFunctions.CheckSave(gcQuery, dtShow)) { return; } string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "ClassName,EUser_Id,EDept_Id,Fy_Id").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { this.Name, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), }); DataSet ds = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (ds == null) { return; } DataTable dtShowExcel = ds.Tables[0]; dtShowExcel.AcceptChanges(); frmDataTable = ds.Tables[1]; DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; frmDataTable.AcceptChanges(); for (int i = gridVInfo.Columns.Count - 1; i >= 0; i--) { DevExpress.XtraGrid.Columns.GridColumn gc = gridVInfo.Columns[i]; if (gc.FieldName == "Icon") { continue; } gridVInfo.Columns.Remove(gc); } //gridVInfo.Columns.Clear(); StaticFunctions.ShowExcelGridControl(gridVInfo, dtShowExcel.DefaultView); gridCInfo.DataSource = frmDataTable.DefaultView; gridVInfo.BestFitColumns(); }
private void Query() { if (!StaticFunctions.CheckSave(gcQuery, dtShow)) { return; } xtabItemInfo.Select(); string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strQueryFlag }); DataSet dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } try { ShowReports(dtAdd); } catch (Exception err) { MessageBox.Show("错误:" + err.InnerException.Message); } ////打印Reporting service 有待完善,打印字体太大 //string strFilePath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\SysRpt\\" + "Rpt_Fy_ProductionDate" + ".rdlc"; //using (ReportPrint rpt = new ReportPrint(strFilePath, dtAdd, "RptSto")) //{ // rpt.PrintRpt(); //} }
private void Query() { if (!StaticFunctions.CheckSave(gcQuery, dtShow)) { return; } string strTabSel = xtabItemInfo.SelectedTabPage.Name; DataRow[] drTabs = dtTabs.Select("TabName='" + strTabSel + "'"); if (drTabs.Length <= 0) { return; } DataRow drTab = drTabs[0]; GridView gv = gcItems[drTab["GridViewName"].ToString()]; gv.GridControl.Select(); string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strQueryFlag }); DataSet dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } BoundGridView(dtAdd); }
private void DoSave() { DataRow dr = gridVMain.GetFocusedDataRow(); if (dr == null) { return; } if (!StaticFunctions.CheckSave(dr, gcInfo, dtShow)) { return; } string strField = string.Empty; string strValues = string.Empty; btnSave.Enabled = false; if (dr[strKeyFiled].ToString() == string.Empty) { strValues = StaticFunctions.GetAddValues(dr, strFileds, out strField); string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcInfo, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "strFields,strFieldValues,EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strField, strValues, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), "2" }); DataSet dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { btnSave.Enabled = true; return; } DataRow drNew = dtAdd.Tables[0].Rows[0]; //string[] strKeys = "Material_Dt".Split(",".ToCharArray()); //foreach (string strK in strKeys) //{ // dr[strK] = drNew[strK]; //} dr[strKeyFiled] = drNew[strKeyFiled]; } else { strValues = StaticFunctions.GetUpdateValues(frmDataTable, dr, strFileds); if (strValues != string.Empty) { string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcInfo, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "strEditSql,Key_Id,EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strValues, dr[strKeyFiled].ToString(), CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), "3" }); DataTable dtAdd = this.DataRequest_By_DataTable(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { btnSave.Enabled = true; return; } DataRow drNew = dtAdd.Rows[0]; } } dr.AcceptChanges(); SetWMode("VIEW"); }
private void DoSave() { DataRow dr = (treeList1.GetDataRecordByNode(treeList1.FocusedNode) as DataRowView).Row; if (dr == null) { return; } if (!StaticFunctions.CheckSave(dr, gcInfo, dtShow)) { return; } string strField = string.Empty; string strValues = string.Empty; btnSave.Enabled = false; bool blChgState = false; try { if (dr[strKeyFiled].ToString() == string.Empty || dr[strKeyFiled].ToString() == "-1") { strValues = StaticFunctions.GetAddValues(dr, strFileds, out strField); DataSet dtAdd = null; string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcInfo, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } DataRow[] drShares = dtSp.Select("SpName='" + strSpName + "' AND SpFlag='" + drMain["AddFlag"].ToString() + "'"); if (drShares.Length == 0) { string[] strKey = (strSpParmName + "strFields,strFieldValues,EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strField, strValues, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), drMain["AddFlag"].ToString() }); dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); } else { string[] strKey = (strSpParmName + "BsuSetSp_Id,strFields,strFieldValues,EUser_Id,EDept_Id,Fy_Id").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { drShares[0]["BsuSetSp_Id"].ToString(), strField, strValues, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString() }); dtAdd = this.DataRequest_By_DataSet(strShareSpName, strKey, lisSpParmValue.ToArray()); } if (dtAdd == null) { btnSave.Enabled = true; return; } DataRow drNew = dtAdd.Tables[0].Rows[0]; dr[strKeyFiled] = drNew[strKeyFiled]; if (dtAdd.Tables[0].Columns.Contains("UpdateFields")) { StaticFunctions.UpdateDataRowSyn(dr, drNew, drNew["UpdateFields"].ToString()); } } else { strValues = StaticFunctions.GetUpdateValues(frmDataTable, dr, strFileds); if (strValues != string.Empty) { DataSet dsAdd = null; string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcInfo, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } DataRow[] drShares = dtSp.Select("SpName='" + strSpName + "' AND SpFlag='" + drMain["EditFlag"].ToString() + "'"); if (drShares.Length == 0) { string[] strKey = (strSpParmName + "strEditSql,Key_Id,EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strValues, dr[strKeyFiled].ToString(), CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), drMain["EditFlag"].ToString() }); dsAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); } else { string[] strKey = (strSpParmName + "BsuSetSp_Id,strEditSql,Key_Id,EUser_Id,EDept_Id,Fy_Id").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { drShares[0]["BsuSetSp_Id"].ToString(), strValues, dr[strKeyFiled].ToString(), CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString() }); dsAdd = this.DataRequest_By_DataSet(strShareSpName, strKey, lisSpParmValue.ToArray()); } if (dsAdd == null) { btnSave.Enabled = true; return; } if (dsAdd.Tables.Count > 0 && dsAdd.Tables[0].Columns.Contains("UpdateFields")) { DataRow drNew = dsAdd.Tables[0].Rows[0]; StaticFunctions.UpdateDataRowSyn(dr, drNew, drNew["UpdateFields"].ToString()); } if (dr.Table.Columns.Contains("State") && dr["State"].ToString() != dr["State", DataRowVersion.Original].ToString()) { blChgState = true; } } } dr.AcceptChanges(); SetWMode("VIEW"); if (blChgState) { SetFocRowstyleFormat(dr); } } catch (Exception err) { MessageBox.Show("错误:" + err.Message); btnSave.Enabled = true; } }
private void btnOk_Click(object sender, EventArgs e) { if (!StaticFunctions.CheckSave(gcSet, dtShow)) { return; } strFileds = StaticFunctions.GetUpdateFields(gcSet, dtShow); if (string.IsNullOrEmpty(StrUpdKeyIds)) { this.DialogResult = DialogResult.Yes; return; } string strValues = string.Empty; DataRow drEdit = frmDataTable.Rows[0]; foreach (string strFiled in strFileds) { if (drEdit[strFiled].ToString() == drEdit[strFiled, DataRowVersion.Original].ToString()) { continue; } string strValue = drEdit[strFiled].ToString(); if (strValue == "-9999") { strValues += strValues == string.Empty ? strFiled + "=default" : "," + strFiled + "=default"; } else { strValues += strValues == string.Empty ? strFiled + "='" + strValue.Replace("'", "''") + "'" : "," + strFiled + "='" + strValue.Replace("'", "''") + "'"; } } DataSet dtAdd = null; List <string> lisSpParmValue = new List <string>(); DataRow[] drShares = dtSp.Select("SpName='" + StrUpdSpName + "' AND SpFlag='" + DrBtn["UpdateOrdStateFlag"].ToString() + "'"); if (drShares.Length == 0) { string[] strKey = "strEditSql,Key_Id,Key_Ids,EUser_Id,EDept_Id,Fy_Id,flag".Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strValues, StrUpdKeyIds.IndexOf(',') == -1?StrUpdKeyIds:"-1", StrUpdKeyIds, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), DrBtn["UpdateOrdStateFlag"].ToString() }); dtAdd = this.DataRequest_By_DataSet(StrUpdSpName, strKey, lisSpParmValue.ToArray()); } else { string[] strKey = "BsuSetSp_Id,strEditSql,Key_Id,Key_Ids,EUser_Id,EDept_Id,Fy_Id".Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { drShares[0]["BsuSetSp_Id"].ToString(), strValues, StrUpdKeyIds.IndexOf(',') == -1?StrUpdKeyIds:"-1", StrUpdKeyIds, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString() }); dtAdd = this.DataRequest_By_DataSet(strShareSpName, strKey, lisSpParmValue.ToArray()); } if (dtAdd == null) { return; } DtRets = dtAdd; this.DialogResult = DialogResult.Yes; }
private void btnOk_Click(object sender, EventArgs e) { if (!StaticFunctions.CheckSave(gcSet, dtShow)) { return; } strFileds = StaticFunctions.GetUpdateFields(gcSet, dtShow); if (string.IsNullOrEmpty(StrUpdKeyIds)) { this.DialogResult = DialogResult.Yes; return; } string strValues = string.Empty; DataRow drEdit = frmDataTable.Rows[0]; foreach (string strFiled in strFileds) { if (drEdit[strFiled] == DBNull.Value || drEdit[strFiled].ToString() == string.Empty || drEdit[strFiled].ToString().Trim() == "-9999") { continue; } strValues += strValues == string.Empty ? strFiled + "='" + drEdit[strFiled].ToString().Replace("'", "''") + "'" : "," + strFiled + "='" + drEdit[strFiled].ToString().Replace("'", "''") + "'"; } if (strValues == string.Empty) { this.DialogResult = DialogResult.No; this.Close(); return; } DataTable dtAdd = null; List <string> lisSpParmValue = new List <string>(); string strBatchEditSpFlag = DrBtn["BatchEditSpFlag"].ToString(); DataRow[] drShares = DtSps.Select("SpName='" + StrUpdSpName + "' AND SpFlag='" + strBatchEditSpFlag + "'"); if (drShares.Length == 0) { string[] strKey = "strEditSql,Key_Ids,EUser_Id,EDept_Id,Fy_Id,flag".Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strValues, StrUpdKeyIds, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strBatchEditSpFlag }); dtAdd = this.DataRequest_By_DataTable(StrUpdSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } } else { string[] strKey = "BsuSetSp_Id,strEditSql,Key_Ids,EUser_Id,EDept_Id,Fy_Id".Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { drShares[0]["BsuSetSp_Id"].ToString(), strValues, StrUpdKeyIds, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString() }); dtAdd = this.DataRequest_By_DataTable(strShareSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } } DtRets = dtAdd; foreach (DataRow dr in DrBatchs) { foreach (DataColumn dc in frmDataTable.Columns) { string strFiled = dc.ColumnName; if (drEdit[strFiled] == DBNull.Value || drEdit[strFiled].ToString() == string.Empty || drEdit[strFiled].ToString().Trim() == "-9999") { continue; } dr[strFiled] = drEdit[strFiled]; } if (dtAdd.Columns.Contains("UpdateFields")) { DataRow drNew = dtAdd.Rows[0]; StaticFunctions.UpdateDataRowSyn(dr, drNew, drNew["UpdateFields"].ToString()); } } this.DialogResult = DialogResult.Yes; }
private void DoOk() { DataRow dr = frmDataTable.Rows[0]; foreach (Control ctrParent in GcOrdControls.Values) { if (!StaticFunctions.CheckSave(dr, ctrParent, dtShow)) { return; } } DoPostEditor(); string strSplits = StaticFunctions.GetStringX(strFileds, dtInfo, drBtn["FrmSaveFilter"].ToString()); if (dtInfo.Rows.Count > 0 && strSplits == string.Empty) { MessageBox.Show("没有可保存的明细记录."); return; } string strSplitsInfo = string.Empty; if (dtInfoInfo != null) { strSplitsInfo = StaticFunctions.GetStringX(strFiledsInfo, dtInfoInfo, drBtn["FrmSaveFilter"].ToString()); } string strSplitsOrd = StaticFunctions.GetStringX(lstFiledsOrd.ToArray(), frmDataTable); string[] strKey = null; string[] strVal = null; if (strSplitsInfo == string.Empty) { strKey = "Key_Ids,strSplitOrd,strSplits,EUser_Id,EDept_Id,Fy_Id,flag".Split(",".ToCharArray()); strVal = new string[] { StrOrdKeyId, strSplitsOrd, strSplits, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strAddFlag }; } else { strKey = "Key_Ids,strSplitOrd,strSplits,strSplitsInfo,EUser_Id,EDept_Id,Fy_Id,flag".Split(",".ToCharArray()); strVal = new string[] { StrOrdKeyId, strSplitsOrd, strSplits, strSplitsInfo, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strAddFlag }; } DataSet dsAdd = this.DataRequest_By_DataSet(strSpName, strKey, strVal); if (dsAdd == null) { return; } MessageBox.Show("操作成功."); if (drBtn["SucceRefXtabNames"].ToString() != string.Empty) { Form frmExist = StaticFunctions.GetExistedBsuChildForm(this.ParentForm, ClassNameParent, BusClassNameParent); if (frmExist != null && frmExist is frmSysBusOPCenter) { (frmExist as frmSysBusOPCenter).UpdateData(drBtn["SucceRefXtabNames"].ToString()); } } if (drBtn["FormBsuClass"].ToString() != string.Empty && drBtn["FormMenus_Class"].ToString() != string.Empty) { StaticFunctions.OpenBsuChildEditorForm(true, "ProduceManager", this.ParentForm, drBtn["FormCaption"].ToString(), drBtn["FormBsuClass"].ToString(), drBtn["FormMenus_Class"].ToString(), "VIEW", "KeyId=" + dsAdd.Tables[0].Rows[0][strKeyFiled].ToString() + "&BusClassName=" + drBtn["FormMenus_Class"].ToString(), null); } else if (drBtn["IsPrintTicket"].ToString() == "True") { DoPrintTicketInfoSpecial(drBtn, dsAdd.Tables[0]); } //生产加工单条码图片并上传 if (dsAdd.Tables[0].Columns.IndexOf("BarcodeFileName") != -1 && dsAdd.Tables[0].Columns.IndexOf("BarcodeNumber") != -1) { drAddTemp = dsAdd.Tables[0].Rows[0]; tdCreateBarcodeImage = new Thread(new ThreadStart(CreateBarcodeImage)); tdCreateBarcodeImage.Start(); } this.Close(); this.Dispose(); }