protected void BtnSave_Click(object sender, EventArgs e)
        {
            int lintcnt = 0;
            EntityRoomCategory entRoomCate = new EntityRoomCategory();

            if (string.IsNullOrEmpty(txtCateCode.Text.Trim()))
            {
                lblMsg.Text = "Please Enter Category Code";
            }
            else
            {
                if (string.IsNullOrEmpty(txtCateDesc.Text.Trim()))
                {
                    lblMsg.Text = "Please Enter Category Description";
                }
                else
                {
                    entRoomCate.CategoryCode = txtCateCode.Text.Trim();
                    entRoomCate.CategoryDesc = txtCateDesc.Text.Trim();

                    if (rdoICU.Checked)
                    {
                        entRoomCate.IsICU = true;
                    }
                    if (rdoOT.Checked)
                    {
                        entRoomCate.IsOT = true;
                        entRoomCate.Rate = 0;
                    }
                    else
                    {
                        entRoomCate.Rate = Convert.ToDecimal(txtRate.Text);
                    }
                    entRoomCate.EntryBy = SessionWrapper.UserName;
                    if (!Commons.IsRecordExists("tblCategoryMaster", "CategoryCode", entRoomCate.CategoryCode))
                    {
                        lintcnt = mobjCateBLL.InsertCategory(entRoomCate);

                        if (lintcnt > 0)
                        {
                            GetCategories();
                            lblMessage.Text = "Record Inserted Successfully....";
                            //this.programmaticModalPopup.Hide();
                        }
                        else
                        {
                            lblMessage.Text = "Record Not Inserted...";
                        }
                    }
                    else
                    {
                        lblMessage.Text = "Record Already Exist....";
                    }
                }
            }
            MultiView1.SetActiveView(View1);
        }
Пример #2
0
        public int DeleteCategory(EntityRoomCategory entRoomCat)
        {
            int cnt = 0;

            try
            {
                List <SqlParameter> lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@CategoryCode", DbType.String, entRoomCat.CategoryCode);
                cnt = mobjDataAcces.ExecuteQuery("sp_DeleteCategory", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("DepartmentBLL - DeleteDepartment(EntityDepartment entDept)", ex);
            }
            return(cnt);
        }
        protected void BtnDeleteOk_Click(object sender, EventArgs e)
        {
            EntityRoomCategory entCate = new EntityRoomCategory();
            int cnt = 0;

            try
            {
                foreach (GridViewRow drv in dgvRoomCategory.Rows)
                {
                    CheckBox chkDelete = (CheckBox)drv.FindControl("chkDelete");
                    if (chkDelete.Checked)
                    {
                        LinkButton lnkCateCode  = (LinkButton)drv.FindControl("lnkCatCode");
                        string     lstrCateCode = lnkCateCode.Text;
                        entCate.CategoryCode = lstrCateCode;

                        cnt = mobjCateBLL.DeleteCategory(entCate);
                        if (cnt > 0)
                        {
                            //this.modalpopupDelete.Hide();
                            lblMessage.Text = "Record Deleted Successfully....";
                            if (dgvRoomCategory.Rows.Count <= 0)
                            {
                                pnlShow.Style.Add(HtmlTextWriterStyle.Display, "none");
                                hdnPanel.Value = "none";
                            }
                        }
                        else
                        {
                            lblMessage.Text = "Record Not Deleted....";
                        }
                    }
                }
                GetCategories();
            }
            catch (System.Threading.ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                Commons.FileLog("frmCategoryMaster -   BtnDeleteOk_Click(object sender, EventArgs e)", ex);
            }
        }
Пример #4
0
        public int UpdateCategory(EntityRoomCategory entRoomCat)
        {
            int cnt = 0;

            try
            {
                List <SqlParameter> lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@CategoryCode", DbType.String, entRoomCat.CategoryCode);
                Commons.ADDParameter(ref lstParam, "@CategoryDesc", DbType.String, entRoomCat.CategoryDesc);
                Commons.ADDParameter(ref lstParam, "@Rate", DbType.Decimal, entRoomCat.Rate);
                Commons.ADDParameter(ref lstParam, "@ChangeBy", DbType.String, entRoomCat.ChangeBy);
                Commons.ADDParameter(ref lstParam, "@IsICU", DbType.Boolean, entRoomCat.IsICU);
                Commons.ADDParameter(ref lstParam, "@IsOT", DbType.Boolean, entRoomCat.IsOT);
                cnt = mobjDataAcces.ExecuteQuery("sp_UpdateCategory", lstParam);
            }
            catch (Exception ex)
            {
                Commons.FileLog("RoomCategoryBLL -  UpdateCategory(EntityRoomCategory entRoomCat)", ex);
            }

            return(cnt);
        }
        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            int lintCnt = 0;

            try
            {
                EntityRoomCategory entCate = new EntityRoomCategory();
                entCate.CategoryCode = txtCateCode.Text;
                entCate.CategoryDesc = txtCateDesc.Text;
                entCate.Rate         = Convert.ToDecimal(txtRate.Text.Trim());
                entCate.ChangeBy     = SessionWrapper.UserName;
                if (rdoICU.Checked)
                {
                    entCate.IsICU = true;
                }
                if (rdoOT.Checked)
                {
                    entCate.IsOT = true;
                }
                lintCnt = mobjCateBLL.UpdateCategory(entCate);

                if (lintCnt > 0)
                {
                    GetCategories();
                    lblMessage.Text = "Record Updated Successfully";
                    //this.programmaticModalPopup.Hide();
                }
                else
                {
                    lblMessage.Text = "Record Not Updated";
                }
                MultiView1.SetActiveView(View1);
            }
            catch (Exception ex)
            {
                Commons.FileLog("frmCategoryMaster -  BtnEdit_Click(object sender, EventArgs e)", ex);
            }
        }
Пример #6
0
        public EntityRoomCategory GetRoomCategoryByBedID(int BedId)
        {
            EntityRoomCategory objCat = null;

            try
            {
                objCat = (from tbl in objData.tblBedMasters
                          join tblRoomCat in objData.tblRoomCategories
                          on tbl.CategoryId equals tblRoomCat.PKId
                          where tbl.BedId == BedId &&
                          tbl.IsDelete == false
                          select new EntityRoomCategory
                {
                    PKId = tblRoomCat.PKId,
                    IsICU = Convert.ToBoolean(tblRoomCat.IsICU),
                }).FirstOrDefault();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(objCat);
        }