Exemple #1
0
        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);
        }
Exemple #2
0
 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;
     }
 }
Exemple #3
0
        public override void GV_Body_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            base.GV_Body_InitNewRow(sender, e);
            ColumnView newview = (ColumnView)GC_Body.FocusedView;

            newview.FocusedColumn = newview.Columns["XB007"];
            FocuseRow_Body        = newview.FocusedRowHandle;
            newview.ShowEditor();
            int idx = 0;

            for (int i = 0; i < GV_Body.RowCount; i++)
            {
                int mRow = GV_Body.GetRowHandle(i);
                if (GV_Body.IsMasterRow(mRow))
                {
                    idx++;
                }
            }
            GV_Body.SetFocusedRowCellValue("XG001", XF001.Text);
            GV_Body.SetFocusedRowCellValue("XG002", "");
            GV_Body.SetFocusedRowCellValue("XG006", fc.FUser.ID);
            GV_Body.SetFocusedRowCellValue("XG006C", fc.FUser.Name);
            GV_Body.SetFocusedRowCellValue("XG010", string.Format("{0:0000}", idx));
        }