protected void Btn_Sodor_Click(object sender, EventArgs e) { string Str_Nationacode = TxtNationalcode.Text; if (Lts_Inherited.Tb_CertPays.SingleOrDefault(n => n.xDedId_fk == Tb_Dead2.xDedId_pk) == null) { Tb_CertPay1 = new Tb_CertPay(); Tb_CertPay1.xCrtRegNo = Txt_CrtNo.Text; Tb_CertPay1.xCrtRegDate = Ddl_Year.Text + "/" + Ddl_Mounth.Text + "/" + Ddl_day.Text; Tb_CertPay1.xDedId_fk = Tb_Dead2.xDedId_pk; Lts_Inherited.Tb_CertPays.InsertOnSubmit(Tb_CertPay1); try { Lts_Inherited.SubmitChanges(); Session["Nationalcode"] = Str_Nationacode; Response.Redirect("~/Rpt_Pay.aspx", false); } catch (Exception ex) { Lbl_Msg.Text = "Error!" + ex.ToString(); Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; } } else { Tb_File Tb_File1 = Lts_Inherited.Tb_Files.Where(n => n.xDedId_fk == Tb_Dead2.xDedId_pk).First(); Lbl_Msg.Text = "برای این شخص قبلا گواهی صادر گردیده است!:" + "حوزه:" + Tb_File1.xHozeh + "---" + "کلاسه:" + Tb_File1.xClass; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; } }
protected void Btn_Search_Click(object sender, EventArgs e) { if (TxtNationalcode.Text.Trim() == "") { Lbl_Msg.Text = "کد ملی را وارد کنید!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; return; } Lts_InheritedDataContext Lts_Inherited = new Lts_InheritedDataContext(); Tb_Dead Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedNationalCode == TxtNationalcode.Text.Trim()); if (Tb_Dead1 != null) { Tb_File Tb_Files1 = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xDedId_fk == Tb_Dead1.xDedId_pk); Lbl_Msg.Text = "متوفی در حوزه مالیاتی " + Tb_Files1.xHozeh + " وکلاسه " + Tb_Files1.xClass + "دارای سابقه می باشد" + "!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; } else { Lbl_Msg.Text = "متوفی دارای سابقه نمی باشد" + "!"; Lbl_Msg.ForeColor = System.Drawing.Color.Green; Lbl_Msg.Visible = true; } }
protected void Btn_Search_Click(object sender, EventArgs e) { if (Txt_Klasse.Text.Trim() == "" && !IsPostBack) { return; } if (Txt_Klasse.Text.Trim() == "") { Alarm.ShowMesseage("!کلاسه را وارد کنید", this.Page); Session["Classe"] = null; return; } Lts_Inherited = new Lts_InheritedDataContext(); Tb_File Tb_Files1 = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xHozeh == Txt_Hozeh.Text & n.xClass == Txt_Klasse.Text); if (Tb_Files1 == null) { Alarm.ShowMesseage("!پرونده ای وجود ندارد", this.Page); Session["Classe"] = null; Lbl_DedName.Text = Lbl_DedNationalcode.Text = ""; return; } Session["Classe"] = Txt_Klasse.Text.Trim(); Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedId_pk == Tb_Files1.xDedId_fk); Lbl_DedName.Text = Tb_Dead1.xDedFName + " " + Tb_Dead1.xDedLName; Lbl_DedNationalcode.Text = Tb_Dead1.xDedNationalCode; Btn_Sodor.Enabled = true; }
protected void Btn_Search_Click(object sender, EventArgs e) { if (Txt_Klasse.Text.Trim() == "" && !IsPostBack) { return; } if (Txt_Klasse.Text.Trim() == "") { Alarm.ShowMesseage("!کلاسه را وارد کنید", this.Page); Session["Classe"] = null; return; } Lts_Inherited = new Lts_InheritedDataContext(); Tb_File Tb_Files1 = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xHozeh == Txt_Hozeh.Text & n.xClass == Txt_Klasse.Text); if (Tb_Files1 == null) { Alarm.ShowMesseage("!پرونده ای وجود ندارد", this.Page); Session["Classe"] = null; Lbl_DedName.Text = Lbl_DedNationalcode.Text = ""; Chk_Estates.Items.Clear(); return; } Session["Classe"] = Txt_Klasse.Text.Trim(); Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedId_pk == Tb_Files1.xDedId_fk); Lbl_DedName.Text = Tb_Dead1.xDedFName + " " + Tb_Dead1.xDedLName; Lbl_DedNationalcode.Text = Tb_Dead1.xDedNationalCode; List <Tb_Estate> Lst_Estates = Lts_Inherited.Tb_Estates.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk).ToList(); Chk_Estates.Items.Clear(); foreach (Tb_Estate item in Lst_Estates) { Chk_Estates.Items.Add(new ListItem(item.Tb_EstateType.xEstType + "(" + item.xEstDescription.Substring(0, item.xEstDescription.Length < 10 ? item.xEstDescription.Length : 10) + "..." + ")", item.xEstId_pk.ToString())); } Btn_Sodor.Enabled = true; List <Tb_Inquiry> Lst_Inquiries = Lts_Inherited.Tb_Inquiries.Where(n => n.Tb_InquiryType.xInqType.Contains("اسناد") && n.xDedId_fk == Tb_Dead1.xDedId_pk).ToList(); Gvw_InqAsnad.DataSource = Lst_Inquiries; Gvw_InqAsnad.DataBind(); Gvw_InqAsnad.Visible = true; }
protected void Btn_Search_Click(object sender, EventArgs e) { ResetControls(); if (Txt_Klasse.Text.Trim() == "" && !IsPostBack) { return; } if (Txt_Klasse.Text.Trim() == "") { Alarm.ShowMesseage("کلاسه را وارد کنید ", this.Page); Session["Classe"] = null; return; } Lts_Inherited = new Lts_InheritedDataContext(); try { Tb_File Tb_Files1 = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xHozeh == Txt_Hozeh.Text & n.xClass == Txt_Klasse.Text); if (Tb_Files1 == null) { ResetControls(); Alarm.ShowMesseage("پرونده ای وجود ندارد!", this.Page); Gvw_Estate.Visible = false; Lbl_DedName.Text = Lbl_DedNationalcode.Text = ""; Session["Classe"] = null; return; } Session["Classe"] = Txt_Klasse.Text.Trim(); Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedId_pk == Tb_Files1.xDedId_fk); Lbl_DedName.Text = Tb_Dead1.xDedFName + " " + Tb_Dead1.xDedLName; Lbl_DedNationalcode.Text = Tb_Dead1.xDedNationalCode; Btn_Save.Enabled = true; Lst_Estates = Lts_Inherited.Tb_Estates.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk && n.xEstIsDeleted_ == false).ToList(); Gvw_Estate.DataSource = Lst_Estates; Gvw_Estate.DataBind(); Gvw_Estate.Visible = true; } catch { ResetControls(); Alarm.ShowMesseage("Error", this.Page); } }
protected void Btn_Sodor_Click(object sender, EventArgs e) { if (Txt_Klasse.Text.Trim() == "") { Alarm.ShowMesseage("!کلاسه را وارد کنید", this.Page); return; } if (Chk_Heirs.Items.Count == 0) { Lbl_Msg.Text = "وراث را ثبت نمایید!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; return; } if (Chk_Estates.Items.Count == 0) { Lbl_Msg.Text = "دارایی ها را ثبت نمایید!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; return; } if (Lts_Inherited.Tb_Applies.SingleOrDefault(n => n.Tb_Dead == Tb_Dead1) == null) { Lbl_Msg.Text = "اطلاعات فرم درخواست ثبت نگردیده است!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; return; } bool bol_Flag = false; foreach (ListItem HrsItem in Chk_Heirs.Items) { if (HrsItem.Selected) { foreach (ListItem EstItem in Chk_Estates.Items) { if (EstItem.Selected) { if (Lts_Inherited.Tb_CertPersonPays.SingleOrDefault(n => n.xPrsId_fk == int.Parse(HrsItem.Value) && n.xEstId_fk == int.Parse(EstItem.Value)) != null) { bol_Flag = true; break; } } } } } if (bol_Flag) { Tb_File Tb_File1 = Lts_Inherited.Tb_Files.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk).First(); Lbl_Msg.Text = "گواهی برای اشخاص انتخاب شده با دارایی های انتخابی صادر گردیده است" + "!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; return; } string Str_Nationacode = Tb_Dead1.xDedNationalCode; Tb_CertPay1 = new Tb_CertPay(); Tb_CertPay1.xCrtRegNo = Txt_CrtNo.Text; Tb_CertPay1.xCrtRegDate = Ddl_Year.Text + "/" + Ddl_Mounth.Text + "/" + Ddl_day.Text; Tb_CertPay1.xDedId_fk = Tb_Dead1.xDedId_pk; Tb_CertPay1.xCrtTo = Txt_Nahad.Text.Trim(); Lts_Inherited.Tb_CertPays.InsertOnSubmit(Tb_CertPay1); foreach (ListItem ItemHeir in Chk_Heirs.Items) { if (ItemHeir.Selected) { foreach (ListItem ItemEstate in Chk_Estates.Items) { if (ItemEstate.Selected) { Tb_CertPersonPay Tb_CertPersonPay1 = new Tb_CertPersonPay(); Tb_CertPersonPay1.Tb_CertPay = Tb_CertPay1; Tb_CertPersonPay1.xPrsId_fk = int.Parse(ItemHeir.Value); Tb_CertPersonPay1.xEstId_fk = int.Parse(ItemEstate.Value); Lts_Inherited.Tb_CertPersonPays.InsertOnSubmit(Tb_CertPersonPay1); } } } } try { Lts_Inherited.SubmitChanges(); } catch (Exception ex) { Lbl_Msg.Text = "Error!" + ex.ToString(); Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; return; } Ddl_day.Text = Ddl_Mounth.Text = Txt_CrtNo.Text = ""; foreach (ListItem item in Chk_Estates.Items) { item.Selected = false; } foreach (ListItem item in Chk_Heirs.Items) { item.Selected = false; } Lbl_Msg.Text = "گواهی صادر گردید" + "!"; Lbl_Msg.ForeColor = System.Drawing.Color.Green; Lbl_Msg.Visible = true; List <Tb_CertPay> Lst_Cert = Lts_Inherited.Tb_CertPays.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk).ToList(); Gvw_CertPay.DataSource = Lst_Cert; Gvw_CertPay.DataBind(); Gvw_CertPay.Visible = true; MainTable.Rows[7].Cells[0].Visible = true; }
protected void Btn_Search_Click(object sender, EventArgs e) { if (Txt_Klasse.Text.Trim() == "" && !IsPostBack) { return; } ResetControls(); if (Txt_Klasse.Text.Trim() == "") { Alarm.ShowMesseage("کلاسه را وارد کنید ", this.Page); Session["Classe"] = null; return; } Lts_Inherited = new Lts_InheritedDataContext(); Tb_File Tb_Files1 = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xHozeh == Txt_Hozeh.Text & n.xClass == Txt_Klasse.Text); if (Tb_Files1 == null) { ResetControls(); Lbl_Msg.Text = "پرونده ای وجود ندارد!"; Lbl_Msg.ForeColor = System.Drawing.Color.Red; Lbl_Msg.Visible = true; Session["Classe"] = null; return; } Session["Classe"] = Txt_Klasse.Text.Trim(); Chk_Estates.Items.Clear(); Chk_Heirs.Items.Clear(); Chk_Estates.Enabled = true; Chk_Heirs.Enabled = true; Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedId_pk == Tb_Files1.xDedId_fk); Lbl_DedName.Text = Tb_Dead1.xDedFName + " " + Tb_Dead1.xDedLName; Lbl_DedNationalcode.Text = Tb_Dead1.xDedNationalCode; List <Tb_Heir> Lst_Tb_Heir = Lts_Inherited.Tb_Heirs.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk).ToList(); foreach (Tb_Heir item in Lst_Tb_Heir) { Chk_Heirs.Items.Add(new ListItem(item.Tb_Person.xPrsFName + " " + item.Tb_Person.xPrsLName, item.xPrsId_fk.ToString())); } List <Tb_Estate> Lst_Estates = Lts_Inherited.Tb_Estates.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk && n.xEstIsDeleted_ == false).ToList(); foreach (Tb_Estate item in Lst_Estates) { Chk_Estates.Items.Add(new ListItem(item.Tb_EstateType.xEstType + "(" + item.xEstDescription.Substring(0, item.xEstDescription.Length < 10 ? item.xEstDescription.Length : 10) + "..." + ")", item.xEstId_pk.ToString())); } if (Lst_Tb_Heir.Count == 0) { Chk_Heirs.Items.Add(new ListItem("وراث...", "0")); Chk_Heirs.Enabled = false; } if (Lst_Estates.Count == 0) { Chk_Estates.Items.Add(new ListItem("دارایی...", "0")); Chk_Estates.Enabled = false; } List <Tb_CertPay> Lst_Cert = Lts_Inherited.Tb_CertPays.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk).ToList(); Gvw_CertPay.DataSource = Lst_Cert; Gvw_CertPay.DataBind(); Gvw_CertPay.Visible = true; MainTable.Rows[7].Cells[0].Visible = true; }
protected void Btn_Save_Click(object sender, EventArgs e) { if (Txt_FotDate.Text == "__/__/____") { Alarm1.ShowMesseage("!تاریخ را صحیح وارد نمایید", this.Page); return; } int int_Year = int.Parse(Txt_FotDate.Text.Substring(0, 4)); int int_Mounth = int.Parse(Txt_FotDate.Text.Substring(5, 2)); int int_Day = int.Parse(Txt_FotDate.Text.Substring(8, 2)); if (int_Year < 1300 || int_Year > 1400 || int_Mounth == 00 || int_Mounth > 12 || int_Day == 00 || int_Day > 31) { Alarm1.ShowMesseage("!تاریخ را صحیح وارد نمایید", this.Page); return; } if (Lts_Inherited == null) { Lts_Inherited = new Lts_InheritedDataContext(); } string Str_Msg = ""; if (Hfld_Command.Value == "Save") { string class1 = "0"; Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedNationalCode == TxtNationalcode.Text.Trim() && n.xDedIsDeleted_ == false); if (Tb_Dead1 != null) { Alarm1.ShowMesseage("!مشخصات متوفی قبلا ثبت گردیده است", this.Page); return; } Tb_Dead1 = new Tb_Dead(); Tb_Dead1.xDedFName = Txt_FirstName.Text.Trim(); Tb_Dead1.xDedLName = Txt_LastName.Text.Trim(); Tb_Dead1.xDedFatherName = Txt_FatherName.Text.Trim(); Tb_Dead1.xDedDeadDate = Txt_FotDate.Text.Trim(); //Ddl_FYear.Text.Trim() + "/" + Ddl_FMounth.Text.Trim() + "/" + Ddl_Fday.Text.Trim(); Tb_Dead1.xDedDeadPlace = Txt_DeadPlace.Text.Trim(); Tb_Dead1.xDedIdNo = Txt_IDNo.Text.Trim(); Tb_Dead1.xDedIssuancePlace = Txt_SodoorPlace.Text.Trim(); Tb_Dead1.xDedNationalCode = TxtNationalcode.Text.Trim(); Tb_Dead1.xUserId_fk = Tb_User1.xUserId_pk; Tb_Dead1.xDedRegDate = Class_ShamsiDateTime.MilladiToShamsi(DateTime.Now.Date).ToString(); //Tb_Dead1.xDedCodeHoviat = Txt_CodeHoviati.Text.Trim().Trim(); if (Txt_CodAtba.Text.Trim() != "") { Tb_Dead1.xDedCodeAtba = Txt_CodAtba.Text.Trim(); } if (Rbtn_DSex.SelectedValue == "male") { Tb_Dead1.xDedSex = "male"; } else { Tb_Dead1.xDedSex = "fmale"; } Lts_Inherited.Tb_Deads.InsertOnSubmit(Tb_Dead1); //List<int> Lst_Class = null; Lst_Tb_File = Lts_Inherited.Tb_Files.Where(n => n.xHozeh == Tb_User1.xUser_Hozeh && n.Tb_Dead.xDedIsDeleted_ == false).OrderBy(n => Convert.ToInt32(n.xClass)).ToList(); if (Lst_Tb_File.Count != 0) { class1 = Lst_Tb_File.LastOrDefault().xClass; } Tb_File1 = new Tb_File(); Tb_File1.xClass = (int.Parse(class1) + 1).ToString(); Tb_File1.Tb_Dead = Tb_Dead1; Tb_File1.xHozeh = Txt_Hozeh.Text; Lts_Inherited.Tb_Files.InsertOnSubmit(Tb_File1); Str_Msg = "!عملیات ذخیره با موفقیت انجام شد"; Txt_Klasse.Text = (class1 + 1).ToString(); Session["Classe"] = Txt_Klasse.Text.Trim(); } else if (Hfld_Command.Value == "Edit") { if (Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedNationalCode == TxtNationalcode.Text.Trim()) != null && Tb_Dead1.xDedNationalCode != TxtNationalcode.Text.Trim()) { Alarm1.ShowMesseage("!مشخصات متوفی قبلا ثبت گردیده است", this.Page); return; } Tb_Dead1.xDedFName = Txt_FirstName.Text.Trim(); Tb_Dead1.xDedLName = Txt_LastName.Text.Trim(); Tb_Dead1.xDedFatherName = Txt_FatherName.Text.Trim(); Tb_Dead1.xDedDeadDate = Txt_FotDate.Text.Trim(); //Ddl_FYear.Text.Trim() + "/" + Ddl_FMounth.Text.Trim() + "/" + Ddl_Fday.Text.Trim(); Tb_Dead1.xDedDeadPlace = Txt_DeadPlace.Text.Trim(); Tb_Dead1.xDedIdNo = Txt_IDNo.Text.Trim(); Tb_Dead1.xDedIssuancePlace = Txt_SodoorPlace.Text.Trim(); Tb_Dead1.xDedNationalCode = TxtNationalcode.Text.Trim(); Tb_Dead1.xUserId_fk = Tb_User1.xUserId_pk; Tb_Dead1.xDedRegDate = Class_ShamsiDateTime.MilladiToShamsi(DateTime.Now.Date).ToString(); if (Rbtn_DSex.SelectedIndex == 0) { Tb_Dead1.xDedSex = "male"; } else { Tb_Dead1.xDedSex = "fmale"; } Str_Msg = "!عملیات ویرایش با موفقیت انجام شد"; } try { Lts_Inherited.SubmitChanges(); Alarm1.ShowMesseage(Str_Msg, this.Page); GetDead(Tb_Dead1.xDedId_pk); ResetControls(); } catch { Alarm1.ShowMesseage("!خطا", this.Page); } }