private void btnOK_Click(object sender, EventArgs e) { try { iLoginEx.WriteUserProfileValue("StockQuery", "cInvCCode", txtcInvCCode.Text); iLoginEx.WriteUserProfileValue("StockQuery", "cWhCode", txtcWhCode.Text); iLoginEx.WriteUserProfileValue("StockQuery", "cInvCode", txtcInvCode.Text); iLoginEx.WriteUserProfileValue("StockQuery", "QtyL", txtQtyL.Text); iLoginEx.WriteUserProfileValue("StockQuery", "QtyH", txtQtyH.Text); iLoginEx.WriteUserProfileValue("StockQuery", "PriceL", txtPriceL.Text); iLoginEx.WriteUserProfileValue("StockQuery", "PriceH", txtPriceH.Text); iLoginEx.WriteUserProfileValue("StockQuery", "AmtL", txtAmtL.Text); iLoginEx.WriteUserProfileValue("StockQuery", "AmtH", txtAmtH.Text); iLoginEx.WriteUserProfileValue("StockQuery", "QureyType", cmbQureyType.SelectedIndex.ToString()); iLoginEx.WriteUserProfileValue("StockQuery", "InvABC", cmbABC.SelectedIndex.ToString()); IsQuery = true; this.Close(); } catch (Exception ex) { frmMessege frmmsg = new frmMessege(ex.ToString(), "btnOK_Click()"); frmmsg.ShowDialog(this); } }
private void StockQuery_Load(object sender, EventArgs e) { try { txtcInvCCode.Text = iLoginEx.ReadUserProfileValue("StockQuery", "cInvCCode"); //物料分类 txtcWhCode.Text = iLoginEx.ReadUserProfileValue("StockQuery", "cWhCode"); //仓库代码 txtcInvCode.Text = iLoginEx.ReadUserProfileValue("StockQuery", "cInvCode"); //物料编码 txtQtyL.Text = iLoginEx.ReadUserProfileValue("StockQuery", "QtyL"); //数量L txtQtyH.Text = iLoginEx.ReadUserProfileValue("StockQuery", "QtyH"); //数量H txtPriceL.Text = iLoginEx.ReadUserProfileValue("StockQuery", "PriceL"); //单价L txtPriceH.Text = iLoginEx.ReadUserProfileValue("StockQuery", "PriceH"); //单价H txtAmtL.Text = iLoginEx.ReadUserProfileValue("StockQuery", "AmtL"); //库存金额L txtAmtH.Text = iLoginEx.ReadUserProfileValue("StockQuery", "AmtH"); //库存金额H cmbQureyType.SelectedIndex = iLoginEx.ReadUserProfileValue("StockQuery", "QureyType").Length == 0 ? 0 : Convert.ToInt32(iLoginEx.ReadUserProfileValue("StockQuery", "QureyType")); //0=现存量;1=综合查询 cmbABC.SelectedIndex = iLoginEx.ReadUserProfileValue("StockQuery", "InvABC").Length == 0 ? 0 : Convert.ToInt32(iLoginEx.ReadUserProfileValue("StockQuery", "InvABC")); //ABC分类 txtPriceL.Enabled = iLoginEx.CheckAuthorityDetail(iLoginEx.UserId(), AuthID, LoginEx.AuthorityDetailType.Price); txtPriceH.Enabled = iLoginEx.CheckAuthorityDetail(iLoginEx.UserId(), AuthID, LoginEx.AuthorityDetailType.Price); txtAmtL.Enabled = iLoginEx.CheckAuthorityDetail(iLoginEx.UserId(), AuthID, LoginEx.AuthorityDetailType.Price); txtAmtH.Enabled = iLoginEx.CheckAuthorityDetail(iLoginEx.UserId(), AuthID, LoginEx.AuthorityDetailType.Price); if (!iLoginEx.CheckAuthorityDetail(iLoginEx.UserId(), AuthID, LoginEx.AuthorityDetailType.Price)) { txtPriceL.Text = ""; txtPriceH.Text = ""; txtAmtL.Text = ""; txtAmtH.Text = ""; } } catch (Exception ex) { frmMessege frmmsg = new frmMessege(ex.ToString(), "StockQuery_Load()"); frmmsg.ShowDialog(this); } }
private void txtcInvCCode_MouseDoubleClick(object sender, MouseEventArgs e) { try { frmcInvCCodeTree ftree = new frmcInvCCodeTree(iLoginEx); ftree.ShowDialog(this); txtcInvCCode.Text = ftree.cInvCCode; } catch (Exception ex) { frmMessege frmmsg = new frmMessege(ex.ToString(), "txtcInvCCode_MouseDoubleClick()"); frmmsg.ShowDialog(this); } }
public frmST532Main(string[] args) { try { InitializeComponent(); iLoginEx.Initialize(args, AuthID);//必须先初始化LoginEx SLbAccID.Text = iLoginEx.AccID(); SLbAccName.Text = iLoginEx.AccName(); SLbServer.Text = iLoginEx.DBServerHost(); SLbYear.Text = iLoginEx.iYear(); SLbUser.Text = iLoginEx.UserId() + "[" + iLoginEx.UserName() + "]"; } catch (Exception ex) { frmMessege frmmsg = new frmMessege(ex.ToString(), "frmST532Main()"); frmmsg.ShowDialog(this); } }
private void toolQuery_Click(object sender, EventArgs e) { try { frmQuery fQuery = new frmQuery(iLoginEx); fQuery.ShowDialog(this); if (fQuery.GetSQL().Length > 0) { OleDbConnection myConn = new OleDbConnection(iLoginEx.ConnString()); if (myConn.State == System.Data.ConnectionState.Open) { myConn.Close(); } myConn.Open(); OleDbCommand myCommand = new OleDbCommand(fQuery.GetSQL(), myConn); myCommand.ExecuteNonQuery(); this.tab1_dataGridView1.AutoGenerateColumns = true; //设置数据源 DataSet ds = new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(myCommand); da.Fill(ds); this.tab1_dataGridView1.DataSource = ds.Tables[0];//数据源 //标准居中 this.tab1_dataGridView1.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; //设置自动换行 this.tab1_dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True; //设置自动调整高度 this.tab1_dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; if (myConn.State == System.Data.ConnectionState.Open) { myConn.Close(); } for (int i = 0; i < tab1_dataGridView1.Columns.Count; i++) { tab1_dataGridView1.Columns[i].ReadOnly = true; } for (int i = 0; i < tab1_dataGridView1.Rows.Count; i++) { if (i % 2 == 0) { tab1_dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.LightCyan; } } tab1_dataGridView1.Columns[0].Width = 120; tab1_dataGridView1.Columns[1].Width = 200; tab1_dataGridView1.Columns[2].Width = 280; tab1_dataGridView1.Columns[3].DefaultCellStyle.Format = "#,###0"; tab1_dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; tab1_dataGridView1.Columns[4].DefaultCellStyle.Format = "#,###0.00"; tab1_dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; tab1_dataGridView1.Columns[5].DefaultCellStyle.Format = "#,###0"; tab1_dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; tab1_dataGridView1.Columns[6].DefaultCellStyle.Format = "#,###0.00"; tab1_dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; Tab2_SaveCulomnsWidth = true; //读取用户自定列宽 if (tab1_dataGridView1.Columns.Count > 0) { string ColumnsWidths = iLoginEx.ReadUserProfileValue("Tab1", "ColumnsWidths"); string[] ColumnsWidthsPara = ColumnsWidths.Split(';'); for (int i = 0; i < ColumnsWidthsPara.Length && i < tab1_dataGridView1.Columns.Count; i++) { if (ColumnsWidthsPara[i].Length > 0) { tab1_dataGridView1.Columns[i].Width = Convert.ToInt32(ColumnsWidthsPara[i]); } } } } } catch (Exception ex) { frmMessege frmmsg = new frmMessege(ex.ToString(), "toolQuery_Click()"); frmmsg.ShowDialog(this); } }