private void Frm_Load(object sender, EventArgs e) { try { DbHelperSQL.connectionString = Conn; DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Active"; dt.Columns.Add(dc); DataRow dr = dt.NewRow(); dr["Active"] = "Yes"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["Active"] = "No"; dt.Rows.Add(dr); ItemLookUpEditActive.DataSource = dt; GetGrid(); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Rep货位标签 rep = new Rep货位标签(); DataTable dtPrint = rep.dataSet1.Tables[0]; for (int i = 0; i < gridView1.RowCount; i++) { if (Convert.ToBoolean(gridView1.GetRowCellValue(i, gridCol选择))) { DataRow dr = dtPrint.NewRow(); dr["Column1"] = gridView1.GetRowCellValue(i, gridCol仓库编码).ToString().Trim(); dr["Column2"] = gridView1.GetRowCellValue(i, gridCol仓库名称).ToString().Trim(); dr["Column3"] = gridView1.GetRowCellDisplayText(i, gridCol货位编码).ToString().Trim(); dr["Column4"] = gridView1.GetRowCellDisplayText(i, gridCol货位名称).ToString().Trim(); dtPrint.Rows.Add(dr); } } //rep.ShowPreview(); rep.Print(); sState = "print"; } catch (Exception ee) { FrmMsgBox msgBox = new FrmMsgBox(); msgBox.richTextBox1.Text = ee.Message; msgBox.Text = "打印失败"; msgBox.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { DbHelperSQL.connectionString = Conn; string sSQL = "SELECT DISTINCT ltrim(rtrim(iYear)) as iYear FROM [UFSystem]..UA_Account_sub WHERE iYear <> '9999' ORDER BY iYear"; DataTable dt = DbHelperSQL.Query(sSQL); lookUpEditiYear.Properties.DataSource = dt; lookUpEditiYear.EditValue = DateTime.Now.Year.ToString().Trim(); sSQL = "select ccode,ccode_name from code where ISNULL(bend ,0) = 1 and iyear = aaaaaa order by ccode"; sSQL = sSQL.Replace("aaaaaa", lookUpEditiYear.Text.Trim()); DataTable dt1 = DbHelperSQL.Query(sSQL); ItemLookUpEdit科目编码.DataSource = dt1; ItemLookUpEdit科目名称.DataSource = dt1; GetGrid(); gridView1.FocusedRowHandle = 0; } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnDel_Click(object sender, EventArgs e) { try { try { gridView返利单.FocusedRowHandle -= 1; gridView返利单.FocusedRowHandle += 1; } catch { } string sErr = ""; int iCou = 0; SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { if (txt单据号.Text.Trim() == "") { throw new Exception("请选择单据"); } string sSQL = @" select * from [dbo].[_高开返利核销单] where cCode = '{0}' "; sSQL = string.Format(sSQL, txt单据号.Text.Trim()); DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; if (dt == null || dt.Rows.Count == 0) { throw new Exception("单据不存在"); } DAL._高开返利核销单 dal = new UFIDA.U8.UAP.CustomApp.ControlForm.DAL._高开返利核销单(); sSQL = dal.Delete(txt单据号.Text.Trim()); iCou = DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); tran.Commit(); if (iCou > 0) { MessageBox.Show("删除成功"); this.Close(); } } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "删除失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnDelRow_Click(object sender, EventArgs e) { try { for (int i = gridView1.RowCount - 1; i >= 0; i--) { string sInvCode = gridView1.GetRowCellValue(i, gridColcInvCode).ToString().Trim(); if (sInvCode == "") { continue; } if (BaseFunction.ReturnBool(gridView1.GetRowCellValue(i, gridColchoose))) { gridView1.DeleteRow(i); } } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "删行失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void tsbClearCon_Click(object sender, EventArgs e) { try { lookUpEditcCode1.EditValue = DBNull.Value; lookUpEditcCode2.EditValue = DBNull.Value; lookUpEditcInvCode.EditValue = DBNull.Value; lookUpEditcInvName.EditValue = DBNull.Value; dtm1.Text = ""; dtm2.Text = ""; radioValid.Checked = true; radioAllType.Checked = true; GetLookUp(); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "清空过滤条件失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { List <String> list = LocalPrinter.GetLocalPrinters(); //获得系统中的打印机列表 DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Printer"; dt.Columns.Add(dc); foreach (String s in list) { DataRow dr = dt.NewRow(); dr["Printer"] = s; dt.Rows.Add(dr); } lookUpEditPrinter.Properties.DataSource = dt; lookUpEditPrinter.EditValue = LocalPrinter.DefaultPrinter(); DbHelperSQL.connectionString = Conn; dateEdit1.DateTime = BaseFunction.ReturnDate(DateTime.Today.ToString("yyyy-MM-01")); dateEdit2.DateTime = BaseFunction.ReturnDate(DateTime.Today.AddMonths(1).ToString("yyyy-MM-01")).AddDays(-1); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnQuery_Click(object sender, EventArgs e) { try { FrmSEL_ImportTransVouch frm = new FrmSEL_ImportTransVouch(); frm.StartPosition = FormStartPosition.CenterParent; if (frm.ShowDialog() != DialogResult.OK) { return; } dateEditQuery.DateTime = frm.dtmReturn; string sInvoiceNO = frm.sInvoiceNO; string sContaineNO = frm.sContainerNO; lsContaineNO.Text = sContaineNO; GetGrid(sInvoiceNO, sContaineNO); } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); SetTxtNull(); } }
private void btnQuery_Click(object sender, EventArgs e) { try { string sSQL = @" SELECT distinct cast(0 as bit) as bSelected, InvoiceNo,CONVERT(varchar(100), [Date], 23) as dDate FROM RDRECORDS01_IMPORT where 1=1 "; if (txtInvoiceNo.Text.Trim() != "") { sSQL = sSQL.Replace("1=1", "1=1 and InvoiceNo like '%" + txtInvoiceNo.Text.Trim() + "%'"); } if (dateEdit1.Text.Trim() != "") { sSQL = sSQL.Replace("1=1", "1=1 and [Date] >= '" + dateEdit1.DateTime.ToString("yyyy-MM-dd") + "'"); } if (dateEdit2.Text.Trim() != "") { sSQL = sSQL.Replace("1=1", "1=1 and [Date] < '" + dateEdit2.DateTime.AddDays(1).ToString("yyyy-MM-dd") + "'"); } DataTable dt = DbHelperSQL.Query(sSQL); gridControl1.DataSource = dt; gridView1.BestFitColumns(); } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }
private void btnOK_Click(object sender, EventArgs e) { try { for (int i = 0; i < gridView1.RowCount; i++) { if (BaseFunction.ReturnBool(gridView1.GetRowCellValue(i, gridColbSelected))) { dtmReturn = BaseFunction.ReturnDate(gridView1.GetRowCellValue(i, gridColdDate)); sInvoiceNO = gridView1.GetRowCellValue(i, gridColInvoiceNo).ToString().Trim(); sContainerNO = txtContainerNO.Text.Trim(); break; } } if (dtmReturn != null && dtmReturn > Convert.ToDateTime("2000-01-01")) { this.DialogResult = DialogResult.OK; } } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { iYear = BaseFunction.ReturnDate(sLogDate).Year; iMonth = BaseFunction.ReturnDate(sLogDate).Month; DbHelperSQL.connectionString = Conn; string sSQL = @"select * from _Code where cCode like 'ufdata_%'"; DataTable dt = DbHelperSQL.Query(sSQL); if (dt == null || dt.Rows.Count == 0) { throw new Exception("请设置来源数据库“_Code”"); } sDataFrom = dt.Rows[0]["cCode"].ToString().Trim(); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void GetGrid() { try { string sSQL = @" select cast(0 as bit) as choose , a.* from _BarCodeList a where 1=-1 order by a.BarCode "; DataTable dt = DbHelperSQL.Query(sSQL); gridControl1.DataSource = dt; gridView1.AddNewRow(); chkAll.Checked = false; } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载数据失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnExport_Click(object sender, EventArgs e) { try { try { gridView1.FocusedRowHandle -= 1; gridView1.FocusedRowHandle += 1; } catch { } SaveFileDialog sF = new SaveFileDialog(); sF.DefaultExt = "xlsx"; sF.Filter = "xlsx(*.xlsx)|*.xlsx|All Files(*.*)|*.*"; DialogResult dRes = sF.ShowDialog(); if (DialogResult.OK != dRes) { return; } gridView1.ExportToXlsx(sF.FileName); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "Export Err"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { label1.Text = ""; DbHelperSQL.connectionString = Conn; DateTime dLogDate = BaseFunction.ReturnDate(sLogDate); string sSQL = @" select distinct cast(year(dDate) as varchar(4)) + '.' + right('00' + cast(MONTH(dDate) as varchar(2)),2) as Period from Rdrecord01 order by cast(year(dDate) as varchar(4)) + '.' + right('00' + cast(MONTH(dDate) as varchar(2)),2) desc "; DataTable dt = DbHelperSQL.Query(sSQL); lookUpEditPeriod.Properties.DataSource = dt; lookUpEditPeriod.EditValue = dLogDate.Year.ToString() + "." + dLogDate.Month.ToString().PadLeft(2, '0'); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "Err"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnPrintSet_Click(object sender, EventArgs e) { try { if (!Directory.Exists(sProPath + "\\print")) { Directory.CreateDirectory(sProPath + "\\print"); } if (File.Exists(sPrintLayOutMod)) { Rep.LoadLayout(sPrintLayOutMod); } Rep.ShowDesignerDialog(); DialogResult d = MessageBox.Show("是否保存?模板调整将在下次打开窗体时体现\n是:保存打印模板\n", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (DialogResult.Yes == d) { Rep.SaveLayoutToXml(sPrintLayOutMod); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "设置打印模板失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void tsbClearCon_Click(object sender, EventArgs e) { try { lookUpEditBarCode1.EditValue = DBNull.Value; lookUpEditBarCode2.EditValue = DBNull.Value; lookUpEditRdCode011.EditValue = DBNull.Value; lookUpEditRdCode012.EditValue = DBNull.Value; lookUpEditcVenCode.EditValue = DBNull.Value; lookUpEditcVenName.EditValue = DBNull.Value; lookUpEditExType.EditValue = DBNull.Value; lookUpEditcInvCode.EditValue = DBNull.Value; lookUpEditcInvName.EditValue = DBNull.Value; lookUpEditcWhCode.EditValue = DBNull.Value; lookUpEditcWhName.EditValue = DBNull.Value; lookUpEditMom1.EditValue = DBNull.Value; lookUpEditMom2.EditValue = DBNull.Value; lookUpEditOM1.EditValue = DBNull.Value; lookUpEditOM2.EditValue = DBNull.Value; dtm1.Text = ""; dtm2.Text = ""; } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "清空过滤条件失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnExcel_Click(object sender, EventArgs e) { try { if (!clsUserRight.chkRight(sUserID, 3590)) { throw new Exception("没有权限"); } SaveFileDialog sF = new SaveFileDialog(); sF.DefaultExt = "xls"; sF.FileName = this.Text; sF.Filter = "Excel文件(*.xls)|*.xls|所有文件(*.*)|*.*"; DialogResult dRes = sF.ShowDialog(); if (DialogResult.OK == dRes) { gridView1.ExportToXls(sF.FileName); MessageBox.Show("导出Excel成功\n\t路径:" + sF.FileName); } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "导出Excel失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { SetNull(); dtm.DateTime = BaseFunction.ReturnDate(sLogDate); SetLookUp(); if (s_Code != null && s_Code.Trim() != "") { GetGrid(s_Code, Conn, sUserID, sUserName, sLogDate, sAccID); } if (s_Code == "" || s_Code == null) { SetEnable(true); } else { SetEnable(false); btnLoad.Enabled = false; } } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void tsbClearCon_Click(object sender, EventArgs e) { try { lookUpEditcCode1.EditValue = DBNull.Value; lookUpEditcCode2.EditValue = DBNull.Value; lookUpEditcVenCode.EditValue = DBNull.Value; lookUpEditcVenName.EditValue = DBNull.Value; lookUpEditcInvCode.EditValue = DBNull.Value; lookUpEditcInvName.EditValue = DBNull.Value; lookUpEditcWhCode.EditValue = DBNull.Value; lookUpEditcWhName.EditValue = DBNull.Value; dtm1.Text = ""; dtm2.Text = ""; chkScanIn.Checked = false; chkOM.Checked = false; radioUnAudit.Checked = true; } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "清空过滤条件失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnQuery_Click(object sender, EventArgs e) { try { string sSQL = @" SELECT distinct cast(0 as bit) as bSelected, InvoiceNo,CONVERT(varchar(100), [Date], 23) as dDate FROM RDRECORDS01_IMPORT where 1=1 "; if (txtInvoiceNo.Text.Trim() != "") { sSQL = sSQL.Replace("1=1", "1=1 and InvoiceNo like '%" + txtInvoiceNo.Text.Trim() + "%'"); } if (dateEdit1.Text.Trim() != "") { sSQL = sSQL.Replace("1=1", "1=1 and [Date] >= '" + dateEdit1.DateTime.ToString("yyyy-MM-dd") + "'"); } if (dateEdit2.Text.Trim() != "") { sSQL = sSQL.Replace("1=1", "1=1 and [Date] < '" + dateEdit2.DateTime.AddDays(1).ToString("yyyy-MM-dd") + "'"); } if (radioUnCreated.Checked) { sSQL = sSQL.Replace("1=1", @"1=1 and AutoID not in ( SELECT a.AutoID FROM RdRecords01_Import a left join ( select a.cPBVCode,b.ID from PurBillVouch a inner join PurBillVouchs b on a.PBVID = b.PBVID ) c on a.PurBillIDs = c.ID where isnull(c.cPBVCode,'') <> '' )"); } if (radioCreated.Checked) { sSQL = sSQL.Replace("1=1", @"1=1 and AutoID not in ( SELECT a.AutoID FROM RdRecords01_Import a left join ( select a.cPBVCode,b.ID from PurBillVouch a inner join PurBillVouchs b on a.PBVID = b.PBVID ) c on a.PurBillIDs = c.ID where isnull(c.cPBVCode,'') = '' )"); } DataTable dt = DbHelperSQL.Query(sSQL); gridControl1.DataSource = dt; gridView1.BestFitColumns(); } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }
private void btnCheck_Click(object sender, EventArgs e) { try { gridViewIN.FocusedRowHandle -= 1; gridViewIN.FocusedRowHandle += 1; gridViewPL.FocusedRowHandle -= 1; gridViewPL.FocusedRowHandle += 1; } catch { } try { if (gridViewIN.RowCount == 0 || gridViewPL.RowCount == 0) { throw new Exception("No data"); } if (dateEdit1.DateTime < BaseFunction.ReturnDate("2017-01-01")) { throw new Exception("Date is err"); } decimal dPLSum = BaseFunction.ReturnDecimal(gridViewPL.Columns["QUANTITY"].SummaryItem.SummaryValue); decimal dINSum = BaseFunction.ReturnDecimal(gridViewIN.Columns["QUANTITY"].SummaryItem.SummaryValue); if (dPLSum != dINSum) { throw new Exception("Please check the quantity"); } string sErr = ""; int iCount = 0; SqlConnection conn = new SqlConnection(Conn); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { CheckData(tran); tran.Commit(); MessageBox.Show("CHECK OK"); } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void ItemButtonEditShowDetails_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { try { int iRow = gridView1.FocusedRowHandle; if (iRow >= 0) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = gridView1.GetRowCellDisplayText(iRow, gridColRemark).ToString().Trim(); frm.ShowDialog(); } } catch { } }
private void Frm_Load(object sender, EventArgs e) { try { liSOsID.Text = ""; if (sUserID.ToLower() == "demo") { btnPrintSet.Visible = true; } else { btnPrintSet.Visible = false; } List <String> list = LocalPrinter.GetLocalPrinters(); //获得系统中的打印机列表 DataTable dt = new DataTable(); DataColumn dc = new DataColumn(); dc.ColumnName = "Printer"; dt.Columns.Add(dc); foreach (String s in list) { DataRow dr = dt.NewRow(); dr["Printer"] = s; dt.Rows.Add(dr); } lookUpEditPrinter.Properties.DataSource = dt; lookUpEditPrinter.EditValue = LocalPrinter.DefaultPrinter(); DbHelperSQL.connectionString = Conn; SetLookUp(); string sSQL = sSQLGrid; sSQL = sSQL.Replace("1=1", "1=-1"); dtGrid = DbHelperSQL.Query(sSQL); dtPrint = dtGrid.Copy(); btnTxtBarCode.Focus(); sPrintLayOutMod = sPrintLayOutMod.Replace("aaaaaaaa", lookUpEditFlowType.Text.Trim()); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "加载窗体失败"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void Frm_Load(object sender, EventArgs e) { try { DbHelperSQL.connectionString = Conn; } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "Err"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void FrmExchangeDetails_Load(object sender, EventArgs e) { try { GetGrid(); } catch (Exception ee) { FrmMsgBox f = new FrmMsgBox(); f.Text = "Err"; f.richTextBox1.Text = ee.Message; f.ShowDialog(); } }
private void btnClosed_Click(object sender, EventArgs e) { try { try { gridView1.FocusedRowHandle -= 1; gridView1.FocusedRowHandle += 1; } catch { } if (sState != "history" && sState != "save" && sState != "print") { throw new Exception("必须是新保存的条码,或者历史条码才能关闭"); } SqlConnection conn = new SqlConnection(Conn); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { for (int i = 0; i < gridView1.RowCount; i++) { if (Convert.ToBoolean(gridView1.GetRowCellValue(i, gridCol选择))) { string sSQL = "update 条形码信息 set 关闭人 = '" + sUserID + "',关闭日期 = getdate() where 条形码 = " + gridView1.GetRowCellValue(i, gridCol条形码).ToString().Trim(); SqlHelper.ExecuteNonQuery(tran, CommandType.Text, sSQL); } } tran.Commit(); GetGrid(); } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox msgBox = new FrmMsgBox(); msgBox.richTextBox1.Text = ee.Message; msgBox.Text = "关闭失败"; msgBox.ShowDialog(); } }
private void FrmSEL_Load(object sender, EventArgs e) { try { txtInvoiceNo.Text = ""; dateEdit1.DateTime = DateTime.Today.AddDays(-7); dateEdit2.DateTime = DateTime.Today; } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }
private void btnHistory_Click(object sender, EventArgs e) { try { GetGrid(); sState = "history"; } catch (Exception ee) { FrmMsgBox msgBox = new FrmMsgBox(); msgBox.richTextBox1.Text = ee.Message; msgBox.Text = "保存失败"; msgBox.ShowDialog(); } }
private void FrmSEL_Load(object sender, EventArgs e) { try { txtInvoiceNo.Text = ""; dateEdit1.EditValue = DBNull.Value; dateEdit2.EditValue = DBNull.Value; } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }