示例#1
0
        private void saveLotto()
        {
            Lotto  lot = new Lotto();
            String lotId = "", Cbdl = "";

            //if (lotNew)
            //{
            lotId = lot.getGenID();
            Cbdl  = lc.lotdb.selectCDbl();
            //}
            for (int i = 0; i < dgv1.RowCount; i++)
            {
                if (dgv1[colNumber, i].Value == null)
                {
                    continue;
                }
                lot = setLotto(i);
                if (lot.lottoId.Equals(""))
                {
                    if (lotNew)
                    {
                        lot.lottoId = lotId;
                        lot.CDbl    = Cbdl;
                    }
                    else
                    {
                        lot.lottoId = lotId1;
                    }
                }
                lc.saveLotto(lot);
                dgv1.Rows[i].DefaultCellStyle.BackColor = Color.DarkKhaki;
            }
            refresh();
        }
示例#2
0
        private void saveLotto()
        {
            Lotto  lot = new Lotto();
            String lotId = "", Cbdl = "";

            //Double amt = 0;
            //if (lotNew)
            //{
            lotId = lot.getGenID();
            Cbdl  = lc.lotdb.selectCDbl();
            //}
            pB1.Visible = true;
            pB1.Minimum = 0;
            pB1.Maximum = dgv1.Rows.Count;
            for (int i = 0; i < dgv1.RowCount; i++)
            {
                if (dgv1[colNumber, i].Value == null)
                {
                    continue;
                }
                if (!dgv1[colEdit, i].Value.ToString().Equals("1"))//Check ว่ามีการแก้ไข หรือเป็นข้อมูลใหม่
                {
                    continue;
                }
                lot = setLotto(i);
                //amt += Double.Parse(lc.cf.NumberNull1(lot.up)) + Double.Parse(lc.cf.NumberNull1(lot.tod))+Double.Parse(lc.cf.NumberNull1(lot.down));

                if (lot.lottoId.Equals(""))
                {
                    if (lotNew)
                    {
                        lot.lottoId = lotId;
                        lot.CDbl    = Cbdl;
                    }
                    else
                    {
                        lot.lottoId = lotId1;
                    }
                }
                lot.lottoId = lc.saveLotto(lot);
                if (StatusCheck)// มาจากหน้าจอ inputImage
                {
                    //lot.numberOld = lot.numberOld;
                    lot.SfCheck1Id = lot.staffId;
                    if (StatusCheck2)
                    {
                        lc.lotdb.updateCheck2(lot);
                    }
                    else
                    {
                        lc.lotdb.updateCheck(lot);
                    }
                }

                dgv1.Rows[i].DefaultCellStyle.BackColor = Color.DarkKhaki;
                pB1.Value = i;
                //lV1.Items[txtIndex.Text].Checked = true;
            }
            if (pic1.Image != null)
            {
                pic1.CancelAsync();
                pic1.Image.Dispose();
                //lc.renameFileImage(lc.initC.pathImage + "\\" + cboYear.Text + "\\" + cboMonth.SelectedValue.ToString() + "\\" + cboPeriod.SelectedValue.ToString() + "\\" + txtImgId.Text);           //580216
                //lc.renameFileImage(lc.initC.pathImage + "\\" + cboYear.Text + "\\" + cboMonth.SelectedValue.ToString() + "\\" + cboPeriod.SelectedValue.ToString() + "\\" + txtImgId.Text.Replace(".lotto", ".thumb"));       //580216
                //ListViewItem i = lV1.SelectedItems[0];
                //txtImgId.Text = name[i.ImageIndex];

                //if (txtImgId.Text.IndexOf("_0") > 0)
                //{
                if (!StatusCheck)// มาจากหน้าจอ inputImage
                {
                    lc.imgdb.UpdateStatusInput(img.Id, sf.Id, sf.Name, lc.cf.getValueCboItem(cboThoo), lbAmt.Text.Replace(",", "").Replace("รวม", "").Replace(":", "").Trim());
                }
                else// มาจากหน้าจอ inputImageCheck
                {
                    if (StatusCheck2)
                    {
                        lc.imgdb.UpdateStatusCheck2(img.Id, sf.Id, lc.cf.getValueCboItem(cboThoo), lbAmt.Text.Replace(",", "").Replace("รวม", "").Replace(":", "").Trim());
                    }
                    else
                    {
                        lc.imgdb.UpdateStatusCheck(img.Id, sf.Id, lc.cf.getValueCboItem(cboThoo), lbAmt.Text.Replace(",", "").Replace("รวม", "").Replace(":", "").Trim());
                    }
                }

                //}
                //else
                //{
                //    lc.imgdb.UpdateStatusInput(img.Id, sf.Id, sf.Name,lc.cf.getValueCboItem(cboThoo));
                //}
                //name[rowImage] = name[rowImage].Replace("_0", "_1");          //580216
            }

            lc.imgdb.UpdateUnLock(img.Id);
            //if (txtIndex.Text.Equals("."))
            //{
            if (lV1.Items.Count > int.Parse(txtIndex.Text))
            {
                //txtIndex.Text = String.Concat(int.Parse(txtIndex.Text) + 1);
                lV1.Items[int.Parse(txtIndex.Text)].Checked = true;
            }
            //}
            pB1.Visible = false;
            refresh();
        }