public override void BtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (GetGridStatu() == GridStatu.gsAdd) { int mRow = 0; string mNo = XF001.Text; string mSQL = "SELECT XF001 FROM POSXC LEFT JOIN POSXF ON XC001=XF008 WHERE XF001='" + mNo + "'"; while (!ValidMaxNo(mSQL)) { mNo = mNo.Substring(0, 9) + fc.ZeroatFirst((Int32.Parse(mNo.Substring(9, mNo.Length - 9)) + 1), 2); mSQL = "SELECT XF001 FROM POSXC LEFT JOIN POSXF ON XC001=XF008 WHERE XF001='" + mNo + "'"; } XF001.Text = mNo; //單身 for (int i = 0; i < GV_Body.RowCount; i++) { mRow = GV_Body.GetRowHandle(i); GV_Body.SetRowCellValue(mRow, "XG001", XF001.Text); //口味加料子單身 GV_Body.SetMasterRowExpanded(mRow, true); GridView gridViewTests = GV_Body.GetDetailView(mRow, 0) as GridView; if (gridViewTests != null) { for (int j = 0; j < gridViewTests.Columns.Count; j++) { gridViewTests.SetRowCellValue(mRow, "XK001", XF001.Text); } } } } base.BtnSave_ItemClick(sender, e); }
public override void GV_Body_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { base.GV_Body_InitNewRow(sender, e); GV_Body.PostEditor(); //int index = Int32.Parse(GV_Body.GetRowCellValue(FocuseRow_Body, "XL002").ToString()) + 1; int index = GV_Body.RowCount; GV_Body.FocusedColumn = GV_Body.Columns["XL002"]; //定位焦点网格的位置 FocuseRow_Body = GV_Body.FocusedRowHandle; //获取新焦点行的FocuseRowHandle并初始化全局变量 GV_Body.SetRowCellValue(FocuseRow_Body, "XL001", XI001.Text); GV_Body.SetRowCellValue(FocuseRow_Body, "XL002", string.Format("{0:0000}", index)); }
private void XB002ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (GetGridStatu() != BaseForm.GridStatu.gsBrowse) { f2.SetMI = new string[] { "POSXL", "001" }; f2.SetMIParam = new string[] { XA002.Text }; if (f2.GetMI) { GV_Body.SetRowCellValue(FocuseRow_Body, "XB007", f2.GetReturn[0]); GV_Body.SetRowCellValue(FocuseRow_Body, "XB007C", f2.GetReturn[1]); } } }
private void XG006ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (GetGridStatu() == BaseForm.GridStatu.gsBrowse) { return; } f2.SetMI = new string[] { "POSXC", "002" }; if (f2.GetMI) { GV_Body.SetRowCellValue(FocuseRow_Body, "XG006", f2.GetReturn[0]); GV_Body.SetRowCellValue(FocuseRow_Body, "XG006C", f2.GetReturn[1]); } }
private void XB007ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (GetGridStatu() == BaseForm.GridStatu.gsBrowse) { return; } f2.SetMI = new string[] { "POSXG", "001" }; f2.SetMIParam = new string[] { XF002.Text }; if (f2.GetMI) { GV_Body.SetRowCellValue(FocuseRow_Body, "XB007", f2.GetReturn[0]); GV_Body.SetRowCellValue(FocuseRow_Body, "XB007C", f2.GetReturn[1]); GV_Body.FocusedColumn = GV_Body.VisibleColumns[2];//菜單編號 GV_Body.ShowEditor(); } }
public override void BtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (GetGridStatu() == GridStatu.gsAdd) { int mRow = 0; string mNo = XA001.Text; string mSQL = "SELECT XA001 FROM POSXA WHERE XA001='" + mNo + "'"; while (!ValidMaxNo(mSQL)) { mNo = "R" + fc.ZeroatFirst((Int32.Parse(mNo.Substring(1, mNo.Length - 1)) + 1), 4); //R0000 mSQL = "SELECT XA001 FROM POSXA WHERE XA001='" + mNo + "'"; } XA001.Text = mNo; for (int i = 0; i < GV_Body.RowCount; i++) { mRow = GV_Body.GetRowHandle(i); GV_Body.SetRowCellValue(mRow, "XB001", XA001.Text); } } base.BtnSave_ItemClick(sender, e); if (FImage != null) { using (SqlConnection conn = new SqlConnection(fc.makeConnectString(fc.FDBInfo))) { conn.Open(); try { string SQL = "UPDATE POSXA SET XA010=@XA010 WHERE XA001='" + XA001.Text + "'"; SqlCommand cmd = new SqlCommand(SQL, conn); byte[] buffer = fc.ImageToBuffer(FImage, System.Drawing.Imaging.ImageFormat.Jpeg); cmd.Parameters.AddWithValue("@XA010", buffer); cmd.ExecuteNonQuery(); conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); fc.ErrorLog(ex.Message); conn.Close(); } } StorePic.Image = FImage; } }
/*public override void GC_Body_MouseClick(object sender, MouseEventArgs e) * { * base.GC_Body_MouseClick(sender, e); * if (IsCheckRequired) * { * if (GV_Body.RowCount == 0) * { * GV_Body.AddNewRow(); * GV_Body.SetRowCellValue(FocuseRow_Body, "XL001", XI001.Text); * GV_Body.SetRowCellValue(FocuseRow_Body, "XL002", "0001"); * } * } * }*/ public override void BtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (GetGridStatu() == GridStatu.gsAdd) { string mNo = XI001.Text; string mSQL = "SELECT XI001 FROM POSXI WHERE XI001='" + mNo + "'"; while (!ValidMaxNo(mSQL)) { mNo = "K" + fc.ZeroatFirst((Int32.Parse(mNo.Substring(1, mNo.Length - 1)) + 1), 3); //K000 mSQL = "SELECT XI001 FROM POSXI WHERE XI001='" + mNo + "'"; } XI001.Text = mNo; for (int i = 0; i < GV_Body.RowCount; i++) { GV_Body.SetRowCellValue(i, "XL001", XI001.Text); } } base.BtnSave_ItemClick(sender, e); }
private void XG002ButtonEdit_ButtonClick(object sender, ButtonPressedEventArgs e) { if (GetGridStatu() != BaseForm.GridStatu.gsBrowse) { string mXB007 = GV_Body.GetRowCellValue(FocuseRow_Body, "XB007").ToString(); f2.SetMI = new string[] { "POSXG", "002" }; f2.SetMIParam = new string[] { XF002.Text, mXB007 }; if (f2.GetMI) { GV_Body.SetRowCellValue(FocuseRow_Body, "XG002", f2.GetReturn[0]); GV_Body.SetRowCellValue(FocuseRow_Body, "XG002C", f2.GetReturn[1]); GV_Body.SetRowCellValue(FocuseRow_Body, "XB004", f2.GetReturn[2]); float mPrice = float.Parse(f2.GetReturn[2]); float mQty = float.Parse(GV_Body.GetRowCellValue(FocuseRow_Body, "XG003").ToString()); GV_Body.SetRowCellValue(FocuseRow_Body, "XG004", mPrice * mQty); GV_Body.FocusedColumn = GV_Body.VisibleColumns[9];//數量 GV_Body.ShowEditor(); } } }