Esempio n. 1
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int             lintcnt      = 0;
                EntityBedMaster entBedMaster = new EntityBedMaster();
                if (ddlRoomNo.SelectedIndex == 0)
                {
                    lblMsg.Text = "Please Select Room Number";
                }
                else
                {
                    if (string.IsNullOrEmpty(txtBedNo.Text))
                    {
                        lblMsg.Text = "Please Enter Bed Number";
                    }
                    else
                    {
                        entBedMaster.CategoryId = Convert.ToInt32(Session["CategoryId"]);
                        entBedMaster.FloorNo    = Convert.ToInt32(Session["FloorNo"]);
                        entBedMaster.RoomId     = Convert.ToInt32(ddlRoomNo.SelectedValue);
                        entBedMaster.BedNo      = txtBedNo.Text;

                        if (!Commons.IsRecordExists("tblBedMaster", "BedNo", Convert.ToString(entBedMaster.BedNo)))//
                        {
                            lintcnt = mobjBedMaster.InsertBedMaster(entBedMaster);

                            if (lintcnt > 0)
                            {
                                GetBedMasters();
                                lblMessage.Text = "Record Inserted Successfully....";
                                //this.programmaticModalPopup.Hide();
                            }
                            else
                            {
                                lblMessage.Text = "Record Not Inserted...";
                            }
                        }
                        else
                        {
                            lblMessage.Text = "Record Of This Bed Already Exist";
                        }
                        Clear();
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
            MultiView1.SetActiveView(View1);
        }
Esempio n. 2
0
        protected void BtnEdit_Click(object sender, EventArgs e)
        {
            int lintCnt = 0;

            try
            {
                EntityBedMaster entBedMaster = new EntityBedMaster();
                int             i            = Convert.ToInt32(Session["Room_Id"]);
                entBedMaster.BedId = Convert.ToInt32(Session["id"]);
                entBedMaster.BedNo = txtBedNo.Text;
                if (ddlRoomNo.SelectedIndex == i)
                {
                    entBedMaster.FloorNo    = Convert.ToInt32(Session["Floor_No"]);
                    entBedMaster.CategoryId = Convert.ToInt32(Session["Cat_Id"]);
                }
                else
                {
                    entBedMaster.FloorNo    = Convert.ToInt32(Session["FloorNo"]);
                    entBedMaster.CategoryId = Convert.ToInt32(Session["CategoryId"]);
                }

                entBedMaster.RoomId = Convert.ToInt32(ddlRoomNo.SelectedValue);
                if (!Commons.IsRecordExists("tblBedMaster", "BedNo", Convert.ToString(entBedMaster.BedNo)))
                {
                    lintCnt = mobjBedMaster.UpdateBedMaster(entBedMaster);
                    if (lintCnt > 0)
                    {
                        GetBedMasters();
                        lblMessage.Text = "Record Updated Successfully";
                    }
                    else
                    {
                        lblMessage.Text = "Record Not Updated";
                    }
                }
                else
                {
                    lblMessage.Text = "Record Already Exist";
                }

                Clear();
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
            MultiView1.SetActiveView(View1);
        }
Esempio n. 3
0
 public EntityBedMaster GetFloorRoomBed(object Bed_Id)
 {
     try
     {
         EntityBedMaster lobjBed = (from tbl in objData.tblBedMasters
                                    where tbl.BedId.Equals(Bed_Id) &&
                                    tbl.IsDelete == false
                                    select new EntityBedMaster {
             FloorNo = tbl.FloorNo, RoomId = tbl.RoomId, BedNo = tbl.BedNo
         }).FirstOrDefault();
         return(lobjBed);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
        public int InsertBedMaster(EntityBedMaster entBedMaster)
        {
            int cnt = 0;

            try
            {
                List <SqlParameter> lstParam = new List <SqlParameter>();
                Commons.ADDParameter(ref lstParam, "@BedNo", DbType.String, entBedMaster.BedNo);
                Commons.ADDParameter(ref lstParam, "@RoomId", DbType.Int32, entBedMaster.RoomId);
                Commons.ADDParameter(ref lstParam, "@FloorNo", DbType.Int32, entBedMaster.FloorNo);
                Commons.ADDParameter(ref lstParam, "@CategoryId", DbType.Int32, entBedMaster.CategoryId);
                cnt = mobjDataAcces.ExecuteQuery("sp_InsertBedMaster", lstParam);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(cnt);
        }