예제 #1
0
        public ActionResult MenuRoleAction(int id)
        {
            ViewBag.Title = "Role Action";
            int menuID     = id;
            int company_id = SessionUtil.GetCompanyID();
            IList <ControllerAction> list = new List <ControllerAction>();
            var listController            = STUtil.GetListController(); //Nedd to check data in respwct of

            ViewBag.action_name = new List <SelectListItem>();
            ViewBag.menu_id     = menuID;
            foreach (var c in listController)
            {
                string controllerName     = c.Value;
                var    listAllAction      = STUtil.GetListAllActionByController(controllerName);
                var    listAssignedAction = (from r in db.menu_access_controller_action
                                             where r.menu_id == menuID && r.controller_name == controllerName
                                             orderby r.action_name
                                             select new SelectListItem
                {
                    Value = r.action_name,
                    Text = r.action_name,
                }).ToList();

                foreach (var aa in listAllAction)
                {
                    ControllerAction ca = new ControllerAction();
                    ca.ControllerName = controllerName;
                    ca.ActionName     = aa.Text;
                    ca.IsAssigned     = listAssignedAction.Where(a => a.Text == aa.Text).Count() > 0 ? true : false;
                    list.Add(ca);
                }
            }
            return(PartialView("_MenuRoleAction", list));
        }
예제 #2
0
        public ActionResult UserIndex(string id)
        {
            int company_id = SessionUtil.GetCompanyID();
            var roleList   = db.roles.Where(x => x.is_public && x.is_active && x.company_id == company_id).ToList();

            return(View(roleList));
        }
예제 #3
0
        public ActionResult LoadJobDetail(int id)
        {
            job obj = new job();

            if (id > 0)
            {
                obj = db.jobs.Find(id);
            }
            user u          = new user();
            var  JobAssData = db.job_assignment.AsEnumerable().Where(x => x.job_id == obj.job_id).ToList();
            int  company_id = SessionUtil.GetCompanyID();

            u.company_id               = company_id;
            ViewBag.payment_term_id    = new SelectList(db.payment_term.AsEnumerable().Where(x => x.is_active), "payment_term_id", "payment_term_name");
            ViewBag.job_type_id        = new SelectList(jobUtil.GetJobType(), "Value", "Text", obj != null ? obj.job_type_id : 0);
            ViewBag.job_status_id      = new SelectList(jobUtil.GetJobStatus(), "Value", "Text", obj != null ? obj.job_status_id : 0);
            ViewBag.client_id          = new SelectList(jobUtil.GetClient(), "Value", "Text", obj != null ? obj.client_id : 0);
            ViewBag.paper_type_id      = new SelectList(jobUtil.GetPaperType(), "Value", "Text", obj != null ? obj.paper_type_id : 0);
            ViewBag.paper_sub_type_id  = new SelectList(jobUtil.GetPaperSubType(), "Value", "Text", obj != null ? obj.paper_sub_type_id : 0);
            ViewBag.lemination_type_id = new SelectList(jobUtil.GetLeminationType(), "Value", "Text", obj != null ? obj.lemination_type_id : 0);
            ViewBag.paper_size_id      = new SelectList(jobUtil.GetPaperSizeList(), "Value", "Text", obj != null ? obj.paper_size_id : 0);
            ViewBag.printing_side_id   = new SelectList(jobUtil.GetPrintingSideList(), "Value", "Text", obj != null ? obj.printing_side_id : 0);
            ViewBag.orientation_id     = new SelectList(jobUtil.GetOrientationList(), "Value", "Text", obj != null ? obj.orientation_id : 0);
            ViewBag.user_id            = new SelectList(jobUtil.GetAssignedUsers(), "Value", "Text", JobAssData.Count() > 0 ? JobAssData.FirstOrDefault().user_id : 0);
            var tupleModel = new Tuple <job, user>(obj, u);

            return(PartialView("_JobDetail", tupleModel));
        }
예제 #4
0
        public user IsEmailExist(string emailID, int userId)
        {
            var list = db.users.AsEnumerable().Where(x => x.company_id == SessionUtil.GetCompanyID()).ToList();

            return(userId > 0 ?
                   list.AsEnumerable().Where(x => x.email_id.ToUpper() == emailID.ToUpper() && x.user_id != userId && x.company_id == SessionUtil.GetCompanyID()).FirstOrDefault()
                : list.AsEnumerable().Where(x => x.email_id.ToUpper() == emailID.ToUpper() && x.company_id == SessionUtil.GetCompanyID()).FirstOrDefault());
        }
예제 #5
0
        public ActionResult getPassword(string id)
        {
            int    user_id    = Convert.ToInt32(id);
            int    company_id = SessionUtil.GetCompanyID();
            string password   = db.USP_GetUserPassword(user_id, company_id).ToList().FirstOrDefault().password;

            return(Json(password));
        }
예제 #6
0
        public USER IsEmailExist(string emailID, int userId)
        {
            var list = db.USERs.AsEnumerable().Where(x => x.CompanyId == SessionUtil.GetCompanyID()).ToList();

            return(userId > 0 ?
                   list.AsEnumerable().Where(x => x.EmailId.ToUpper() == emailID.ToUpper() && x.UserId != userId && x.CompanyId == SessionUtil.GetCompanyID()).FirstOrDefault()
                : list.AsEnumerable().Where(x => x.EmailId.ToUpper() == emailID.ToUpper() && x.CompanyId == SessionUtil.GetCompanyID()).FirstOrDefault());
        }
 public CompanySettingController()
 {
     CompanyId   = SessionUtil.GetCompanyID();
     result      = new Result();
     companyUtil = new CompanyUtil();
     stateUtil   = new StateUtil();
     countryUtil = new CountryUtil();
     packageUtil = new PackageUtil();
 }
예제 #8
0
        public ActionResult Index(string id = "")
        {
            user user       = new user();
            int  company_id = SessionUtil.GetCompanyID();

            ViewBag.role_bit = new SelectList(RoleUtil.GetParentRoleBitByCompany(company_id), "Value", "Text");
            user.company_id  = company_id;
            return(View(user));
        }
예제 #9
0
 public IList <SelectListItem> ParentUserList(int roleBit)
 {
     return((from c in db.USERs.AsEnumerable()
             where c.CompanyId == SessionUtil.GetCompanyID() && c.RoleBit == roleBit
             select new SelectListItem
     {
         Value = c.UserId.ToString(),
         Text = c.FirstName,
     }).OrderBy(x => x.Text).ToList());
 }
        // GET: /CompanySetting/
        public ActionResult EditCompany(string id = "")
        {
            STUtil.SetSessionValue(UserInfo.pageTitle.ToString(), "Company Setting");
            int     company_id = (Int32)SessionUtil.GetCompanyID();
            company company    = db.companies.Find(company_id);

            ViewBag.Title = "Company Edit";
            ViewBag.id    = company != null ? company.company_id : 0;
            return(View());
        }
예제 #11
0
 public IList <SelectListItem> ParentUserList(int roleBit)
 {
     return((from c in db.users.AsEnumerable()
             where c.company_id == SessionUtil.GetCompanyID() && c.role_bit == roleBit
             select new SelectListItem
     {
         Value = c.user_id.ToString(),
         Text = c.user_name
     }).OrderBy(x => x.Text).ToList());
 }
예제 #12
0
        public ActionResult Index()
        {
            user user       = new user();
            int  company_id = SessionUtil.GetCompanyID();

            user.company_id         = company_id;
            ViewBag.payment_term_id = new SelectList(db.payment_term.AsEnumerable().Where(x => x.is_active), "payment_term_id", "payment_term_name");

            return(View(user));
        }
예제 #13
0
 public IList<SelectListItem> GetJobStatus()
 {
     var CompanyId = SessionUtil.GetCompanyID();
     var list = (from li in db.job_status.AsEnumerable()
                 where li.company_id == CompanyId && li.is_active
                 select new SelectListItem
                 {
                     Text = li.job_status_name,
                     Value = li.job_status_id.ToString()
                 }).ToList();
     return list;
 }
예제 #14
0
 public IList<SelectListItem> GetLeminationType()
 {
     var CompanyId = SessionUtil.GetCompanyID();
     var list = (from li in db.lemination_type.AsEnumerable()
                 where li.company_id == CompanyId && li.is_active
                 select new SelectListItem
                 {
                     Text = li.lemination_type_name,
                     Value = li.lemination_type_id.ToString()
                 }).ToList();
     return list;
 }
예제 #15
0
 public List<SelectListItem> GetOrientationList()
 {
     int companyId = (Int32)SessionUtil.GetCompanyID();
     var list = (from c in db.orientations.AsEnumerable()
                 where c.company_id == companyId && c.is_active
                 select new SelectListItem
                 {
                     Text = c.orientation_name,
                     Value = c.orientation_id.ToString(),
                 }).ToList();
     return list;
 }
예제 #16
0
 public IList<SelectListItem> GetAssignedUsers()
 {
     var CompanyId = SessionUtil.GetCompanyID();
     var list = (from li in db.users.AsEnumerable()
                 where li.role_bit == Convert.ToInt32(Role.Manager) || li.role_bit == Convert.ToInt32(Role.Operator) && li.company_id == CompanyId && li.is_active
                 select new SelectListItem
                 {
                     Text = li.user_name,
                     Value = li.user_id.ToString()
                 }).ToList();
     return list;
 }
예제 #17
0
        public List <SelectListItem> GetPaymentTermList()
        {
            int companyId = (Int32)SessionUtil.GetCompanyID();
            var list      = (from c in db.payment_term.AsEnumerable()
                             where c.company_id == companyId && c.is_active
                             select new SelectListItem
            {
                Text = c.payment_term_name,
                Value = c.payment_term_id.ToString(),
            }).ToList();

            return(list);
        }
예제 #18
0
        public List <SelectListItem> GetEmailOwnerList()
        {
            int companyId = (Int32)SessionUtil.GetCompanyID();
            var list      = (from c in db.users.AsEnumerable()
                             where c.company_id == companyId
                             select new SelectListItem
            {
                Text = c.user_name + "(" + c.email_id + ")",
                Value = c.email_id.ToString(),
            }).ToList();

            return(list);
        }
        public Result PostCompanyCreateEdit(COMPANY company, string userName, string loginID, string emailID, string mobile, string gender, string password, HttpPostedFileBase company_logo)
        {
            try
            {
                int userID = SessionUtil.GetUserID();
                if (company.CompanyId > 0)
                {
                    var tempCompanyId = SessionUtil.GetCompanyID();

                    COMPANY data = new COMPANY();
                    data                = db.COMPANies.Find(company.CompanyId);
                    data.CompanyName    = company.CompanyName;
                    data.ContactNumber  = company.ContactNumber;
                    data.CityId         = company.CityId;
                    data.GSTN           = company.GSTN;
                    data.CTSNumber      = company.CTSNumber;
                    data.CompanyAddress = company.CompanyAddress;
                    data.ContactPerson  = company.ContactPerson;
                    data.EmailId        = company.EmailId;
                    data.PAN            = company.PAN;
                    data.LogoImage      = company_logo != null ? company.LogoImage : data.LogoImage;
                    data.IsActive       = company.IsActive;

                    int sessionComId = (Int32)SessionUtil.GetCompanyID();

                    db.Entry(data).State = System.Data.Entity.EntityState.Modified;

                    BaseUtil.SetSessionValue(UserInfo.CompanyID.ToString(), company.CompanyId.ToString());

                    db.SaveChanges();

                    BaseUtil.SetSessionValue(UserInfo.CompanyID.ToString(), sessionComId.ToString());
                    result.Message = string.Format(BaseConst.MSG_SUCCESS_UPDATE, "Company");
                    result.Id      = company.CompanyId;
                }
                else
                {
                    db.COMPANies.Add(company);
                    db.SaveChanges();
                    result.Message     = string.Format(BaseConst.MSG_SUCCESS_CREATE, "Company");
                    result.MessageType = MessageType.Success;
                    result.Id          = company.CompanyId;
                }
            }
            catch (Exception ex)
            {
                result.MessageType = MessageType.Error;
                result.Message     = ex.Message;
            }
            return(result);
        }
        public ActionResult CompanyHolidayList(string id)
        {
            var list = db.company_holiday.AsEnumerable().Where(x => x.company_id == SessionUtil.GetCompanyID()).ToList();
            var data = (from li in list
                        select new
            {
                company_holiday_id = li.company_holiday_id,
                holiday_name = li.holiday_name,
                holiday_date = DateTime.ParseExact(li.holiday_date.ToShortDateString(), "dd/mm/yyyy", null).ToString("mm/dd/yyyy"),
                is_active = li.is_active,
            }).ToList();

            return(Json(data));
        }
예제 #21
0
        public ActionResult JobAssignUsersList(int id)
        {
            var Company_id = SessionUtil.GetCompanyID();
            var list       = (from li in db.job_assignment.AsEnumerable()
                              where li.job_id == id && li.company_id == Company_id && li.is_active
                              select new
            {
                user_name = li.user.user_name,
                is_active = li.is_active,
                job_assignment_id = li.job_assignment_id,
            }).ToList();

            return(Json(list));
        }
예제 #22
0
        public ActionResult GetMenuCategory(string id)
        {
            string[] treeobj       = { "parent", "Text" };
            var      snag_type_sla = db.MENU_CATEGORY.AsEnumerable().Where(x => x.CompanyId == SessionUtil.GetCompanyID()).ToList();
            var      list          = (
                from sla in snag_type_sla
                where sla.CompanyId == SessionUtil.GetCompanyID()
                select new
            {
                id = sla.MenuCategoryId,
                parent = (sla.PerentMenuCategoryId != null ? Convert.ToString(sla.PerentMenuCategoryId) : "#"),
                text = sla != null ? sla.MenuCategoryName + "-" + sla.SequenceOrder:"",
                selected = false
            }).Distinct().ToList();
            List <object> Arraylist = treeobj.ToList <object>();

            return(Json(list));
        }
예제 #23
0
        public ActionResult ClientList()
        {
            var CompanyId = SessionUtil.GetCompanyID();
            var data      = (from list in db.users.AsEnumerable()
                             where list.role_bit == (Int32)Role.Client && list.company_id == CompanyId
                             select new
            {
                user_id = list.user_id,
                user_name = list.user_name,
                email_id = list.email_id,
                gstin = list.gstin_numer,
                mobile = list.mobile,
                gender = list.gender,
                is_active = list.is_active,
            }).ToList();

            return(Json(data));
        }
예제 #24
0
        public ActionResult UsersList(string id)
        {
            int CompanyId = SessionUtil.GetCompanyID();
            //int rolebit = Convert.ToInt32(id);
            IList <user> list = db.users.AsEnumerable().Where(x => x.company_id == CompanyId && x.role_bit != 8 && x.role_bit > 2).ToList();
            var          data = (from li in list
                                 select new
            {
                user_id = li.user_id,
                user_name = li.user_name,
                email_id = li.email_id,
                mobile = li.mobile,
                gender = li.gender,
                RoleName = li.role.role_name,
                is_active = li.is_active,
            }).ToList();

            return(Json(data));
        }
예제 #25
0
        public ActionResult UsersList(string id)
        {
            int          rolebit = Convert.ToInt32(db.ROLEs.Find(Convert.ToInt32(id)).RoleBit);
            IList <USER> list    = db.USERs.AsEnumerable().Where(x => x.CompanyId == SessionUtil.GetCompanyID() && x.RoleBit == rolebit).ToList();
            var          data    = (from li in list
                                    select new
            {
                user_id = li.UserId,
                user_name = li.FirstName,
                email_id = li.EmailId,
                mobile = li.Mobile,
                gender = li.Gender,
                is_active = li.IsActive,
                team_count = 0,
                unit_count = 0,
            }).ToList();

            return(Json(data));
        }
예제 #26
0
        public ActionResult EmailSettingsList(int id)
        {
            var list = db.email_setting.AsEnumerable().ToList();
            //list = list.Where(x => x.email_setting_type.is_public).ToList();
            var data = (from li in list
                        where li.company_id == SessionUtil.GetCompanyID() && li.user_id == SessionUtil.GetUserID()
                        select new
            {
                email_setting_id = li.email_setting_id,
                from_email_id = li.from_email_id,
                from_email_name = li.from_email_name,
                email_user_name = li.email_user_name,
                email_setting_type_name = li.email_setting_type.email_setting_type_name,
                is_public = li.email_setting_type.is_public,
                is_active = li.is_active,
                company_id = li.company_id,
                created_date = li.created_date,
                created_by = li.created_by,
                updated_date = li.updated_date,
                updated_by = li.updated_by,
            }).ToList();

            return(Json(data));
        }
예제 #27
0
        public ActionResult CompanyList()
        {
            //// var path = BaseUtil.GetWebConfigValue("SNAG_AWS_S3");
            int role      = SessionUtil.GetRoleBit();
            int companyId = SessionUtil.GetCompanyID();
            var list      = db.COMPANies.AsEnumerable().ToList();

            if (role != Convert.ToInt32(Role.SuperAdmin))
            {
                list = list.AsEnumerable().Where(x => x.CompanyId == companyId).ToList();
            }
            var data = (from li in list
                        select new
            {
                company_id = li.CompanyId,
                CompanyName = li.CompanyName,
                EmailId = li.EmailId,
                address = li.CompanyAddress,
                image = string.IsNullOrEmpty(li.LogoImage) ? "~/Base/Content/images/NA.jpg" : li.LogoImage,
                is_active = li.IsActive,
            }).ToList();

            return(Json(data));
        }
예제 #28
0
        public ActionResult JobList(string id)
        {
            var JobAss     = db.job_assignment.AsEnumerable().Where(x => x.company_id == SessionUtil.GetCompanyID()).ToList();
            var Company_Id = SessionUtil.GetCompanyID();
            var data       = (from li in db.jobs.AsEnumerable()
                              where li.is_active
                              select new
            {
                job_id = li.job_id,
                job_type_name = li.job_type.job_type_name,
                client_name = li.user.user_name,
                paper_type_name = li.paper_type.paper_type_name,
                paper_sub_type_name = li.paper_sub_type.paper_sub_type_name,
                lemination_type_name = li.lemination_type.lemination_type_name,
                job_status_name = li.job_status.job_status_name,
                quantity = li.quantity,
                job_code = li.job_code,
                price = li.price,
                AssignTo = JobAss.Where(x => x.job_id == li.job_id).Count() > 0 ? JobAss.Where(x => x.job_id == li.job_id).FirstOrDefault().user.user_name : "",
                is_active = li.is_active,
            }).ToList();

            return(Json(data));
        }
예제 #29
0
        public ActionResult CreateEdit(string id, string rolid)
        {
            int         role_bit    = Convert.ToInt32(db.roles.Find(Convert.ToInt32(rolid)).role_bit);
            role        parentrole  = new role();
            role        parentrole2 = new role();
            List <user> userlist    = new List <user>();
            int         company     = Convert.ToInt32(SessionUtil.GetCompanyID());

            parentrole  = db.roles.SingleOrDefault(x => x.role_bit == role_bit && x.company_id == company);
            parentrole2 = db.roles.SingleOrDefault(x => x.role_id == parentrole.parent_id && x.company_id == company);
            //userlist = db.users.Where(x => x.role_bit == parentrole2.role_bit && x.company_id == company).ToList();
            user u = new user();

            u.role_bit = role_bit;
            if (parentrole2 != null)
            {
                var data = (from c in db.users.AsEnumerable()
                            where c.company_id == company && c.role_bit == parentrole2.role_bit
                            select new SelectListItem
                {
                    Text = c.user_name,
                    Value = c.user_id.ToString(),
                }).OrderBy(x => x.Text).ToList();
                if (id != null && id != "")
                {
                    ViewBag.Title = "User Edit";
                    u             = db.users.Find(Convert.ToInt32(id));
                    string Pass = db.USP_Decrypt_TEXT(u.password).ToString();
                    ViewBag.Password       = Pass;
                    ViewBag.parent_user_id = new SelectList(data, "Value", "Text", u.parent_user_id);
                }
                else
                {
                    ViewBag.parent_user_id = new SelectList(data, "Value", "Text", 0);
                }
            }
            else
            {
                var data = (from c in db.users.AsEnumerable()
                            where c.company_id == company
                            select new SelectListItem
                {
                    Text = c.user_name,
                    Value = c.user_id.ToString(),
                }).OrderBy(x => x.Text).ToList();
                if (id != null && id != "")
                {
                    ViewBag.Title = "User Edit";
                    u             = db.users.Find(Convert.ToInt32(id));
                    string Pass = db.USP_Decrypt_TEXT(u.password).ToString();
                    ViewBag.Password       = Pass;
                    ViewBag.parent_user_id = new SelectList(data, "Value", "Text", u.parent_user_id);
                }
                else
                {
                    ViewBag.parent_user_id = new SelectList(data, "Value", "Text", 0);
                }
                //ViewBag.parent_user_id = (from c in db.users.AsEnumerable()
                //                          where c.company_id == company && c.role_bit == parentrole2.role_bit
                //                          select new SelectListItem
                //                          {
                //                              Value = c.user_id.ToString(),
                //                              Text = c.user_name

                //                          }).OrderBy(x => x.Text).ToList();
            }
            ViewBag.rol_id = rolid;
            //ViewBag.parent_user_id = new SelectList(userlist, "Value", "Text");
            int roleBit = 0;

            //List<SelectListItem> plist = (from c in db.users.AsEnumerable()
            //                         where c.company_id == company && c.role_bit == parentrole2.role_bit
            //                         select new SelectListItem
            //                         {
            //                             Value = c.user_id.ToString(),
            //                             Text = c.user_name

            //                         }).OrderBy(x => x.Text).ToList();
            //ViewBag.parent_user_id = new SelectList(plist, "Value", "Text", u.parent_user_id);
            //else
            //{
            //    if (rolid != null && rolid != "")
            //    {
            //        u.role_bit = Convert.ToInt32(db.roles.Find(rol_id).role_bit);
            //        roleBit = u.role_bit;
            //    }
            //    ViewBag.Title = "User Create";
            //}
            //ViewBag.rol_id = rolid;
            //ViewBag.IsParentDDL = userUtil.IsParentDDL(rol_id);
            //if (userUtil.IsParentDDL(rol_id))
            //{
            //    ViewBag.parent_user_id = new SelectList(userUtil.ParentUserList(roleBit), "Value", "Text", u != null ? u.parent_user_id : 0);
            //}
            return(View(u));
        }
예제 #30
0
        public ActionResult CreateEdit(user user, FormCollection frm, HttpPostedFileBase user_photo)
        {
            try
            {
                string rol_id = frm["rol_id"];
                if (user_photo != null)
                {
                    string AWSProfileName    = BaseUtil.GetWebConfigValue("AWSProfileName");
                    string GenFileName       = BaseUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + SessionUtil.GetCompanyID().ToString() + "_" + Path.GetFileName(user_photo.FileName).Replace(" ", "_");
                    String companyFolderName = BaseUtil.GetSessionValue(UserInfo.CompanyFolderName.ToString()).ToString().Replace("/", "");
                    AWSUtil.UploadFile(user_photo.InputStream, AWSProfileName, companyFolderName, GenFileName);

                    user.user_photo = GenFileName;
                }
                else
                {
                    user.user_photo = user.gender + ".JPG";
                }
                result              = userUtil.PostCreateEdit(user, frm);
                ViewBag.Title       = user == null ? "User Create" : "User Edit";
                ViewBag.action_name = BaseUtil.GetListAllActionByController("");
                switch (result.MessageType)
                {
                case MessageType.Success:
                    return(RedirectToAction("Index", "User", new { id = rol_id, Result = result.Message, MessageType = result.MessageType }));

                default:
                    return(RedirectToAction("CreateEdit", "User", new { id = user.user_id, Result = result.Message, MessageType = result.MessageType }));
                }
                return(View(user));
            }
            catch (Exception ex)
            {
                return(View(user));
            }
        }