Esempio n. 1
0
        protected void Btn_Sodor_Click(object sender, EventArgs e)
        {
            if (Lts_Inherited.Tb_Inquiries.SingleOrDefault(n => n.Tb_InquiryType.xInqType.Contains("بانک") && n.xDedId_fk == Tb_Dead1.xDedId_pk) != null)
            {
                Lbl_Msg.Text      = "!استعلام صادر گردیده است";
                Lbl_Msg.Visible   = true;
                Lbl_Msg.ForeColor = System.Drawing.Color.Red;
                return;
            }
            Tb_InquiryType Tb_InquiryType1 = Lts_Inherited.Tb_InquiryTypes.SingleOrDefault(n => n.xInqType.Contains("بانک"));

            Tb_Inquiry Tb_Inquiry1 = new Tb_Inquiry();

            Tb_Inquiry1.Tb_Dead = Tb_Dead1;
            //Tb_Inquiry1.xInqDate = Class_ShamsiDateTime.MilladiToShamsi(DateTime.Now.Date).ToString();
            Tb_Inquiry1.xInqDate       = Tdp_InqDate.Date;
            Tb_Inquiry1.xInqRegNo      = Txt_InqNo.Text;
            Tb_Inquiry1.Tb_InquiryType = Tb_InquiryType1;
            Lts_Inherited.Tb_Inquiries.InsertOnSubmit(Tb_Inquiry1);

            try
            {
                Lts_Inherited.SubmitChanges();
                Session["Bank_DeadId"]  = Tb_Dead1.xDedId_pk.ToString();
                Session["Bank_InqDate"] = Tb_Inquiry1.xInqDate;
                Session["Bank_InqNo"]   = Tb_Inquiry1.xInqRegNo;
                Session["Bank_Name"]    = Txt_BankName.Text;
                Response.Redirect("~/Int_Inquiries/Bank/Rpt_Bank.aspx", true);
            }
            catch
            {
                Alarm.ShowMesseage("!خطا", this.Page);
            }
        }
        protected void Btn_Sodor_Click(object sender, EventArgs e)
        {
            if (Lts_Inherited.Tb_Inquiries.SingleOrDefault(n => n.Tb_InquiryType.xInqType.Contains("مالیات") && n.xDedId_fk == Tb_Dead1.xDedId_pk) != null)
            {
                Lbl_Msg.Text      = "!استعلام صادر گردیده است";
                Lbl_Msg.Visible   = true;
                Lbl_Msg.ForeColor = System.Drawing.Color.Red;
                return;
            }
            Tb_InquiryType Tb_InquiryType1 = Lts_Inherited.Tb_InquiryTypes.SingleOrDefault(n => n.xInqType.Contains("مالیات"));

            Tb_Inquiry Tb_Inquiry1 = new Tb_Inquiry();

            Tb_Inquiry1.Tb_Dead = Tb_Dead1;
            //Tb_Inquiry1.xInqDate = Class_ShamsiDateTime.MilladiToShamsi(DateTime.Now.Date).ToString();
            Tb_Inquiry1.xInqDate       = Tdp_InqDate.Date;
            Tb_Inquiry1.xInqRegNo      = Txt_InqNo.Text;
            Tb_Inquiry1.Tb_InquiryType = Tb_InquiryType1;
            Lts_Inherited.Tb_Inquiries.InsertOnSubmit(Tb_Inquiry1);

            foreach (ListItem EstItem in Chk_Estates.Items)
            {
                if (EstItem.Selected)
                {
                    Tb_InqEstate Tb_InqEstate1 = new Tb_InqEstate();
                    Tb_InqEstate1.Tb_Inquiry = Tb_Inquiry1;
                    Tb_InqEstate1.xEstId_fk  = int.Parse(EstItem.Value);
                    Lts_Inherited.Tb_InqEstates.InsertOnSubmit(Tb_InqEstate1);
                }
            }
            try
            {
                Lts_Inherited.SubmitChanges();
                Session["Office_DeadId"]   = Tb_Dead1.xDedId_pk.ToString();
                Session["Office_InqDate"]  = Tb_Inquiry1.xInqDate;
                Session["Office_InqNo"]    = Tb_Inquiry1.xInqRegNo;
                Session["Office_Name"]     = Txt_Office.Text;
                Session["Office_EstateId"] = null;
                foreach (ListItem EstItem in Chk_Estates.Items)
                {
                    if (EstItem.Selected)
                    {
                        Session["Office_EstateId"] += EstItem.Value + "&";
                    }
                }
                Response.Redirect("~/Int_Inquiries/TaxOffice/Rpt_TaxOffice.aspx", true);
            }
            catch
            {
                Alarm.ShowMesseage("!خطا", this.Page);
            }
        }
Esempio n. 3
0
 protected void Gvw_Dead_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedId_pk == int.Parse(Gvw_Dead.DataKeys[e.RowIndex].Value.ToString()));
     Tb_Dead1.xDedIsDeleted_ = true;
     try
     {
         Lts_Inherited.SubmitChanges();
         Alarm1.ShowMesseage("!عملیات حدف با موفقیت انجام شد", this.Page);
         Btn_Search_Click(sender, e);
     }
     catch
     {
         Alarm1.ShowMesseage("!خطا", this.Page);
         return;
     }
 }
Esempio n. 4
0
 protected void Gvw_Estate_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     Tb_Estate1 = Lts_Inherited.Tb_Estates.SingleOrDefault(n => n.xEstId_pk == int.Parse(Gvw_Estate.DataKeys[e.RowIndex].Value.ToString()));
     try
     {
         Tb_Estate1.xEstIsDeleted_ = true;
         Lts_Inherited.SubmitChanges();
         Alarm.ShowMesseage("!عملیات حذف با موفقیت انجام شد", this.Page);
         List <Tb_Estate> 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();
     }
     catch
     {
         Alarm.ShowMesseage("Error", this.Page);
     }
 }
        protected void Gvw_Applies_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Tb_Apply1 = Lts_Inherited.Tb_Applies.SingleOrDefault(n => n.xAppId_pk == int.Parse(Gvw_Applies.DataKeys[e.RowIndex].Value.ToString()));
            Tb_Apply1.xAppIsDeleted_ = true;
            try
            {
                Lts_Inherited.SubmitChanges();
                Alarm.ShowMesseage("!عملیات حذف با موفقیت انجام شد", this.Page);

                List <Tb_Apply> Lst_Applys = Lts_Inherited.Tb_Applies.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk && n.xAppIsDeleted_ == false).ToList();
                Gvw_Applies.DataSource = Lst_Applys;
                Gvw_Applies.DataBind();
                Gvw_Applies.Visible = true;
            }
            catch
            {
                Alarm.ShowMesseage("!خطا", this.Page);
            }
        }
Esempio n. 6
0
        protected void Btn_Save_Click(object sender, EventArgs e)
        {
            string Str_Msg = "";

            if (Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xClass == Txt_Klasse.Text & n.xHozeh == Txt_Hozeh.Text) != null)
            {
                if (Hfld_Command.Value == "Save")
                {
                    Tb_Estate1                 = new Tb_Estate();
                    Tb_Estate1.xDedId_fk       = Tb_Dead1.xDedId_pk;
                    Tb_Estate1.xEstDescription = Txt_EstateDesc.Text;
                    Tb_Estate1.xEstTypeId_fk   = int.Parse(Ddl_Estatetype.SelectedItem.Value);
                    Lts_Inherited.Tb_Estates.InsertOnSubmit(Tb_Estate1);
                    Str_Msg = "!عملیات ذخیره با موفقیت انجام شد";
                }
                else if (Hfld_Command.Value == "Edit")
                {
                    Tb_Estate1.xEstDescription = Txt_EstateDesc.Text;
                    Tb_EstateType Tb_EstateType1 = Lts_Inherited.Tb_EstateTypes.SingleOrDefault(n => n.xEstTypeId_pk == int.Parse(Ddl_Estatetype.SelectedItem.Value.ToString()));
                    Tb_Estate1.Tb_EstateType = Tb_EstateType1;
                    Str_Msg = "!عملیات ویرایش با موفقیت انجام شد";
                }

                try
                {
                    Lts_Inherited.SubmitChanges();
                    Alarm.ShowMesseage(Str_Msg, this.Page);
                    ResetControls();

                    List <Tb_Estate> 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();
                }
                catch
                {
                    Alarm.ShowMesseage("Error", this.Page);
                }
            }
            else
            {
                Alarm.ShowMesseage("پرونده ای  وجود ندارد!", this.Page);
            }
        }
        protected void Gvw_Heris_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Tb_Person1 = Lts_Inherited.Tb_Persons.SingleOrDefault(n => n.xPrsId_pk == int.Parse(Gvw_Heris.DataKeys[e.RowIndex].Value.ToString()));
            Tb_Heir1   = Lts_Inherited.Tb_Heirs.SingleOrDefault(n => n.xDedId_fk == Tb_Dead1.xDedId_pk && n.xPrsId_fk == Tb_Person1.xPrsId_pk);
            Lts_Inherited.Tb_Heirs.DeleteOnSubmit(Tb_Heir1);
            try
            {
                Lts_Inherited.SubmitChanges();
                Alarm1.ShowMesseage("!عملیات حذف با موفقیت انجام شد", this.Page);

                Lst_Heris            = Lts_Inherited.Tb_Heirs.Where(n => n.xDedId_fk == Tb_Dead1.xDedId_pk).Select(n => n.Tb_Person).ToList();
                Gvw_Heris.DataSource = Lst_Heris;
                Gvw_Heris.DataBind();
                Gvw_Heris.Visible = true;
            }
            catch
            {
                Alarm1.ShowMesseage("!خطا", this.Page);
            }
        }
Esempio n. 8
0
        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_Save_Click(object sender, EventArgs e)
        {
            if (Txt_BirthDate.Text == "__/__/____")
            {
                Alarm1.ShowMesseage("!تاریخ را صحیح وارد نمایید", this.Page);
                return;
            }
            int int_Year   = int.Parse(Txt_BirthDate.Text.Substring(0, 4));
            int int_Mounth = int.Parse(Txt_BirthDate.Text.Substring(5, 2));
            int int_Day    = int.Parse(Txt_BirthDate.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 (Txt_Klasse.Text.Trim() == "")
            {
                RequiredFieldValidator9.Validate();
                return;
            }
            if (Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xClass == Txt_Klasse.Text & n.xHozeh == Txt_Hozeh.Text) != null)
            {
                DedId    = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xHozeh == Txt_Hozeh.Text & n.xClass == Txt_Klasse.Text).xDedId_fk;
                Tb_Dead1 = Lts_Inherited.Tb_Deads.SingleOrDefault(n => n.xDedId_pk == DedId);

                Tb_PersonExist = Lts_Inherited.Tb_Persons.SingleOrDefault(n => n.xPrsNationalCode == Txt_PNationalCode.Text.Trim());

                if (Hfld_Command.Value == "Save")
                {
                    try
                    {
                        Tb_Person1 = new Tb_Person();
                        if (Tb_PersonExist != null)
                        {
                            ////کنترل شخص ثبت شده
                            Tb_Heir1 = Lts_Inherited.Tb_Heirs.SingleOrDefault(n => n.xDedId_fk == DedId && n.xPrsId_fk == Tb_PersonExist.xPrsId_pk);
                            if (Tb_Heir1 != null)
                            {
                                Alarm1.ShowMesseage("این شخص قبلا بعنوان وارث در این پرونده ثبت گردیده است!", this.Page);
                                return;
                            }
                            Tb_Person1 = Tb_PersonExist;
                            Tb_Person1.xPrsIsDeleted_ = false;
                        }
                        else
                        {
                            Tb_Person1.xPrsFName         = Txt_PFirsName.Text;
                            Tb_Person1.xPrsLName         = Txt_PLastName.Text;
                            Tb_Person1.xPrsFatherName    = TxtPFatherName.Text;
                            Tb_Person1.xPrsBirthDate     = Txt_BirthDate.Text;
                            Tb_Person1.xPrsBirthPlace    = Txt_PBirthPlace.Text;
                            Tb_Person1.xPrsIdNo          = Txt_PIdNo.Text;
                            Tb_Person1.xPrsIssuancePalce = Txt_PSoodorPlace.Text;
                            Tb_Person1.xPrsNationalCode  = Txt_PNationalCode.Text;
                            Tb_Person1.xPrsPostalCode    = Txt_PCodPosti.Text;
                            Tb_Person1.xPrsTel           = Txt_PTel.Text;
                            if (Rbtn_Sex.SelectedValue == "male")
                            {
                                Tb_Person1.xPrsSex = "male";
                            }
                            else
                            {
                                Tb_Person1.xPrsSex = "fmale";
                            }
                            Tb_Person1.xPrsAddrress = Txt_PAddrress.Text;
                            Lts_Inherited.Tb_Persons.InsertOnSubmit(Tb_Person1);
                        }
                        Tb_Heir1               = new Tb_Heir();
                        Tb_Heir1.Tb_Dead       = Tb_Dead1;
                        Tb_Heir1.Tb_Person     = Tb_Person1;
                        Tb_Heir1.xRtoId_fk     = int.Parse(Ddl_Ratio.SelectedValue);
                        Tb_Heir1.xIsApplicant_ = false;

                        Lts_Inherited.Tb_Heirs.InsertOnSubmit(Tb_Heir1);
                        Lts_Inherited.SubmitChanges();
                        Alarm1.ShowMesseage("!عملیات ذخیره با موفقیت انجام شد", this.Page);
                        //Btn_New.Visible = true;
                        NewReg();

                        Lst_Heris            = Lts_Inherited.Tb_Heirs.Where(n => n.xDedId_fk == DedId).Select(n => n.Tb_Person).ToList();
                        Gvw_Heris.DataSource = Lst_Heris;
                        Gvw_Heris.DataBind();
                        Gvw_Heris.Visible = true;
                    }
                    catch
                    {
                        Alarm1.ShowMesseage("!خطا", this.Page);
                    }
                }
                else if (Hfld_Command.Value == "Edit")
                {
                    try
                    {
                        if (Tb_Person1.xPrsNationalCode != Txt_PNationalCode.Text && Tb_PersonExist != null)
                        {
                            Tb_Heir1 = Lts_Inherited.Tb_Heirs.SingleOrDefault(n => n.xDedId_fk == DedId && n.xPrsId_fk == Tb_PersonExist.xPrsId_pk);
                            if (Tb_Heir1 != null)
                            {
                                Alarm1.ShowMesseage("این شخص قبلا بعنوان وارث در این پرونده ثبت گردیده است!", this.Page);
                                return;
                            }
                        }
                        Tb_Person1.xPrsFName         = Txt_PFirsName.Text;
                        Tb_Person1.xPrsLName         = Txt_PLastName.Text;
                        Tb_Person1.xPrsFatherName    = TxtPFatherName.Text;
                        Tb_Person1.xPrsBirthDate     = Txt_BirthDate.Text;
                        Tb_Person1.xPrsBirthPlace    = Txt_PBirthPlace.Text;
                        Tb_Person1.xPrsIdNo          = Txt_PIdNo.Text;
                        Tb_Person1.xPrsIssuancePalce = Txt_PSoodorPlace.Text;
                        Tb_Person1.xPrsNationalCode  = Txt_PNationalCode.Text;
                        Tb_Person1.xPrsPostalCode    = Txt_PCodPosti.Text;
                        Tb_Person1.xPrsTel           = Txt_PTel.Text;
                        if (Rbtn_Sex.SelectedValue == "male")
                        {
                            Tb_Person1.xPrsSex = "male";
                        }
                        else
                        {
                            Tb_Person1.xPrsSex = "fmale";
                        }
                        Tb_Person1.xPrsAddrress = Txt_PAddrress.Text;

                        Tb_Heir1.xRtoId_fk = int.Parse(Ddl_Ratio.SelectedValue);

                        Lts_Inherited.SubmitChanges();
                        Alarm1.ShowMesseage("!عملیات ویرایش با موفقیت انجام شد", this.Page);

                        Lst_Heris            = Lts_Inherited.Tb_Heirs.Where(n => n.xDedId_fk == DedId).Select(n => n.Tb_Person).ToList();
                        Gvw_Heris.DataSource = Lst_Heris;
                        Gvw_Heris.DataBind();
                        Gvw_Heris.Visible = true;
                        NewReg();

                        Gvw_Heris.Visible = true;
                    }
                    catch
                    {
                        Alarm1.ShowMesseage("!خطا", this.Page);
                    }
                }
            }
            else
            {
                Alarm1.ShowMesseage("پرونده ای  وجود ندارد!", this.Page);
            }
        }
        protected void Btn_Save_Click(object sender, EventArgs e)
        {
            if (Txt_ApplyDate.Text == "__/__/____" || Txt_HasrDate.Text == "__/__/____")
            {
                Alarm.ShowMesseage("!تاریخ را صحیح وارد نمایید", this.Page);
                return;
            }
            int int_Year   = int.Parse(Txt_ApplyDate.Text.Substring(0, 4));
            int int_Mounth = int.Parse(Txt_ApplyDate.Text.Substring(5, 2));
            int int_Day    = int.Parse(Txt_ApplyDate.Text.Substring(8, 2));

            if (int_Year < 1300 || int_Year > 1400 || int_Mounth == 00 || int_Mounth > 12 || int_Day == 00 || int_Day > 31)
            {
                Alarm.ShowMesseage("!تاریخ را صحیح وارد نمایید", this.Page);
                return;
            }
            int_Year   = int.Parse(Txt_HasrDate.Text.Substring(0, 4));
            int_Mounth = int.Parse(Txt_HasrDate.Text.Substring(5, 2));
            int_Day    = int.Parse(Txt_HasrDate.Text.Substring(8, 2));
            if (int_Year < 1300 || int_Year > 1400 || int_Mounth == 00 || int_Mounth > 12 || int_Day == 00 || int_Day > 31)
            {
                Alarm.ShowMesseage("!تاریخ را صحیح وارد نمایید", this.Page);
                return;
            }


            Tb_File1 = Lts_Inherited.Tb_Files.SingleOrDefault(n => n.xHozeh == Txt_Hozeh.Text & n.xClass == Txt_Klasse.Text);
            if (Tb_File1 == null)
            {
                Alarm.ShowMesseage("کلاسه مورد نظر اشتباه است !", this.Page);
                return;
            }

            string Str_Msg = "";

            if (Hfld_Command.Value == "Save")
            {
                if (Lts_Inherited.Tb_Applies.SingleOrDefault(n => n.xDedId_fk == Tb_File1.xDedId_fk && n.xAppIsDeleted_ == false) != null)
                {
                    Alarm.ShowMesseage("اطلاعات فرم درخواست قبلا ثبت گردیده است", this.Page);
                    return;
                }
                Tb_Apply1                       = new Tb_Apply();
                Tb_Apply1.xAppRegNo             = Txt_AppNo.Text;
                Tb_Apply1.xAppRegDate           = Txt_ApplyDate.Text;
                Tb_Apply1.xAppHasrNo            = Txt_HasrNo.Text;
                Tb_Apply1.xAppHasrDate          = Txt_HasrDate.Text;
                Tb_Apply1.xAppShobeDadgah       = Txt_ShobeNo.Text;
                Tb_Apply1.xAppDadgah            = Txt_Dadgah.Text;
                Tb_Apply1.xDedId_fk             = Tb_File1.xDedId_fk;
                Tb_File1.Tb_Dead.xDedCodeHoviat = Txt_CodeHoviati.Text.Trim();

                Lts_Inherited.Tb_Applies.InsertOnSubmit(Tb_Apply1);
                Str_Msg = "!عملیات ذخیره با موفقیت انجام شد";
            }

            else if (Hfld_Command.Value == "Edit")
            {
                Tb_Apply1.xAppRegNo              = Txt_AppNo.Text;
                Tb_Apply1.xAppRegDate            = Txt_ApplyDate.Text;
                Tb_Apply1.xAppHasrNo             = Txt_HasrNo.Text;
                Tb_Apply1.xAppHasrDate           = Txt_HasrDate.Text;
                Tb_Apply1.xAppShobeDadgah        = Txt_ShobeNo.Text;
                Tb_Apply1.xAppDadgah             = Txt_Dadgah.Text;
                Tb_Apply1.xDedId_fk              = Tb_File1.xDedId_fk;
                Tb_Apply1.Tb_Dead.xDedCodeHoviat = Txt_CodeHoviati.Text.Trim();

                Str_Msg = "!عملیات ویرایش با موفقیت انجام شد";
            }

            try
            {
                Lts_Inherited.SubmitChanges();
                Alarm.ShowMesseage(Str_Msg, this.Page);
                ResetControl();

                List <Tb_Apply> Lst_Applys = Lts_Inherited.Tb_Applies.Where(n => n.xDedId_fk == Tb_File1.xDedId_fk && n.xAppIsDeleted_ == false).ToList();
                Gvw_Applies.DataSource = Lst_Applys;
                Gvw_Applies.DataBind();
                Gvw_Applies.Visible = true;
            }
            catch
            {
                Alarm.ShowMesseage("!خطا", this.Page);
            }
        }
Esempio n. 11
0
        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);
            }
        }
        protected void Btn_Sodor_Click(object sender, EventArgs e)
        {
            if (Lts_Inherited.Tb_Inquiries.SingleOrDefault(n => n.Tb_InquiryType.xInqType.Contains("اسناد") && n.xDedId_fk == Tb_Dead1.xDedId_pk) != null)
            {
                Lbl_Msg.Text      = "!استعلام صادر گردیده است";
                Lbl_Msg.Visible   = true;
                Lbl_Msg.ForeColor = System.Drawing.Color.Red;
                return;
            }
            Tb_InquiryType Tb_InquiryType1 = Lts_Inherited.Tb_InquiryTypes.SingleOrDefault(n => n.xInqType.Contains("اسناد"));

            Tb_Inquiry Tb_Inquiry1 = new Tb_Inquiry();

            Tb_Inquiry1.Tb_Dead = Tb_Dead1;
            //Tb_Inquiry1.xInqDate = Class_ShamsiDateTime.MilladiToShamsi(DateTime.Now.Date).ToString();
            Tb_Inquiry1.xInqDate       = Tdp_InqDate.Date;
            Tb_Inquiry1.xInqRegNo      = Txt_InqNo.Text;
            Tb_Inquiry1.Tb_InquiryType = Tb_InquiryType1;
            Lts_Inherited.Tb_Inquiries.InsertOnSubmit(Tb_Inquiry1);

            foreach (ListItem EstItem in Chk_Estates.Items)
            {
                if (EstItem.Selected)
                {
                    Tb_InqEstate Tb_InqEstate1 = new Tb_InqEstate();
                    Tb_InqEstate1.Tb_Inquiry = Tb_Inquiry1;
                    Tb_InqEstate1.xEstId_fk  = int.Parse(EstItem.Value);
                    Lts_Inherited.Tb_InqEstates.InsertOnSubmit(Tb_InqEstate1);
                }
            }
            try
            {
                Lts_Inherited.SubmitChanges();
                Session["Asnad_DeadId"]   = Tb_Dead1.xDedId_pk.ToString();
                Session["Asnad_EstateId"] = null;
                Session["Asnad_InqDate"]  = Tdp_InqDate.Date;
                Session["Asnad_InqNo"]    = Txt_InqNo.Text;

                foreach (ListItem EstItem in Chk_Estates.Items)
                {
                    if (EstItem.Selected)
                    {
                        Session["Asnad_EstateId"] += EstItem.Value + "&";
                    }
                }
            }
            catch
            {
                Alarm.ShowMesseage("!خطا", this.Page);
            }

            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;

            Lbl_Msg.Text      = "استعلام صادر گردید ";
            Lbl_Msg.Visible   = true;
            Lbl_Msg.ForeColor = System.Drawing.Color.Green;

            Txt_InqNo.Text   = "";
            Tdp_InqDate.Text = "";
            foreach (ListItem item in Chk_Estates.Items)
            {
                item.Selected = false;
            }
        }