예제 #1
0
        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;
        }
예제 #2
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);

            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;
            }
        }