Esempio n. 1
0
        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            int lintCnt = 0;

            try
            {
                EntityCast entCast = new EntityCast();

                string lstrCastCode = Session["CastCode"].ToString();

                entCast.CastCode = lstrCastCode;
                entCast.CastDesc = txtEditCastDesc.Text;
                entCast.Religion = Convert.ToInt32(ddlEditReligion.SelectedValue);
                entCast.ChangeBy = SessionWrapper.UserName;
                lintCnt          = mobjCastBLL.UpdateCaste(entCast);

                if (lintCnt > 0)
                {
                    GetCaste();
                    lblMessage.Text = "Record Updated Successfully";
                    //this.programmaticModalPopup.Hide();
                }
                else
                {
                    lblMessage.Text = "Record Not Updated";
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Esempio n. 2
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            int        lintcnt = 0;
            EntityCast entCast = new EntityCast();

            if (ddlReligion.SelectedIndex == 0)
            {
                lblMsg.Text = "Please Select Religion";
            }
            else if (string.IsNullOrEmpty(txtCastDesc.Text.Trim()))
            {
                lblMsg.Text = "Enter Cast Description";
            }
            else
            {
                entCast.CastCode = txtCastCode.Text.Trim();
                entCast.CastDesc = txtCastDesc.Text.Trim();
                entCast.Religion = Convert.ToInt32(ddlReligion.SelectedValue);
                entCast.EntryBy  = SessionWrapper.UserName;
                lintcnt          = mobjCastBLL.InsertCaste(entCast);

                if (lintcnt > 0)
                {
                    GetCaste();
                    lblMessage.Text = "Record Inserted Successfully";
                    //this.programmaticModalPopup.Hide();
                }
                else
                {
                    lblMessage.Text = "Record Not Inserted";
                }
            }
        }
Esempio n. 3
0
        public int DeleteCaste(EntityCast entCaste)
        {
            int cnt = 0;

            try
            {
                List <SqlParameter> lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@CastCode", DbType.String, entCaste.CastCode);
                cnt = mobjDataAcces.ExecuteQuery("sp_DeleteCaste", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("CastBLL - DeleteCaste(EntityCast entCaste)", ex);
            }
            return(cnt);
        }
Esempio n. 4
0
        public int InsertCaste(EntityCast entCaste)
        {
            int cnt = 0;

            try
            {
                List <SqlParameter> lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@CastCode", DbType.String, entCaste.CastCode);
                Commons.ADDParameter(ref lstParam, "@CastDesc", DbType.String, entCaste.CastDesc);
                Commons.ADDParameter(ref lstParam, "@ReligionId", DbType.Int32, entCaste.Religion);
                Commons.ADDParameter(ref lstParam, "@EntryBy", DbType.String, entCaste.EntryBy);
                cnt = mobjDataAcces.ExecuteQuery("sp_InsertCaste ", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("CasteBLL - InsertCaste(EntityCast entCaste)", ex);
            }
            return(cnt);
        }
Esempio n. 5
0
        protected void BtnDeleteOk_Click(object sender, EventArgs e)
        {
            EntityCast entCast = new EntityCast();
            int        cnt     = 0;

            try
            {
                foreach (GridViewRow drv in dgvCast.Rows)
                {
                    CheckBox chkDelete = (CheckBox)drv.FindControl("chkDelete");
                    if (chkDelete.Checked)
                    {
                        LinkButton lnkCastCode  = (LinkButton)drv.FindControl("lnkCastCode");
                        string     lstrCastCode = lnkCastCode.Text;
                        entCast.CastCode = lstrCastCode;

                        cnt = mobjCastBLL.DeleteCaste(entCast);
                        if (cnt > 0)
                        {
                            //this.modalpopupDelete.Hide();
                            lblMessage1.Text = "Record Deleted Successfully....";

                            if (dgvCast.Rows.Count <= 0)
                            {
                                pnlShow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                hdnPanel.Value = "none";
                            }
                        }
                        else
                        {
                            lblMessage1.Text = "Record Not Deleted....";
                        }
                    }
                }
                GetCaste();
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }