protected void BtnConfirm_Click(object sender, EventArgs e) { if (RBLYesOrNo.SelectedIndex == 0)// so the rest is paid { DateTime Return_Date = new DateTime(Convert.ToInt32(txtYear.Text), Convert.ToInt32(txtMonth.Text), Convert.ToInt32(txtDay.Text) , DateTime.Now.Hour, DateTime.Now.Minute + 2, DateTime.Now.Second); string category = "دفع مرتجع"; double Paid_amount = Convert.ToDouble(ViewState["Paid_amount"]); string Notes = "دفع مرتجع للعميل : " + lblClientName.Text, m; Expenses_Class exp = new Expenses_Class(); exp.Pay_Date = Return_Date; exp.Category = category; exp.Paid_Value = -Paid_amount; exp.Notes = Notes; if (!exp.Add_Expenses(out m, Convert.ToInt64(lblBill_ID.Text))) { lblConfirm.Text = m; lblConfirm.ForeColor = System.Drawing.Color.Red; } else { lblConfirm.Text = "تم بنجاح"; lblConfirm.ForeColor = System.Drawing.Color.Green; } } else if (RBLYesOrNo.SelectedIndex == 1) { lblConfirm.Text = "تم بنجاح"; lblConfirm.ForeColor = System.Drawing.Color.Green; } else { lblConfirm.Text = "يجب اختيار نعم او لا"; lblConfirm.ForeColor = System.Drawing.Color.Red; } }
protected void BtnFinish_Click(object sender, EventArgs e) { if (ddlCategory.SelectedValue == "دفع مرتجع" && PanelBill_ID.Visible == false) { PanelBill_ID.Visible = true; SetFocus(txtBillID); } else { long Bill_ID = 0; if (PanelBill_ID.Visible) { Bill_ID = Convert.ToInt64(txtBillID.Text); } #region Add expenses Expenses_Class exp = new Expenses_Class(); exp.Pay_Date = new DateTime(Convert.ToInt32(txtYear.Text), Convert.ToInt32(txtMonth.Text), Convert.ToInt32(txtDay.Text) , DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); exp.Category = ddlCategory.SelectedValue; exp.Paid_Value = Convert.ToDouble(txtPaid_amount.Text); exp.Notes = TxtNotes.Text; string m; if (!exp.Add_Expenses(out m, Bill_ID)) { lblFinishMsg.Text = m; lblFinishMsg.ForeColor = System.Drawing.Color.Red; } else { lblFinishMsg.Text = "تم بنجاح"; lblFinishMsg.ForeColor = System.Drawing.Color.Green; } SetFocus(BtnFinish); #endregion } }