示例#1
0
        internal int UpdateReasonType(HRM_ReasonType reasonTypeObj, int leaveTypeId)
        {
            HRM_ReasonType obj = _context.HRM_ReasonType.First(x => x.ReasonTypeId == leaveTypeId);

            obj.ReasonType = reasonTypeObj.ReasonType;
            obj.Edit_Date  = reasonTypeObj.Edit_Date;
            obj.Edit_User  = reasonTypeObj.Edit_User;
            _context.SaveChanges();
            return(1);
        }
示例#2
0
 internal int InsertReasonType(HRM_ReasonType reasonTypeObj)
 {
     try
     {
         _context.HRM_ReasonType.AddObject(reasonTypeObj);
         _context.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#3
0
        protected void btnReasonTypeSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                HRM_ReasonType ReasonTypeObj = new HRM_ReasonType();
                ReasonTypeObj.ReasonType = txtbxReasonType.Text;
                ReasonTypeObj.Edit_User  = ((SessionUser)Session["SessionUser"]).UserId;
                ReasonTypeObj.Edit_Date  = DateTime.Now;
                ReasonTypeObj.OCode      = ((SessionUser)Session["SessionUser"]).OCode;

                int Count = (from reason in _context.HRM_ReasonType
                             where reason.ReasonType == ReasonTypeObj.ReasonType
                             select reason.ReasonTypeId).Count();

                if (btnReasonTypeSubmit.Text == "Submit")
                {
                    if (Count != 0)
                    {
                        // lblMessage.Text = "";
                        // lblMessage.ForeColor = System.Drawing.Color.Red;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Already Exists!')", true);
                        return;
                    }

                    int result = reasonTypeObj.InsertReasonType(ReasonTypeObj);
                    if (result == 1)
                    {
                        //   lblMessage.Text = "Data Save successfully!";
                        // lblMessage.ForeColor = System.Drawing.Color.Green;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save Successfully')", true);
                    }
                    else
                    {
                        //   lblMessage.Text = "";
                        // lblMessage.ForeColor = System.Drawing.Color.Red;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Adding failure!')", true);
                    }
                }
                else
                {
                    int leaveTypeId = Convert.ToInt32(hidReasonTypeId.Value);
                    int result      = reasonTypeObj.UpdateReasonType(ReasonTypeObj, leaveTypeId);
                    if (result == 1)
                    {
                        // lblMessage.Text = "Data Updated successfully!";
                        //  lblMessage.ForeColor = System.Drawing.Color.Green;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully')", true);
                    }
                    else
                    {
                        // lblMessage.Text = "";
                        //   lblMessage.ForeColor = System.Drawing.Color.Red;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updating failure!')", true);
                    }
                }
                getReasonType();
                ClearAllControll();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
示例#4
0
 internal int UpdateReasonType(HRM_ReasonType reasonTypeObj, int reasonTypeId)
 {
     return(reasonDalObj.UpdateReasonType(reasonTypeObj, reasonTypeId));
 }
示例#5
0
 internal int InsertReasonType(HRM_ReasonType reasonTypeObj)
 {
     return(reasonDalObj.InsertReasonType(reasonTypeObj));
 }