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(); }
private void saveLotto() { Lotto lot = new Lotto(); String lotId = "", Cbdl = ""; //if (lotNew) //{ lotId = lot.getGenID(); Cbdl = lc.lotdb.selectCDbl(); //} pB1.Visible = true; pB1.Minimum = 0; pB1.Maximum = dgv1.Rows.Count; if (!chkMoveAll.Checked && !chkMoveImage.Checked && !chkVoidImage.Checked) { MessageBox.Show("กรุณาเลือกรายการ ย้าย", ""); return; } if (chkVoidImage.Checked) { if (MessageBox.Show("ต้องการยกเลิก", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { if (lc.imgdb.VoidImage(img.Id, sf.Id).Equals("1")) { lc.lotdb.VoidImage(img.Id, sf.Id); MessageBox.Show("ยกเลิก เรียบร้อย", ""); } } } else if (chkMoveAll.Checked) { if (MessageBox.Show("ต้องการย้ายรูป และข้อมูล", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { if (lc.imgdb.UpdateSale(img.Id, lc.cf.getValueCboItem(cboSaleNew)).Equals("1")) { lc.lotdb.UpdateSaleFromImage(img.Id, lc.cf.getValueCboItem(cboSaleNew), sf.Id); MessageBox.Show("ย้ายรูป และข้อมูล เรียบร้อย", ""); } } } else if (chkMoveImage.Checked) { if (MessageBox.Show("ต้องการย้ายแต่รูป และยกเลิกข้อมูล", "", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { if (lc.imgdb.UpdateSale(img.Id, lc.cf.getValueCboItem(cboSaleNew)).Equals("1")) { lc.lotdb.VoidImage(img.Id, sf.Id); MessageBox.Show("ยกเลิก เรียบร้อย", ""); } } } pB1.Visible = false; refresh(); }
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(); }