public ActionResult CreateEditJobAttachment() { job_attachment job_attachment = new job_attachment(); try { job_attachment.job_id = Convert.ToInt32(Request["job_id"] != "" ? Request["job_id"] : "0"); job_attachment.client_id = Convert.ToInt32(Request["client_id"] != "" ? Request["client_id"] : "0"); job_attachment.description = Request["description"] != null ? Request["description"] : ""; job_attachment.is_active = Convert.ToBoolean(Request["is_active"]); HttpFileCollectionBase files = Request.Files; HttpPostedFileBase attachment = files.Count > 0 ? files[0] : null; if (job_attachment != null) { string GenFileName = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + Path.GetFileName(attachment.FileName).Replace(" ", "_"); String companyFolderName = SessionUtil.GetCompanyFolderName(); companyFolderName = companyFolderName.Replace("/", ""); UploadFile(companyFolderName, attachment, GenFileName); job_attachment.job_attachment1 = GenFileName; } else { job_attachment.job_attachment1 = ""; } } catch (Exception ex) { result.Message = ex.Message; result.MessageType = MessageType.Error; } result = jobUtil.PostCreateEditJobAttachment(job_attachment); return(Json(result)); }
public ActionResult CreateEditClient(user user, HttpPostedFileBase user_photo, FormCollection frmAdminUser) { var isRole = frmAdminUser["IsJob"]; var JobId = frmAdminUser["hdnJobId"] == ""?0:Convert.ToInt32(frmAdminUser["hdnJobId"]); try { user.role_bit = (Int32)Role.Client; user.role_id = db.roles.AsEnumerable().Where(x => x.role_bit == (Int32)Role.Client && x.company_id == (Int32)SessionUtil.GetCompanyID()).FirstOrDefault().role_id; var role = db.roles.AsEnumerable().Where(x => x.company_id == user.company_id && x.role_bit == (Int32)Role.Client && x.is_active).ToList(); user.role_id = role.Count > 0 ? role.Select(x => x.role_id).FirstOrDefault() : 0; var userdata = db.users.Find(user.user_id); company CompanyInformation = db.companies.Find(user.company_id); if (user_photo != null) { string AWSProfileName = STUtil.GetWebConfigValue("AWSProfileName"); string GenFileName = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + CompanyInformation.company_id.ToString() + "_" + Path.GetFileName(user_photo.FileName).Replace(" ", "_"); String companyFolderName = CompanyInformation.company_folder_name.ToString().Replace("/", ""); //// AWSUtil.UploadFile(user_photo.InputStream, AWSProfileName, companyFolderName, GenFileName); user.user_photo = GenFileName; UploadFile(SessionUtil.GetCompanyFolderName().ToString(), user_photo); } else { user.user_photo = userdata != null ? userdata.user_photo : "NA.jpg"; } user.parent_user_id = SessionUtil.GetUserID(); result = userUtil.PostUserEdit(user); } catch (Exception ex) { result.Message = ex.Message; result.MessageType = MessageType.Error; } if (string.IsNullOrEmpty(isRole)) { return(RedirectToAction("Index", "Client", new { Result = result.Message, MessageType = result.MessageType })); } else { return(RedirectToAction("CreateEditJob", "Job", new { id = JobId, Result = result.Message, MessageType = result.MessageType })); } }
public ActionResult AddCompany(company company, HttpPostedFileBase company_logo, FormCollection frmUser) { try { string AWSProfileName = STUtil.GetWebConfigValue("AWSProfileName"); 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"]; STUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1"); result = companyUtil.PostCompanyCreateEdit(company, company_logo, userName, loginID, emailID, mobile, gender, password); UploadFile(SessionUtil.GetCompanyFolderName().ToString(), company_logo); STUtil.SetSessionValue(UserInfo.IsCompanySetup.ToString(), "1"); } catch (Exception ex) { STUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1"); result.Message = ex.Message; } return(RedirectToAction("EditCompany", "CompanySetting", new { Result = result.Message, MessageType = result.MessageType })); }
public ActionResult EditProfile(user user, HttpPostedFileBase user_photo) { try { if (user_photo != null) { string AWSProfileName = STUtil.GetWebConfigValue("AWSProfileName"); string GenFileName = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + SessionUtil.GetCompanyID().ToString() + "_" + Path.GetFileName(user_photo.FileName).Replace(" ", "_"); String companyFolderName = STUtil.GetSessionValue(UserInfo.CompanyFolderName.ToString()).ToString().Replace("/", ""); UploadFile(SessionUtil.GetCompanyFolderName().ToString(), user_photo); user.user_photo = GenFileName; } else { } result = userUtil.PostProfileEdit(user); ViewBag.action_name = STUtil.GetListAllActionByController(""); switch (result.MessageType) { case MessageType.Success: STUtil.SetSessionValue(UserInfo.FullName.ToString(), Convert.ToString(user.user_name)); STUtil.SetSessionValue(UserInfo.Mobile.ToString(), Convert.ToString(user.mobile)); STUtil.SetSessionValue(UserInfo.UserPhoto.ToString(), Convert.ToString(user.user_photo)); STUtil.SetSessionValue(UserInfo.Gender.ToString(), Convert.ToString(user.gender)); return(RedirectToAction("MyProfile", "MyProfile", new { Result = result.Message, MessageType = result.MessageType })); default: return(RedirectToAction("MyProfile", "MyProfile", new { Result = result.Message, MessageType = result.MessageType })); } return(View(user)); } catch { return(View(user)); } }
public ActionResult CompanyList() { var path = RoleUtil.IsInRole(Role.SuperAdmin)?STUtil.GetWebConfigValue("SystemImagePath"):SessionUtil.GetCompanyFolderName().ToString(); //var list = db.companies.Where(x => x.parent_company_id != null).AsEnumerable().ToList(); var list = db.companies.AsEnumerable().ToList(); var data = (from li in list select new { company_id = li.company_id, business_name = li.business_name, admin_user_name = li.admin_user_name, address = li.state != null ? li.address + ", " + li.city + ", " + li.zip + ", " + li.state.state_name + ", " + li.state.country.country_name : "", image = AWSUtil.GetFileURL(li.company_logo, li.company_folder_name), is_active = li.is_active, }).ToList(); return(Json(data)); }