private void Grid_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { if (e.RowIndex != -1) { if (e.ColumnIndex == 3 || e.ColumnIndex == 4 || e.ColumnIndex == 5) { Form_Payment P = new Form_Payment(Listpeyment.SingleOrDefault(p => p.Id == Convert.ToInt32(Grid.Rows[e.RowIndex].Cells["Id"].Value))); P.ShowDialog(); BGW.RunWorkerAsync(); } } }
private void Grid_Payments_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { if (DialogResult.Yes == MessageBox.Show("آیا میخواهید اطلاعات این پرداخت را ویرایش کنید ؟", "سوال", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Form_Payment P = new Form_Payment(ListPayments.SingleOrDefault(p => p.Id == Convert.ToInt32(Grid_Payments.Rows[e.RowIndex].Cells["ID"].Value))); P.ShowDialog(); GetData(); List<Payment> list = Search(); BuildGrid(list); } } }
private void Btn_Next_Click(object sender, EventArgs e) { if (Radio_Diffrent.Checked) { if (D2.SelectedIndex != -1) { int id = Convert.ToInt32(D2.SelectedValue); Form_Payment fp = new Form_Payment(ListProject.SingleOrDefault(p => p.ProjectID == id)); fp.ShowDialog(); } else { Form_Payment fp = new Form_Payment(); fp.ShowDialog(); } } if (Radio_Factor.Checked) { if (F2.SelectedIndex != -1) { int id = Convert.ToInt32(F2.SelectedValue); if (!db.Payments.Any(p => p.FactorID == id)) { Form_Payment fp = new Form_Payment(Listfactor.SingleOrDefault(p => p.FactorID == id)); fp.ShowDialog(); } } } if (Radio_ListP.Checked) { if (P2.SelectedIndex != -1) { int id = Convert.ToInt32(P2.SelectedValue); Form_Payment fp = new Form_Payment(ListPurchase.SingleOrDefault(p => p.PurchaseListID == id)); fp.ShowDialog(); } } }
/// <summary> /// ثبت یک فاکتور /// </summary> /// <returns></returns> private bool RegisterFactor() { //try //{ _NewID = Convert.ToInt32(DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString()); string VAXPrice; if (ChekVAX.Checked == true) { VAXPrice = txtVAX.Text.Trim(); } else { VAXPrice = "0"; } string Des = "ندارد"; if (txtDescription.Text != "") { Des = txtDescription.Text; } DateTime DD = Convert.ToDateTime(Datepicker.GeoDate); DateTime D = new DateTime(DD.Year, DD.Month, DD.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0); Factor NewFactor = new Factor() { FactorID = _NewID, FactorNumber = txtFactorNumber.Text.ToString().Trim(), Date = D, TotalPrice = utility.ConvertCommaPrice(txtTotalCost.Text), VAX = _VAX, VAXPrice = utility.ConvertCommaPrice(VAXPrice), Description = Des, }; int projeID = Convert.ToInt32(ComboProject.SelectedValue); NewFactor.Project = db.Projects.First(p => p.ProjectID == projeID); if (state == 2) NewFactor.PurchaseListID = _Purchase.PurchaseListID; db.Factors.Add(NewFactor); db.SaveChanges(); if (MessageBox.Show("آیا میخواهید اطلاعات این پرداخت ثبت شود؟", "سوال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Form_Payment FP = new Form_Payment(NewFactor); FP.ShowDialog(); } if (!RegisterFactorItems()) { db.Factors.Remove(NewFactor); utility.Show_Message("ثبت فاکتور انجام نشد", "خطا"); return false; } return true; //} //catch (DbUpdateException ex) //{ // MessageBox.Show(SqlServerErrorManagment.ShowError(ex, "فاکتور"), "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Error); // return false; //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message, "هشدار", MessageBoxButtons.OK, MessageBoxIcon.Error); // return false; //} }
private void RegCredit() { //try //{ Credit C = new Credit() { Type = "+", Price = utility.ConvertCommaPrice(Txt_Price.Text.Trim()), DateCredit = Date.GeoDate.Value, CreditID = utility.CreatedNewID(), Description = Txt_Description.Text.Trim() }; C.TankhahID = Convert.ToInt32(Combo_Tankhah.SelectedValue); db.Credits.Add(C); db.SaveChanges(); int ID = Convert.ToInt32(Combo_Tankhah.SelectedValue); db.Tankhahs.Single(p => p.TankhahID == ID).CreditCurrent += utility.ConvertCommaPrice(Txt_Price.Text.Trim()); db.SaveChanges(); utility.Show_Message(" این اعتبار با موفقیت ثبت شد", "ثبت"); FormDefult(); if (MessageBox.Show("آیا میخواهید اطلاعات این پرداخت ثبت شود؟", "سوال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Form_Payment FP = new Form_Payment(C); FP.ShowDialog(); } //} //catch (DbUpdateException ex) //{ // MessageBox.Show(SqlServerErrorManagment.ShowError(ex, "تنخواه"), "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message, "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); //} }
private void button5_Click(object sender, EventArgs e) { Form_Payment formPayment = new Form_Payment(person.EmployeeID); formPayment.ShowDialog(); GetData(); ShowDatainCombo(); }
/// <summary> /// ایونت ثثثثثثثثبت /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRegister_Click(object sender, EventArgs e) { if (State == States.Normal || State == States.WithTankhah) { if (CheckError(GridCostOfService) && CheckError(GridItem)) { InsertCredit(); InsertPList(); InsertItems(); InsertCostOfServices(); AssignFactors(); db.SaveChanges(); utility.Show_Message("عملیات ثبت با موفقیت انجام شد", "پیغام عملیات"); FormDefaults(); if (FactorList.Count != 0) { FactorList.Clear(); } _TotalPrice = 0; txtTotalPrice.Text = "0"; } if (MessageBox.Show("آیا میخواهید اطلاعات این پرداخت ثبت شود؟", "سوال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Form_Payment FP = new Form_Payment(newPList); FP.ShowDialog(); } } else { if (CheckError(GridCostOfService) && CheckError(GridItem)) { NewPListPrice = utility.ConvertCommaPrice(txtTotalPrice.Text.Trim()); DeleteItems(); DeleteCOSs(); UpdateFactorPrices(); InsertItems(); InsertCostOfServices(); UpdatePList(); AssignFactors(); db.SaveChanges(); utility.Show_Message("عملیات ویرایش با موفقیت انجام شد", "پیغام عملیات"); close = true; this.Close(); } } }