public ActionResult Register()
        {
            DAL_Roles dal_roles = new DAL_Roles();

            ViewBag.UserType = new SelectList(dal_roles.AllRoles());

            return(View());
        }
        public ActionResult Register(UserProfile UP)
        {
            DataAccessLayer dal  = new DataAccessLayer();
            int             rows = dal.AddUser3(UP);

            if (rows != 0)
            {
                return(RedirectToAction("Login", new { controller = "Account", action = "Login", id = UrlParameter.Optional }));
            }
            else
            {
                DAL_Roles dal_roles = new DAL_Roles();

                ViewBag.UserType = new SelectList(dal_roles.AllRoles());
                return(View(UP));
            }
        }
        public RolesModel Roles_InsertUpdate(ArrayList paramList)
        {
            string     strResult     = "";
            string     strReturnCode = "000";
            string     strReturnMsg  = "UnDefined";
            RolesModel apiObject     = new RolesModel();

            apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <RolesModel>(paramList[0].ToString());
            string crCnString = UtilityLib.GetConnectionString();

            int RoleInfo = DAL_Roles.Roles_InsertUpdate(crCnString, apiObject.RoleId, apiObject.RoleName, apiObject.RoleCode, apiObject.UnderPrecedingRoleId,
                                                        apiObject.AuthorizationRequired, apiObject.CompanyId);

            if (RoleInfo == 0)
            {
                apiObject.ReturnCode    = RoleInfo;
                apiObject.ReturnMessage = "Role Added Successfully";
            }
            else if (RoleInfo == 1)
            {
                apiObject.ReturnCode    = RoleInfo;
                apiObject.ReturnMessage = "Role already exists";
            }
            else if (RoleInfo == 101)
            {
                apiObject.ReturnCode    = RoleInfo;
                apiObject.ReturnMessage = "Role updated successfully";
            }
            else if (RoleInfo == 2)
            {
                apiObject.ReturnCode    = RoleInfo;
                apiObject.ReturnMessage = "record is already updated by someone else";
            }
            else
            {
                apiObject.ReturnCode    = RoleInfo;
                apiObject.ReturnMessage = "Fail-Record Not Inserted";
            }
            strResult = strReturnCode + "|" + strReturnMsg;
            return(apiObject);
        }
        private IList <RolesModel> fnRoles_List(RolesModel apiObject, ref string strResult)
        {
            string             strReturnCode          = "000";
            string             strReturnMsg           = "UnDefined";
            string             crCnString             = UtilityLib.GetConnectionString();
            IList <RolesModel> objFieldClassModelList = new List <RolesModel>();

            DataSet usersInfoDS = DAL_Roles.Roles_List(crCnString, apiObject.RequestType, apiObject.SearchBy, apiObject.SearchString, apiObject.IntID,
                                                       apiObject.UnderPrecedingRoleId, apiObject.CompanyId, apiObject.ItemsPerPage, apiObject.RequestPageNo, apiObject.CurrentPageNo);

            DataTable usersInfoDT = usersInfoDS.Tables[0];

            if (usersInfoDT != null && usersInfoDT.Rows.Count > 0)
            {
                strReturnCode = "001";
                strReturnMsg  = "Success";
                foreach (DataRow dr in usersInfoDT.Rows)
                {
                    apiObject          = new RolesModel();
                    apiObject.RoleId   = UtilityLib.FormatNumber(dr["RoleId"].ToString());
                    apiObject.RoleName = (string)dr["RoleName"];
                    apiObject.RoleCode = (string)dr["RoleCode"];
                    apiObject.AuthorizationRequired = UtilityLib.FormatBoolean(dr["AuthorizationRequired"].ToString());
                    apiObject.UnderPrecedingRoleId  = UtilityLib.FormatNumber(dr["UnderPrecedingRoleId"].ToString());
                    apiObject.CompanyId             = (Guid)(dr["CompanyId"]);
                    objFieldClassModelList.Add(apiObject);
                }
            }
            else
            {
                strReturnCode = "002";
                strReturnMsg  = "Fail-Record Not Found";
            }
            strResult = strReturnCode + "|" + strReturnMsg;
            return(objFieldClassModelList);
        }