Esempio n. 1
0
        public string DeleteUserType(int usertypeID)
        {
            string strResponse = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var Org = new UserTypeComponent();
                    int r   = Org.DeleteUserTypeDetail(usertypeID);
                    if (r > 0)
                    {
                        strResponse = "Employment type deleted successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Employment type does not exists";
                    }
                    else if (r < 0)
                    {
                        strResponse = "Error occured in DeleteUserType";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
Esempio n. 2
0
        public string UpdateUserType(UserTypeEntity usertypeDtl)
        {
            string strResponse       = string.Empty;
            short  UsTCurrentVersion = 0;

            try
            {
                var usertypeComponent      = new UserTypeComponent();
                var currentUserTypeDetails = usertypeComponent.GetUserTypeDetailByID(usertypeDtl.UsT_UserTypeID);
                int usertypeID             = currentUserTypeDetails.UsT_UserTypeID;
                UsTCurrentVersion = Convert.ToInt16(currentUserTypeDetails.UsT_Version);
                bool UsTCurrentStatus = false;

                //check for version and active status
                if (ModelState["UsT_isDeleted"].Value != null)
                {
                    //UsTCurrentStatus = (usertypeDtl.UsT_ActiveStatus == true) ? true : false;
                    UsTCurrentStatus = usertypeDtl.UsT_isDeleted == true;
                }

                if (ModelState.IsValid)
                {
                    UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                    int             _userID         = _objSessioninfo.UserId;
                    usertypeDtl.UsT_ModifiedBy = _userID;
                    //while udating increment version by1
                    usertypeDtl.UsT_Version   = ++UsTCurrentVersion;
                    usertypeDtl.UsT_isDeleted = UsTCurrentStatus;
                    var Org = new UserTypeComponent();
                    int r   = Org.UpdateUserTypeDetail(usertypeDtl);
                    if (r == 1)
                    {
                        strResponse = "Employment type updated successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Employment type already exists";
                    }
                    else if (r == -1)
                    {
                        strResponse = "Error occured in UpdateUserType";
                    }
                    else if (r == 2)
                    {
                        strResponse = "Employee Code Already Existed";
                    }
                    else if (r == 3)
                    {
                        strResponse = "Employee Type Already Existed";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
Esempio n. 3
0
        public string ChangeStatus(string id, string status)
        {
            string strResponse = string.Empty;
            var    objDtl      = new UserTypeComponent();

            strResponse = objDtl.ChangeStatus(id, status);

            return(strResponse);
        }
Esempio n. 4
0
        public JsonResult GetUserTypeByID(int catID)
        {
            UserTypeEntity UserTypeDetails = null;

            try
            {
                var objDtl = new UserTypeComponent();
                UserTypeDetails = objDtl.GetUserTypeDetailByID(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(UserTypeDetails, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        public JsonResult GetUserTypeHistoryByID(int ID)
        {
            List <History_UserTypeEntity> HisUserTypeDetails = null;

            try
            {
                var objDtl = new UserTypeComponent();
                HisUserTypeDetails      = objDtl.GetHistoryUserTypeDetailsByID(ID);
                ViewBag.UserTypeDetails = HisUserTypeDetails;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(HisUserTypeDetails, JsonRequestBehavior.AllowGet));
        }
Esempio n. 6
0
        public JsonResult GetUserTypeCollection(int acntID, string RoleId)
        {
            List <UserTypeEntity> UserTypeDetails = null;

            try
            {
                var objDtl = new UserTypeComponent();
                UserTypeDetails         = objDtl.GetUserTypeDetail(acntID, RoleId);
                ViewBag.UserTypeDetails = UserTypeDetails[0].UsT_Version;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(UserTypeDetails, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public string CreateUserType([Bind(Exclude = "UsT_UserTypeID")] UserTypeEntity usertypeDtl)
        {
            string strResponse = string.Empty;

            try
            {
                var usertypeComponent = new UserTypeComponent();

                UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
                int             _userID         = _objSessioninfo.UserId;
                usertypeDtl.UsT_CreatedBy = _userID;

                var Org = new UserTypeComponent();
                int r   = Org.AddUserType(usertypeDtl);
                if (r == 1)
                {
                    strResponse = "Employment type created successfully";
                }
                else if (r == 0)
                {
                    strResponse = "Employment type already exists";
                }
                else if (r == -1)
                {
                    strResponse = "Please Fill All Mandatory Fields";
                }
                else if (r == 2)
                {
                    strResponse = "Employee Code Already Existed";
                }
                else if (r == 3)
                {
                    strResponse = "Employee Type Already Existed";
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }