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)); }
public ActionResult AddCompany(COMPANY company, FormCollection frmUser, HttpPostedFileBase company_logo) { try { string userName = frmUser["user_name"]; string loginID = frmUser["login_id"]; string emailID = frmUser["email_id"]; string mobile = frmUser["mobile"]; string password = frmUser["password"]; string gender = frmUser["gender"]; if (company_logo != null) { #region Attache Documents string fileName = string.Empty; List <String> arrfileName = new List <String>(); int loop = 0; // Verify that the user selected a file if (company_logo != null && company_logo.ContentLength > 0) { // extract only the fielname fileName = Guid.NewGuid() + "_" + SessionUtil.GetUserID() + "_" + Path.GetFileName(company_logo.FileName); fileName = System.DateTime.Now.Millisecond.ToString() + Path.GetFileName(company_logo.FileName); var path = Path.Combine(Server.MapPath("~/Files/"), fileName); company_logo.SaveAs(path); arrfileName.Add(fileName); } else { arrfileName.Add("NA.JPG"); } loop++; company.LogoImage = arrfileName[0].ToString(); #endregion string GenFileName = BaseUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + SessionUtil.GetRoleBit().ToString() + "_" + Path.GetFileName(company_logo.FileName).Replace(" ", "_"); /// CompanyInformation.company_logo = GenFileName; } BaseUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1"); Session["a"] = 1; result = companyUtil.PostCompanyCreateEdit(company, userName, loginID, emailID, mobile, gender, password, company_logo); BaseUtil.SetSessionValue(UserInfo.IsCompanySetup.ToString(), "1"); return(RedirectToAction("CompanyTabs", new { id = result.Id, Result = result.Message, MessageType = result.MessageType })); } catch (Exception ex) { BaseUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1"); result.Message = ex.Message; } return(View()); }