Exemplo n.º 1
0
        private COMPANY CreateCompany(GMEntities context, Company company, int newUserId)
        {
            var gmCompany = new COMPANY
            {
                NAME            = company.Name,
                ADDRESS_LINE_1  = company.AddressLine1,
                ADDRESS_LINE_2  = company.AddressLine2,
                SUBURB          = company.Subarb,
                POST_CODE       = company.PostCode,
                COUNTRY         = company.Country,
                PHONE           = company.Phone,
                ABN             = company.Abn,
                ACCOUNT_NO      = RandomToken.GenerateDigitsOnly(11),
                BSB             = GlobalSettings.Instance.Bsb,
                IS_ACTIVE       = company.IsActive,
                IS_ADMIN        = company.IsAdmin,
                IS_DELETED      = company.IsDeleted,
                CR_BY           = company.CrBy,
                CR_AT           = company.CrAt,
                UP_BY           = company.UpBy,
                UP_AT           = company.UpAt,
                LOGO_PATH       = company.LogoPath,
                AGREEMENT_DATE  = company.AgreementDate,
                AGREEMENT_PATH  = company.AgreementPath,
                EMAIL           = company.Email,
                CONTACT_USER_ID = newUserId,
                GUID            = Guid.NewGuid(),
                ADMIN_FEE       = company.AdminFee
            };

            context.COMPANies.Add(gmCompany);
            context.SaveChanges();
            return(gmCompany);
        }
Exemplo n.º 2
0
        public SQMMetricMgr CreateNew(COMPANY company, string perspective, DateTime fromDate, DateTime toDate, int addFromYear, decimal[] plantArray)
        {
            this.Company     = company;
            this.perspective = perspective;
            this.FromDate    = fromDate;
            this.ToDate      = toDate;
            this.AddFromYear = addFromYear;
            this.PlantArray  = plantArray;
            this.ObjAny      = null;

            if (company.COMPANY_ID > 0 && company.FYSTART_MONTH.HasValue)
            {
                this.FYStartMonth = (int)company.FYSTART_MONTH;
            }
            else
            {
                this.FYStartMonth = 1;
            }

            if (SessionManager.SessionContext != null)
            {
                this.TargetsCtl = new TargetCalcsMgr().CreateNew(this.Company.COMPANY_ID, SessionManager.FYStartDate(), toDate);
            }

            return(this);
        }
Exemplo n.º 3
0
        public IHttpActionResult GetCompanyByID(string id)
        {
            CompanyEntity companyEntity = new CompanyEntity();
            ResultEntity  result        = new ResultEntity();

            try
            {
                COMPANY temp = dal.FindCompanyByID(new Guid(id));
                companyEntity = temp.ToCompanyEntity();
                if (temp.COMPANY1 != null)
                {
                    companyEntity.SubCompanies = temp.COMPANY1.ToList <COMPANY>().ConvertAll <CompanyEntity>(c => c.ToCompanyEntity());
                }
                if (temp.COMPANY2 != null)
                {
                    companyEntity.ParentCompany = temp.COMPANY2.ToCompanyEntity();
                }
                if (temp.USERs != null)
                {
                    companyEntity.Users = temp.USERs.ToList <USER>().ConvertAll <UserEntity>(u => u.ToUserEntity());
                }
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                NtripProxyLogger.LogExceptionIntoFile("调用接口api/Company/GetCompanyByID/{id}异常,异常信息为:" + e.Message);
            }

            result.IsSuccess = result.Message == null;
            result.Data      = companyEntity;
            return(Json <ResultEntity>(result));
        }
Exemplo n.º 4
0
        protected void dxgvSerial_HtmlRowCreated(object sender, DevExpress.Web.ASPxGridViewTableRowEventArgs e)
        {
            if (e.RowType == DevExpress.Web.GridViewRowType.Data)
            {
                Label  lbl       = dxgvSerial.FindRowCellTemplateControl(e.VisibleIndex, null, "lblBranchName") as Label;
                string strCoCode = e.GetValue("CO_CODE").ToString();
                if (lbl != null && strCoCode != string.Empty)
                {
                    using (COMPANY_BO objT24_COMPANY_BO = new COMPANY_BO())
                    {
                        COMPANY objT24_COMPANY = objT24_COMPANY_BO.GetByCOMPANY_CODE(strCoCode);
                        if (objT24_COMPANY != null)
                        {
                            lbl.Text = objT24_COMPANY.COMPANY_NAME;
                        }
                    }
                }

                Label lbl2 = dxgvSerial.FindRowCellTemplateControl(e.VisibleIndex, null, "lblStatus") as Label;
                if (lbl2 != null)
                {
                    if (e.GetValue("IsUsed") != null)
                    {
                        bool strStatus = Convert.ToBoolean(e.GetValue("IsUsed"));

                        if (strStatus)
                        {
                            lbl2.Text = "Đã cấp mã";
                        }
                        else
                        {
                            lbl2.Text = "Đã xóa";
                        }
                    }
                    else
                    {
                        lbl2.Text = "Đã cấp mã";
                    }
                }

                Label lbl3 = dxgvSerial.FindRowCellTemplateControl(e.VisibleIndex, null, "lblMaDuThuong") as Label;
                if (lbl3 != null)
                {
                    if (e.GetValue("Serials") != null)
                    {
                        string strSerials = e.GetValue("Serials").ToString();
                        if (!string.IsNullOrEmpty(strSerials))
                        {
                            strSerials = Common.FormatSerial(strSerials.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries).ToList());
                        }

                        lbl3.Text = strSerials;
                    }
                    else
                    {
                        lbl3.Text = string.Empty;
                    }
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 送检单位下拉框数据带出
        /// </summary>
        /// <returns></returns>
        public COMPANY GetVasedate(string COMPANYNAME)
        {
            string        search        = null;
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("[");
            int i = 0;

            using (SysEntities db = new SysEntities())
            {
                var queryData = repository.GetData(db, "DESC", "CREATETIME", search);//调用GetData方法从数据库中获取到相关数据
                int a         = queryData.Count();
                if (queryData != null)
                {
                    COMPANY cOMPANY = queryData.Where(m => m.COMPANYNAME == COMPANYNAME).FirstOrDefault();

                    return(new COMPANY()
                    {
                        COMPANYADDRES = cOMPANY.COMPANYADDRES,
                        CONTACTS = cOMPANY.CONTACTS,
                        CONTACTSNUMBER = cOMPANY.CONTACTSNUMBER,
                        FAX = cOMPANY.FAX
                    });
                }
            }
            return(new COMPANY());
        }
Exemplo n.º 6
0
        private static void Main()
        {
            CompanyEntity c = new CompanyEntity();

            c.Create("Admin");
            c.Id = Guid.NewGuid();
            Guid id = Guid.Empty;

            c.NameInKhmer   = "Test";
            c.NameInEnglish = "Test";
            c.Email         = "Test";
            c.Phone         = "Test";
            c.Location      = "Test";
            c.Logo          = new byte[0];
            //CompanyDao.Insert(c);
            MANAGE_ROLE.LoadRole();
            bool a = MANAGE_ROLE.ALLOW_ADD_COMPANY;
            bool b = MANAGE_ROLE.ALLOW_EDIT_COMPANY;

            COMPANY.Load_Company();
            USER.Load_User();
            MANAGE_ROLE.LoadRole();
            //MessageBox.Show(new DateTime(2025, 6, 25).DayOfWeek.ToString());
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
Exemplo n.º 7
0
 public HttpResponseMessage CreateCompany(CompanyModel _CompanyModel)
 {
     try
     {
         COMPANY com = new COMPANY();
         com.CREATION_TYPE = _CompanyModel.CREATION_TYPE;
         com.CREATION_DATE = _CompanyModel.CREATED_DATE;
         com.COMPANY_NAME  = _CompanyModel.COMPANY_NAME;
         com.ADDRESS       = _CompanyModel.ADDRESS;
         com.COUNTRY       = _CompanyModel.COUNTRY;
         com.POSTCODE      = _CompanyModel.POSTCODE;
         com.TELEPHONE     = _CompanyModel.TELEPHONE;
         com.FAX           = _CompanyModel.FAX;
         com.WEBSITE       = _CompanyModel.WEBSITE;
         //com.COMPANY_STATUS = _CompanyModel.COMPANY_STATUS;
         //com.COMPANY_TYPE = _CompanyModel.COMPANY_TYPE;
         //com.START_YEAR = _CompanyModel.START_YEAR;
         //com.START_FIN_YEAR = _CompanyModel.START_FIN_YEAR;
         //com.END_FIN_YEAR = _CompanyModel.END_FIN_YEAR;
         com.IS_DELETE = false;
         db.COMPANies.Add(com);
         db.SaveChanges();
     }
     catch (Exception)
     {
         throw;
     }
     return(Request.CreateResponse(HttpStatusCode.OK, "success"));
 }
Exemplo n.º 8
0
        static void GetDataByJumony()
        {
            Console.WriteLine("开始跑数据");

            var db = DB.GetInstance();

            for (var i = 1; i < 51; i++)
            {
                try
                {
                    var path = "http://cn.coovee.com/company/s1.html?p=" + i.ToString();

                    IHtmlDocument source = new JumonyParser().LoadDocument(path, System.Text.Encoding.GetEncoding("utf-8"));

                    var company = source.Find(".company-l-item");
                    Console.WriteLine(company.Count());
                    foreach (var item in company)
                    {
                        try
                        {
                            var a = item.Find(".dt h4 a").FirstOrDefault();

                            Console.WriteLine("公司名=" + a.InnerText());
                            var span = item.Find(".dt p span").FirstOrDefault();
                            Console.WriteLine("联系人=" + span.InnerText());
                            var zhuying = item.Find(".dd p").FirstOrDefault();
                            Console.WriteLine("主营=" + zhuying.InnerText().Replace("主营:", ""));

                            var url = item.Find(".dd ul li").Last().Find("a").FirstOrDefault().Attribute("href").Value();
                            Console.WriteLine(url);
                            System.Threading.Thread.Sleep(1000);
                            source = new JumonyParser().LoadDocument(url, System.Text.Encoding.GetEncoding("utf-8"));
                            var tel = source.Find(".company-contact-info p").ToList <IHtmlElement>()[1].InnerText();
                            Console.WriteLine("电话=" + tel.Replace("联系电话:", ""));
                            var adress = source.Find(".company-contact-info p").ToList <IHtmlElement>()[3].InnerText();
                            Console.WriteLine("地址=" + adress.Replace("公司地址:", "").Replace("  ", ""));


                            COMPANY comp = new COMPANY()
                            {
                                ID           = System.Guid.NewGuid().ToString(),
                                COMPANY_NAME = a.InnerText(),
                                ADDRESS      = adress.Replace("公司地址:", "").Replace("  ", ""),
                                LINK_MAN     = span.InnerText(),
                                SALE_PRODUCT = zhuying.InnerText().Replace("主营:", ""),
                                TEL          = tel.Replace("联系电话:", "")
                            };
                            db.Insertable <COMPANY>(comp).ExecuteCommand();

                            System.Threading.Thread.Sleep(2000);
                        }
                        catch
                        { }
                    }
                    System.Threading.Thread.Sleep(2000);
                }
                catch
                { }
            }
        }
Exemplo n.º 9
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);
                uclItemHdr.DisplayCompany(company);
                if (SessionManager.IsEffLocationPrimary())
                {
                    divNavArea.Visible = true;
                }
                else
                {
                    divNavArea.Visible = false;
                }

                if (ddlStatus.Items.Count == 0)
                {
                    List <Settings> status_codes = SQMSettings.Status;
                    ddlStatus.DataSource     = status_codes;
                    ddlStatus.DataTextField  = "short_desc";
                    ddlStatus.DataValueField = "code";
                    ddlStatus.DataBind();
                }

                if (string.IsNullOrEmpty(hfActiveTab.Value))
                {
                    tab_Click("lbCompanyDetail_tab", "");
                }
            }
        }
Exemplo n.º 10
0
        public Company StartNewCompanyFlow(Company company, string baseUrl)
        {
            //Email existance
            if (UserEmailExists(company.Email))
            {
#if !DEBUG
                throw new Exception("User email already exists. Please use different contact email address.");
#endif
            }

            USER    newUser    = null;
            COMPANY newCompany = null;
            // transaction started...
            using (var context = new GMEntities())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        //Contact person user creation
                        newUser = CreateCompanyUser(context, company);

                        //Company creation
                        newCompany = CreateCompany(context, company, newUser.ID);

                        company.Id          = newCompany.ID;
                        company.ContactName = newCompany.CONTACT_NAME;

                        dbContextTransaction.Commit();
                    }
                    catch (Exception ex)
                    {
                        dbContextTransaction.Rollback();
                        throw new Exception("Error occured while creating new company. Transaction rolled-back.");
                    }
                }
            }

            try
            {
                //Eamil to user
                bool emailSentToUser = SendUserEmail(newCompany, newUser, baseUrl, new Email {
                    To = company.Email
                });

                //Eamil to user
                bool emailSentToAdmin = SendAdminEmail(newCompany);


                if (!emailSentToUser || !emailSentToAdmin)
                {
                    throw new Exception("Problem in sending emails");
                }
            }
            catch (Exception)
            {
            }
            return(company);
        }
Exemplo n.º 11
0
        public ActionResult DeleteConfirmed(string id)
        {
            COMPANY cOMPANY = db.COMPANYS.Find(id);

            db.COMPANYS.Remove(cOMPANY);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 12
0
 public void DisplayCompany(COMPANY company)
 {
     pnlCompanyHdr.Visible          = true;
     lblCompanyName_out.Text        = company.COMPANY_NAME;
     lblUlDunsCode_out.Text         = company.ULT_DUNS_CODE;
     lblCompanyStatus_out.Text      = WebSiteCommon.GetStatusString(company.STATUS);
     lblCompanyUpdatedDate_out.Text = WebSiteCommon.LocalTime((DateTime)company.LAST_UPD_DT, SessionManager.UserContext.TimeZoneID).ToString();
 }
Exemplo n.º 13
0
        /// <summary>
        /// Performs the playback of actions in this module.
        /// </summary>
        /// <remarks>You should not call this method directly, instead pass the module
        /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method
        /// that will in turn invoke this method.</remarks>
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor            = 1.0;

            string sCompanyPath = string.Format(@"C:\Users\Public\Documents\Simply Accounting\{0}\Data", Variables.sSimplyVersionNumber);

            COMPANY aComp = new COMPANY();

            aComp.companyInformation.companyName = "New" + StringFunctions.RandStr("9(8)");
//              aComp.edition = EDITION.ENTERPRISE_EDITION;
//              aComp.companyInformation.Address.street1 = "100 Mobile Road";
//              aComp.companyInformation.Address.street2 = "Hollywood";
//              aComp.companyInformation.Address.city = "Richmond";
//              aComp.companyInformation.Address.provinceCode = "BC";
//              aComp.companyInformation.Address.province = "British Columbia";
//              aComp.companyInformation.Address.country = "Canada";
            aComp.companyFileLocation = sCompanyPath;

            NewCompanyWizard._SA_Create(aComp);

            // Set peferences
            UserPreferences._SA_setUserPreferences();
            Settings._SA_SetToGenericValues();
            System.Threading.Thread.Sleep(5000);

            // Settings
            Variables.globalSettings.InventorySettings.allowInventoryLevelsToGoBelowZero = true;
            Settings._SA_SetInventoryOptionSettings();
            Variables.globalSettings.ReceivableSettings.calculateLineItemDiscounts = false;
            Variables.globalSettings.ReceivableSettings.interestCharges            = true;
            System.Threading.Thread.Sleep(5000);
            Settings._SA_SetReceivablesOptionsAndDiscountSettings();

            System.Threading.Thread.Sleep(5000);

            // turn on orders/quotes
            Variables.globalSettings.CompanySettings.FeatureSettings.ordersForCustomers = true;
            Variables.globalSettings.CompanySettings.FeatureSettings.ordersForVendors   = true;
            Variables.globalSettings.CompanySettings.FeatureSettings.quotesForCustomers = true;
            Variables.globalSettings.CompanySettings.FeatureSettings.quotesForVendors   = true;
            Settings._SA_SetCompanyFeatureSettings();

            // set currencies
            Variables.globalSettings.CompanySettings.CurrencySettings.allowForeignCurrency = true;
            Variables.globalSettings.CompanySettings.CurrencySettings.HomeCurrency.roundingDifferencesAccount = "5650 Currency Exchange & Rounding";

            // have to explicitly stat 2 decimals cause it thinks data is good when in class
            Variables.globalSettings.CompanySettings.CurrencySettings.HomeCurrency.decimalPlaces = CURRENCY_DECIMAL.CURRENCY_DECIMAL_2;

            CURRENCY_DATA newCurr = new CURRENCY_DATA();

            newCurr.Currency      = "United States Dollars";
            newCurr.decimalPlaces = CURRENCY_DECIMAL.CURRENCY_DECIMAL_2;
            Variables.globalSettings.CompanySettings.CurrencySettings.ForeignCurrencies.Add(newCurr);
            Settings._SA_SetCompanyCurrencySettings();
        }
Exemplo n.º 14
0
        public ActionResult Edit(string id)
        {
            ViewBag.Id = id;
            COMPANYBLL combll = new COMPANYBLL();
            COMPANY    com    = new COMPANY();

            com = combll.GetById(id);
            return(View(com));
        }
Exemplo n.º 15
0
        //
        // GET: /Company/


        public ActionResult Index()
        {
            COMPANY company = new COMPANY("Google");

            ViewBag.Departments = new SelectList(company.Departments, "Id", "Name");
            ViewBag.CompanyName = company.CompanyName;

            return(View());
        }
Exemplo n.º 16
0
 public ActionResult Edit([Bind(Include = "IDComp,TitleComp,PhoneOffice,PhoneOwner,StreetComp,CountyComp,ZipcodeComp,EmailComp,WebsiteComp,PartPayeBraid,IDOwnerBraider,CostHairDeduct,PercentBrader,PriceTakeOff")] COMPANY cOMPANY)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cOMPANY).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(cOMPANY));
 }
Exemplo n.º 17
0
        /// <summary>
        /// 通过ID号查找公司全部信息
        /// </summary>
        /// <param name="id">公司ID号</param>
        /// <returns>公司信息</returns>
        public COMPANY FindCompanyByID(Guid id)
        {
            COMPANY company = new COMPANY();

            using (var ctx = new NtripProxyDB())
            {
                company = ctx.COMPANies.Include("ACCOUNTs").Include("COMPANY1").Include("COMPANY2").Include("USERs").FirstOrDefault(c => c.ID == id && c.isDelete == false);
            }
            return(company);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 添加公司信息
        /// </summary>
        /// <param name="company">需要添加的公司信息</param>
        /// <returns>用户是否添加成功</returns>
        public bool AddCompany(COMPANY company)
        {
            bool result = false;

            using (var ctx = new NtripProxyDB())
            {
                ctx.COMPANies.Add(company);
                result = ctx.SaveChanges() == 1;
            }
            return(result);
        }
Exemplo n.º 19
0
 public string selectcity(COMPANY com)
 {
     if (string.IsNullOrEmpty(com.selectEmployeeCity))
     {
         return("you did not selected");
     }
     else
     {
         return("your selected city id" + com.selectEmployeeCity);
     }
 }
Exemplo n.º 20
0
 public virtual int Delete(int id)
 {
     try
     {
         COMPANY cus = this.GetById(id);
         return(this.Delete(cus));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemplo n.º 21
0
 public virtual void Create(COMPANY cus)
 {
     try
     {
         this.db.COMPANies.InsertOnSubmit(cus);
         db.SubmitChanges();
     }
     catch// (Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
Exemplo n.º 22
0
 public void DisplayCompanyData(COMPANY company, int userCount)
 {
     pnlCompanyData.Visible     = true;
     lnkCompany.Text            = company.COMPANY_NAME;
     lnkCompany.CommandArgument = lnkCompanyUsers.CommandArgument = company.COMPANY_ID.ToString();
     lblCompanyCode.Text        = company.ULT_DUNS_CODE;
     lblCompanyStatus2.Text     = WebSiteCommon.GetStatusString(company.STATUS);
     if (userCount > -1)
     {
         lnkCompanyUsers.Text = lblManageUsers.Text + " (" + userCount.ToString() + ")";
     }
 }
Exemplo n.º 23
0
 public virtual void Remove(int id)
 {
     try
     {
         COMPANY cus = this.GetById(id);
         this.Remove(cus);
     }
     catch //(Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
Exemplo n.º 24
0
 public virtual void Remove(COMPANY cus)
 {
     try
     {
         db.COMPANies.DeleteOnSubmit(cus);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemplo n.º 25
0
 public virtual int Delete(COMPANY cus)
 {
     try
     {
         //user.IsDelete = true;
         db.SubmitChanges();
         return(0);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Exemplo n.º 26
0
 public virtual void Update(COMPANY cus)
 {
     try
     {
         COMPANY cusOld = this.GetById(cus.ID);
         cusOld = cus;
         db.SubmitChanges();
     }
     catch //(Exception e)
     {
         //throw new Exception(e.Message);
     }
 }
Exemplo n.º 27
0
 public ActionResult Edit([Bind(Include = "COMPANY_ID,COMPANY_NAME,PARENT_COMPANY,MANAGER,COMPANY_CATEGORY_ID,NOTED")] COMPANY cOMPANY)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cOMPANY).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.COMPANY_CATEGORY_ID = new SelectList(db.COMPANY_CATEGORIES, "COMPANY_CATEGORY_ID", "COMPANY_CATEGORY_NAME", cOMPANY.COMPANY_CATEGORY_ID);
     ViewBag.MANAGER             = new SelectList(db.USERS, "USER_ID", "USERNAME", cOMPANY.MANAGER);
     ViewBag.PARENT_COMPANY      = new SelectList(db.COMPANYS, "COMPANY_ID", "COMPANY_NAME", cOMPANY.PARENT_COMPANY);
     return(View(cOMPANY));
 }
        private void SetupPage()
        {
            COMPANY company = SQMModelMgr.LookupCompany(entities, SessionManager.EffLocation.Company.COMPANY_ID, "", false);

            uclItemHdr.DisplayCompany(company);
            SetFindControlValue("cbIsCustomer", hfBase, company.IS_CUSTOMER.ToString(), editEnabled);
            SetFindControlValue("cbIsSupplier", hfBase, company.IS_SUPPLIER.ToString(), editEnabled);

            if (SessionManager.IsEffLocationPrimary())
            {
                uclDocMgr.BindDocMgr("SYS", 0, 0);
            }
        }
Exemplo n.º 29
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());
        }
Exemplo n.º 30
0
 /// <summary>
 /// 创建一个单位
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个单位</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, COMPANY entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }