Exemple #1
0
        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);
            }
        }
Exemple #2
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);
     }
 }
Exemple #3
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);
            }
        }