示例#1
0
        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());
        }
示例#2
0
 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);
         var companyEdit = db.companies.Find(company.company_id);
         //if (company_logo != null)
         //{
         //    string fileName = string.Empty;
         //
         //    String companyFolderName = companyEdit.company_folder_name.Replace("/", "");
         //    fileName = company.company_logo;
         //    var path = Path.Combine(Server.MapPath("~/Files/" + companyFolderName), fileName);
         //    company_logo.SaveAs(path);
         //}
         string GenFileName = "";
         if (company_logo != null)
         {
             GenFileName          = STUtil.GetTodayDate().ToString("yyyyMMdd") + "_" + company.company_id.ToString() + "_" + Path.GetFileName(company_logo.FileName).Replace(" ", "_");
             company.company_logo = GenFileName;
         }
         UploadFile(companyEdit.company_folder_name, company_logo, GenFileName);
         STUtil.SetSessionValue(UserInfo.IsCompanySetup.ToString(), "1");
     }
     catch (Exception ex)
     {
         STUtil.SetSessionValue(UserInfo.IsCompanyAddUpdate.ToString(), "1");
         result.Message = ex.Message;
     }
     return(RedirectToAction("Index", "Company", new { 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 }));
 }