public void Insert(int?ClassID, int?ParentID, int?StatusID, string CountNumber, string Weight, string Price, string FeeRate, string InterestRate, string DiscountPercent, string Description, string Remark, string StartDate, string EndDate, string PhotoPath) { DDPawnageInfo item = new DDPawnageInfo(); item.ClassID = ClassID; item.ParentID = ParentID; item.StatusID = StatusID; item.CountNumber = CountNumber; item.Weight = Weight; item.Price = Price; item.FeeRate = FeeRate; item.InterestRate = InterestRate; item.DiscountPercent = DiscountPercent; item.Description = Description; item.Remark = Remark; item.StartDate = StartDate; item.EndDate = EndDate; item.PhotoPath = PhotoPath; item.Save(UserName); }
private void UpdateOperation(int iTicketID) { try { Query query = new Query(DDOperation.Schema); query.AddWhere("TicketID", iTicketID); query.AddWhere("OperationType", Comparison.In, new int[] { 1, 3 }); query.AddWhere("NextOperationID", 0); query.AddWhere("OperationType", Comparison.NotEquals, 6); DataTable dt = query.ExecuteDataSet().Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { DDOperation oldOperation = new DDOperation("OperationID", Convert.ToInt32(dt.Rows[i]["OperationID"].ToString())); DDOperation newOperation = new DDOperation(); int dataGridRow = 0; for (int j = 0; j < dataGridView1.Rows.Count; j++) { if (dataGridView1.Rows[j].Cells["PawnageID"].Value.ToString() == oldOperation.PawnageID.ToString()) { dataGridRow = j; } } newOperation.TicketID = m_TicketID; newOperation.PawnageID = Convert.ToInt32(dataGridView1.Rows[dataGridRow].Cells["PawnageID"].Value.ToString()); newOperation.OperationType = 2; newOperation.OperationNumber = m_OperationNumber; newOperation.ServiceFee = "0"; newOperation.InterestFee = (Convert.ToDouble(dataGridView1.Rows[dataGridRow].Cells["PaidInterestFee"].Value.ToString()) - Convert.ToDouble(dataGridView1.Rows[dataGridRow].Cells["ReturnInterestFee"].Value.ToString())).ToString(); newOperation.ReturnFee = dataGridView1.Rows[dataGridRow].Cells["ReturnFee"].Value.ToString(); newOperation.OverdueFee = dataGridView1.Rows[dataGridRow].Cells["OverdueFee"].Value.ToString(); newOperation.Amount = dataGridView1.Rows[dataGridRow].Cells["Amount"].Value.ToString(); newOperation.ReckonAmount = "0"; newOperation.ServiceFeeRate = dataGridView1.Rows[dataGridRow].Cells["ServiceFeeRate"].Value.ToString(); newOperation.InterestFeeRate = dataGridView1.Rows[dataGridRow].Cells["InterestFeeRate"].Value.ToString(); newOperation.OperationDate = tbxOperationDate.Text; DDUser newUser = new DDUser("AccountName", MainForm.AccountName); newOperation.OperaterName = newUser.UserName; newOperation.PreOperationID = oldOperation.OperationID; newOperation.NextOperationID = 0; newOperation.Save(); oldOperation.NextOperationID = newOperation.OperationID; oldOperation.Save(); DDPawnageInfo newInfo = new DDPawnageInfo("PawnageID", Convert.ToInt32(dataGridView1.Rows[dataGridRow].Cells["PawnageID"].Value.ToString())); newInfo.StatusID = 2; //赎当 newInfo.Save(); } } catch (Exception ex) { throw ex; } }
private void UpdateOperation() { try { if (dataGridView1.Rows.Count > 0) { DateTime operateDate = DateTime.Now; string strDate = operateDate.Year.ToString() + "-" + operateDate.Month.ToString() + "-" + operateDate.Day.ToString(); int iPawnageID = 0; int preOperationID = 0; for (int i = dataGridView1.Rows.Count - 1; i > -1; i--) { DataGridViewRow dgr = dataGridView1.Rows[i]; iPawnageID = Convert.ToInt32(dgr.Cells["PawnageID"].Value); preOperationID = Convert.ToInt32(dgr.Cells["OperationID"].Value); DDOperation newOperation = new DDOperation(); newOperation.TicketID = m_TicketID; newOperation.PawnageID = iPawnageID; newOperation.OperationType = 7; //7:清算 newOperation.OperationNumber = m_OperationNumber; newOperation.ServiceFee = "0"; newOperation.InterestFee = "0"; newOperation.ReturnFee = "0"; newOperation.OverdueFee = "0"; newOperation.Amount = dgr.Cells["Amount"].Value.ToString(); newOperation.ReckonAmount = dgr.Cells["ReckonAmount"].Value.ToString(); newOperation.OperationDate = strDate; newOperation.OperaterName = MainForm.AccountName; newOperation.PreOperationID = preOperationID; newOperation.NextOperationID = 0; newOperation.Deleted = 0; newOperation.Save(); DDOperation oldOperation = new DDOperation("OperationID", preOperationID); oldOperation.NextOperationID = newOperation.OperationID; oldOperation.Save(); DDPawnageInfo newInfo = new DDPawnageInfo("PawnageID", iPawnageID); newInfo.StatusID = 7; newInfo.Save(); } DDPawnTicket newTicket = new DDPawnTicket("TicketID", m_TicketID); newTicket.StatusID = 7; //7:清算 newTicket.Save(); } } catch (Exception ex) { throw ex; } }
private void UpdatePawages(int intTicketID) { if (dataGridView1.Rows.Count > 0) { double serviceFee = 0; double interestFee = 0; for (int i = dataGridView1.Rows.Count - 1; i > -1; i--) { DataGridViewRow dgr = dataGridView1.Rows[i]; try { DDPawnageInfo newInfo = new DDPawnageInfo(); newInfo.ClassID = Convert.ToInt32(dgr.Cells["ChildClassID"].Value); newInfo.ParentID = Convert.ToInt32(dgr.Cells["ParentClassID"].Value); newInfo.StatusID = 3; newInfo.CountNumber = dgr.Cells["CountNumber"].Value.ToString(); newInfo.Weight = dgr.Cells["Weight"].Value.ToString(); newInfo.DiscountPercent = dgr.Cells["DiscountPercent"].Value.ToString(); newInfo.Amount = dgr.Cells["Amount"].Value.ToString(); newInfo.ReckonAmount = "0"; serviceFee = Convert.ToDouble(dgr.Cells["Amount"].Value) * Convert.ToInt32(this.tbxPawnTerm.Text) * Convert.ToDouble(dgr.Cells["FeeRate"].Value) / 100; newInfo.ServiceFee = serviceFee.ToString(); interestFee = Convert.ToDouble(dgr.Cells["Amount"].Value) * Convert.ToInt32(this.tbxPawnTerm.Text) * Convert.ToDouble(dgr.Cells["InterestRate"].Value) / 100; newInfo.InterestFee = interestFee.ToString(); newInfo.ReturnFee = "0"; newInfo.OverdueFee = "0"; newInfo.Description = dgr.Cells["Description"].Value.ToString(); newInfo.IsReif = 0; newInfo.StartDate = this.tbxStartDate.Text; newInfo.EndDate = this.tbxEndDate.Text; newInfo.OperationDate = this.tbxStartDate.Text; newInfo.Remark = this.tbxRemark.Text; newInfo.Save(); DDTicketPawnage newTicketPawnage = new DDTicketPawnage(); newTicketPawnage.TicketID = intTicketID; newTicketPawnage.PawnageID = newInfo.PawnageID; newTicketPawnage.Save(); } catch { MessageBox.Show(this, "数据更新失败,请检查数据库是否连接正确!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void UpdateOperation() { try { DataGridViewRow dgr = dataGridView1.CurrentRow; int intStatusID = Convert.ToInt32(dgr.Cells["StatusID"].Value); if (intStatusID != 6) { int iTicketID = Convert.ToInt32(dgr.Cells["TicketID"].Value); DDPawnTicket newTicket = new DDPawnTicket("TicketID", iTicketID); Query queryOperations = new Query(DDOperation.Schema); queryOperations.AddWhere("TicketID", iTicketID); //queryOperations.AddWhere("OperationType", 1); queryOperations.AddWhere("NextOperationID", 0); DataTable dtOperations = queryOperations.ExecuteDataSet().Tables[0]; if (dtOperations.Rows.Count > 0) { newTicket.StatusID = 5; newTicket.Save(); DateTime operateDate = DateTime.Now; string strDate = operateDate.Year.ToString() + "-" + operateDate.Month.ToString() + "-" + operateDate.Day.ToString(); int preOperationID = 0; for (int i = 0; i < dtOperations.Rows.Count; i++) { DDOperation newOperation = new DDOperation(); preOperationID = Convert.ToInt32(dtOperations.Rows[i]["OperationID"]); newOperation.TicketID = iTicketID; newOperation.PawnageID = Convert.ToInt32(dtOperations.Rows[i]["PawnageID"]); newOperation.OperationType = 5; //5 :冻结 newOperation.OperationNumber = m_OperationNumber; newOperation.ServiceFee = "0"; newOperation.InterestFee = "0"; newOperation.ReturnFee = "0"; newOperation.OverdueFee = "0"; newOperation.Amount = dtOperations.Rows[i]["Amount"].ToString(); newOperation.ReckonAmount = "0"; newOperation.OperationDate = strDate; newOperation.OperaterName = MainForm.AccountName; newOperation.PreOperationID = preOperationID; newOperation.NextOperationID = 0; newOperation.Deleted = 0; newOperation.Save(); DDOperation oldOperation = new DDOperation("OperationID", preOperationID); oldOperation.NextOperationID = newOperation.OperationID; oldOperation.Save(); //更新当品信息 DDPawnageInfo newInfo = new DDPawnageInfo("PawnageID", Convert.ToInt32(dtOperations.Rows[i]["PawnageID"])); newInfo.StatusID = 5; newInfo.Save(); } InitGridSource(); dataGridView1.DataSource = m_GridTable; MessageBox.Show("冻结处理成功!", "冻结"); } } else { MessageBox.Show("该当票不能进行冻结操作!", "冻结"); } } catch (Exception ex) { throw ex; } }
private void UpdateOperation() { try { DataGridViewRow dgr = dataGridView1.CurrentRow; int intStatusID = Convert.ToInt32(dgr.Cells["StatusID"].Value); if (intStatusID == 1 || intStatusID == 3) { int iTicketID = Convert.ToInt32(dgr.Cells["TicketID"].Value); DDPawnTicket newTicket = new DDPawnTicket("TicketID", iTicketID); Query queryOperations = new Query(DDOperation.Schema); queryOperations.AddWhere("TicketID", iTicketID); queryOperations.AddWhere("NextOperationID", 0); queryOperations.AddWhere("OperationType", Comparison.NotEquals, 6); DataTable dtOperations = queryOperations.ExecuteDataSet().Tables[0]; if (dtOperations.Rows.Count > 0) { newTicket.StatusID = 4; newTicket.Save(); int preOperationID = 0; for (int i = 0; i < dtOperations.Rows.Count; i++) { DDOperation newOperation = new DDOperation(); preOperationID = Convert.ToInt32(dtOperations.Rows[i]["OperationID"]); newOperation.TicketID = iTicketID; newOperation.PawnageID = Convert.ToInt32(dtOperations.Rows[i]["PawnageID"]); newOperation.OperationType = 4; //4 :绝当 newOperation.OperationNumber = m_OperationNumber; newOperation.ServiceFee = "0"; newOperation.InterestFee = "0"; newOperation.ReturnFee = "0"; newOperation.OverdueFee = "0"; newOperation.Amount = dtOperations.Rows[i]["Amount"].ToString(); newOperation.ReckonAmount = "0"; newOperation.OperationDate = dgr.Cells["OperationDate"].Value.ToString(); newOperation.OperaterName = MainForm.AccountName; newOperation.PreOperationID = preOperationID; newOperation.NextOperationID = 0; newOperation.Deleted = 0; newOperation.Save(); DDOperation oldOperation = new DDOperation("OperationID", preOperationID); oldOperation.NextOperationID = newOperation.OperationID; oldOperation.Save(); //更新当品信息与当票信息 DDPawnageInfo newPawn = new DDPawnageInfo("PawnageID", dtOperations.Rows[i]["PawnageID"]); newPawn.StatusID = 4; //绝当 newPawn.Save(); } InitGridSource(); dataGridView1.DataSource = m_GridTable; MessageBox.Show("绝当处理成功!", "绝当"); } } else { MessageBox.Show("该当票不能进行绝当操作!", "绝当"); } } catch (Exception ex) { throw ex; } }
private void UpdateOperation() { try { if (dataGridView1.Rows.Count > 0) { DDPawnTicket newTicket = new DDPawnTicket("TicketID", m_TicketID); newTicket.StatusID = 3; //3:续当 newTicket.EndDate = this.tbxEndDate.Text; newTicket.Save(); int iPawnageID = 0; int preOperationID = 0; for (int i = dataGridView1.Rows.Count - 1; i > -1; i--) { DataGridViewRow dgr = dataGridView1.Rows[i]; iPawnageID = Convert.ToInt32(dgr.Cells["PawnageID"].Value); DDPawnageInfo newInfo = new DDPawnageInfo("PawnageID", iPawnageID); preOperationID = Convert.ToInt32(dgr.Cells["OperationID"].Value); DDOperation newOperation = new DDOperation(); newOperation.TicketID = m_TicketID; newOperation.PawnageID = iPawnageID; newOperation.OperationType = 3; //3 :续当 newOperation.OperationNumber = m_OperationNumber; newOperation.ServiceFee = dataGridView1.Rows[i].Cells["ServiceFee"].Value.ToString(); newOperation.InterestFee = dataGridView1.Rows[i].Cells["InterestFee"].Value.ToString(); newOperation.ReturnFee = "0"; newOperation.OverdueFee = "0"; newOperation.Amount = dgr.Cells["Amount"].Value.ToString(); newOperation.ReckonAmount = "0"; newOperation.OperationDate = this.tbxOperationDate.Text; newOperation.StartDate = this.tbxStartDate.Text; newOperation.EndDate = this.tbxEndDate.Text; DDUser newOperater = new DDUser("AccountName", MainForm.AccountName); newOperation.OperaterName = newOperater.UserName; newOperation.PreOperationID = preOperationID; newOperation.ServiceFeeRate = dgr.Cells["FeeRate"].Value.ToString(); newOperation.InterestFeeRate = dgr.Cells["InterestRate"].Value.ToString(); newOperation.NextOperationID = 0; newOperation.Deleted = 0; newOperation.Save(); DDOperation oldOperation = new DDOperation("OperationID", preOperationID); oldOperation.NextOperationID = newOperation.OperationID; oldOperation.Save(); newInfo.FeeRate = dgr.Cells["FeeRate"].Value.ToString(); newInfo.InterestRate = dgr.Cells["InterestRate"].Value.ToString(); newInfo.EndDate = this.tbxEndDate.Text; newInfo.StatusID = 3; //续当 newInfo.Save(); } } } catch (Exception ex) { throw ex; } }
private void UpdatePawages(int ticketID) { if (tbxCount1.Text != "0") { try { DDPawnageInfo newInfo = new DDPawnageInfo(); newInfo.ClassID = Convert.ToInt32(this.cbxChildClass1.SelectedValue); newInfo.ParentID = Convert.ToInt32(this.cbxParentClass1.SelectedValue); newInfo.CountNumber = this.tbxCount1.Text; newInfo.Price = this.tbxPrice1.Text; newInfo.DiscountPercent = this.tbxPercent1.Text; newInfo.Amount = this.tbxPawnageAmount1.Text; newInfo.Description = this.tbxDescr1.Text; newInfo.TicketID = ticketID; newInfo.IsReif = 0; newInfo.Save(); } catch { MessageBox.Show("当品添加失败,请检查数据库连接状态!"); } } if (tbxCount2.Text != "0") { try { DDPawnageInfo newInfo = new DDPawnageInfo(); newInfo.ClassID = Convert.ToInt32(this.cbxChildClass2.SelectedValue); newInfo.ParentID = Convert.ToInt32(this.cbxParentClass2.SelectedValue); newInfo.CountNumber = this.tbxCount2.Text; newInfo.Price = this.tbxPrice2.Text; newInfo.DiscountPercent = this.tbxPercent2.Text; newInfo.Amount = this.tbxPawnageAmount2.Text; newInfo.Description = this.tbxDescr2.Text; newInfo.TicketID = ticketID; newInfo.IsReif = 0; newInfo.Save(); } catch { MessageBox.Show("当品添加失败,请检查数据库连接状态!"); } } if (tbxCount3.Text != "0") { try { DDPawnageInfo newInfo = new DDPawnageInfo(); newInfo.ClassID = Convert.ToInt32(this.cbxChildClass3.SelectedValue); newInfo.ParentID = Convert.ToInt32(this.cbxParentClass3.SelectedValue); newInfo.CountNumber = this.tbxCount3.Text; newInfo.Price = this.tbxPrice3.Text; newInfo.DiscountPercent = this.tbxPercent3.Text; newInfo.Amount = this.tbxPawnageAmount3.Text; newInfo.Description = this.tbxDescr3.Text; newInfo.TicketID = ticketID; newInfo.IsReif = 0; newInfo.Save(); } catch { MessageBox.Show("当品添加失败,请检查数据库连接状态!"); } } }
private void DeleteOperation() { DataGridViewRow dgr = dataGridView1.CurrentRow; int intTicketID = Convert.ToInt32(dgr.Cells["TicketID"].Value); DDPawnTicket newTicket = new DDPawnTicket("TicketID", intTicketID); Query query = new Query(DDOperation.Schema); query.AddWhere("TicketID", intTicketID); query.AddWhere("NextOperationID", 0); DataTable dt = query.ExecuteDataSet().Tables[0]; if (dt.Rows.Count > 0) { DateTime operateDate = DateTime.Now; string strDate = operateDate.Year.ToString() + "-" + operateDate.Month.ToString() + "-" + operateDate.Day.ToString(); //DDOperation newOperation = new DDOperation(); //newOperation.TicketID = operation.TicketID; //newOperation.PawnageID = operation.PawnageID; //newOperation.OperationType = 6; //newOperation.OperationNumber = operation.OperationNumber; //newOperation.OperationDate = strDate; //newOperation.OperaterName = MainForm.AccountName; //newOperation.PreOperationID = operation.OperationID; //newOperation.NextOperationID = 0; //newOperation.Save(); for (int i = 0; i < dt.Rows.Count; i++) { DDPawnageInfo newInfo = new DDPawnageInfo("PawnageID", Convert.ToInt32(dt.Rows[i]["PawnageID"])); DDOperation newOperation = new DDOperation("OperationID", Convert.ToInt32(dt.Rows[i]["OperationID"])); if (newOperation.PreOperationID != 0) { DDOperation preOperation = new DDOperation("OperationID", newOperation.PreOperationID); preOperation.NextOperationID = 0; preOperation.Save(); newTicket.StatusID = preOperation.OperationType; newInfo.StatusID = preOperation.OperationType; if (newOperation.OperationType == 3) { newTicket.EndDate = preOperation.EndDate; } } else { newTicket.StatusID = 6; newInfo.StatusID = 6; } newOperation.OperationType = 6;//6:删除 newOperation.NextOperationID = -1; newOperation.OperationDate = strDate; newOperation.Deleted = 1; newOperation.Save(); newInfo.Save(); } } newTicket.Save(); InitGridSource(); dataGridView1.DataSource = m_GridTable; SetForGridViewPage(); MessageBox.Show("删除成功!", "删除"); }
private void UpdateOperation() { if (dataGridView1.Rows.Count > 0) { DDPawnTicket newTicket = new DDPawnTicket("TicketID", m_TicketID); newTicket.StatusID = 3; //3:续当 newTicket.EndDate = this.tbxEndDate.Text; newTicket.Save(); int iPawnageID = 0; int preOperationID = 0; PawnSpan Span = new PawnSpan(); Span = DianDangFunction.GetPawnSpan(DateTime.Parse(tbxStartDate.Text), DateTime.Parse(tbxEndDate.Text)); for (int i = dataGridView1.Rows.Count - 1; i > -1; i--) { DataGridViewRow dgr = dataGridView1.Rows[i]; try { iPawnageID = Convert.ToInt32(dgr.Cells["PawnageID"].Value); DDPawnageInfo newInfo = new DDPawnageInfo("PawnageID", iPawnageID); preOperationID = Convert.ToInt32(dgr.Cells["OperationID"].Value); DDOperation newOperation = new DDOperation(); newOperation.TicketID = m_TicketID; newOperation.PawnageID = iPawnageID; newOperation.OperationType = 3; //3 :续当 newOperation.OperationNumber = m_OperationNumber; newOperation.ServiceFee = dataGridView1.Rows[i].Cells["ServiceFee"].Value.ToString(); newOperation.InterestFee = dataGridView1.Rows[i].Cells["InterestFee"].Value.ToString(); newOperation.ReturnFee = "0"; newOperation.OverdueFee = "0"; newOperation.Amount = dgr.Cells["Amount"].Value.ToString(); newOperation.ReckonAmount = "0"; newOperation.OperationDate = this.tbxOperationDate.Text; newOperation.StartDate = this.tbxStartDate.Text; newOperation.EndDate = this.tbxEndDate.Text; DDUser newOperater = new DDUser("AccountName", MainForm.AccountName); newOperation.OperaterName = newOperater.UserName; newOperation.PreOperationID = preOperationID; newOperation.ServiceFeeRate = dgr.Cells["FeeRate"].Value.ToString(); newOperation.InterestFeeRate = dgr.Cells["InterestRate"].Value.ToString(); newOperation.NextOperationID = 0; newOperation.Deleted = 0; newOperation.Save(); DDOperation oldOperation = new DDOperation("OperationID", preOperationID); oldOperation.NextOperationID = newOperation.OperationID; oldOperation.Save(); newInfo.FeeRate = dgr.Cells["FeeRate"].Value.ToString(); newInfo.InterestRate = dgr.Cells["InterestRate"].Value.ToString(); newInfo.EndDate = this.tbxEndDate.Text; newInfo.StatusID = 3; //续当 newInfo.Save(); } catch { MessageBox.Show(this, "续当操作失败,请检查数据库是否连接正确!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }