Exemple #1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Maticsoft.Model.Tao.Enterprise> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.Tao.Enterprise> modelList = new List<Maticsoft.Model.Tao.Enterprise>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Maticsoft.Model.Tao.Enterprise model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Maticsoft.Model.Tao.Enterprise();
             if (dt.Rows[n]["EnterpriseID"] != null && dt.Rows[n]["EnterpriseID"].ToString() != "")
             {
                 model.EnterpriseID = int.Parse(dt.Rows[n]["EnterpriseID"].ToString());
             }
             if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
             {
                 model.Name = dt.Rows[n]["Name"].ToString();
             }
             if (dt.Rows[n]["Introduction"] != null && dt.Rows[n]["Introduction"].ToString() != "")
             {
                 model.Introduction = dt.Rows[n]["Introduction"].ToString();
             }
             if (dt.Rows[n]["RegisteredCapital"] != null && dt.Rows[n]["RegisteredCapital"].ToString() != "")
             {
                 model.RegisteredCapital = int.Parse(dt.Rows[n]["RegisteredCapital"].ToString());
             }
             if (dt.Rows[n]["TelPhone"] != null && dt.Rows[n]["TelPhone"].ToString() != "")
             {
                 model.TelPhone = dt.Rows[n]["TelPhone"].ToString();
             }
             if (dt.Rows[n]["CellPhone"] != null && dt.Rows[n]["CellPhone"].ToString() != "")
             {
                 model.CellPhone = dt.Rows[n]["CellPhone"].ToString();
             }
             if (dt.Rows[n]["ContactMail"] != null && dt.Rows[n]["ContactMail"].ToString() != "")
             {
                 model.ContactMail = dt.Rows[n]["ContactMail"].ToString();
             }
             if (dt.Rows[n]["RegionID"] != null && dt.Rows[n]["RegionID"].ToString() != "")
             {
                 model.RegionID = int.Parse(dt.Rows[n]["RegionID"].ToString());
             }
             if (dt.Rows[n]["Address"] != null && dt.Rows[n]["Address"].ToString() != "")
             {
                 model.Address = dt.Rows[n]["Address"].ToString();
             }
             if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
             {
                 model.Remark = dt.Rows[n]["Remark"].ToString();
             }
             if (dt.Rows[n]["Contact"] != null && dt.Rows[n]["Contact"].ToString() != "")
             {
                 model.Contact = dt.Rows[n]["Contact"].ToString();
             }
             if (dt.Rows[n]["UserName"] != null && dt.Rows[n]["UserName"].ToString() != "")
             {
                 model.UserName = dt.Rows[n]["UserName"].ToString();
             }
             if (dt.Rows[n]["EstablishedDate"] != null && dt.Rows[n]["EstablishedDate"].ToString() != "")
             {
                 model.EstablishedDate = DateTime.Parse(dt.Rows[n]["EstablishedDate"].ToString());
             }
             if (dt.Rows[n]["EstablishedCity"] != null && dt.Rows[n]["EstablishedCity"].ToString() != "")
             {
                 model.EstablishedCity = int.Parse(dt.Rows[n]["EstablishedCity"].ToString());
             }
             if (dt.Rows[n]["LOGO"] != null && dt.Rows[n]["LOGO"].ToString() != "")
             {
                 model.LOGO = dt.Rows[n]["LOGO"].ToString();
             }
             if (dt.Rows[n]["Fax"] != null && dt.Rows[n]["Fax"].ToString() != "")
             {
                 model.Fax = dt.Rows[n]["Fax"].ToString();
             }
             if (dt.Rows[n]["PostCode"] != null && dt.Rows[n]["PostCode"].ToString() != "")
             {
                 model.PostCode = dt.Rows[n]["PostCode"].ToString();
             }
             if (dt.Rows[n]["HomePage"] != null && dt.Rows[n]["HomePage"].ToString() != "")
             {
                 model.HomePage = dt.Rows[n]["HomePage"].ToString();
             }
             if (dt.Rows[n]["ArtiPerson"] != null && dt.Rows[n]["ArtiPerson"].ToString() != "")
             {
                 model.ArtiPerson = dt.Rows[n]["ArtiPerson"].ToString();
             }
             if (dt.Rows[n]["EnteRank"] != null && dt.Rows[n]["EnteRank"].ToString() != "")
             {
                 model.EnteRank = int.Parse(dt.Rows[n]["EnteRank"].ToString());
             }
             if (dt.Rows[n]["EnteClassID"] != null && dt.Rows[n]["EnteClassID"].ToString() != "")
             {
                 model.EnteClassID = int.Parse(dt.Rows[n]["EnteClassID"].ToString());
             }
             if (dt.Rows[n]["CompanyType"] != null && dt.Rows[n]["CompanyType"].ToString() != "")
             {
                 model.CompanyType = int.Parse(dt.Rows[n]["CompanyType"].ToString());
             }
             if (dt.Rows[n]["BusinessLicense"] != null && dt.Rows[n]["BusinessLicense"].ToString() != "")
             {
                 model.BusinessLicense = dt.Rows[n]["BusinessLicense"].ToString();
             }
             if (dt.Rows[n]["TaxNumber"] != null && dt.Rows[n]["TaxNumber"].ToString() != "")
             {
                 model.TaxNumber = dt.Rows[n]["TaxNumber"].ToString();
             }
             if (dt.Rows[n]["AccountBank"] != null && dt.Rows[n]["AccountBank"].ToString() != "")
             {
                 model.AccountBank = dt.Rows[n]["AccountBank"].ToString();
             }
             if (dt.Rows[n]["AccountInfo"] != null && dt.Rows[n]["AccountInfo"].ToString() != "")
             {
                 model.AccountInfo = dt.Rows[n]["AccountInfo"].ToString();
             }
             if (dt.Rows[n]["ServicePhone"] != null && dt.Rows[n]["ServicePhone"].ToString() != "")
             {
                 model.ServicePhone = dt.Rows[n]["ServicePhone"].ToString();
             }
             if (dt.Rows[n]["QQ"] != null && dt.Rows[n]["QQ"].ToString() != "")
             {
                 model.QQ = dt.Rows[n]["QQ"].ToString();
             }
             if (dt.Rows[n]["MSN"] != null && dt.Rows[n]["MSN"].ToString() != "")
             {
                 model.MSN = dt.Rows[n]["MSN"].ToString();
             }
             if (dt.Rows[n]["Status"] != null && dt.Rows[n]["Status"].ToString() != "")
             {
                 model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
             }
             if (dt.Rows[n]["CreatedDate"] != null && dt.Rows[n]["CreatedDate"].ToString() != "")
             {
                 model.CreatedDate = DateTime.Parse(dt.Rows[n]["CreatedDate"].ToString());
             }
             if (dt.Rows[n]["CreatedUserID"] != null && dt.Rows[n]["CreatedUserID"].ToString() != "")
             {
                 model.CreatedUserID = int.Parse(dt.Rows[n]["CreatedUserID"].ToString());
             }
             if (dt.Rows[n]["UpdatedDate"] != null && dt.Rows[n]["UpdatedDate"].ToString() != "")
             {
                 model.UpdatedDate = DateTime.Parse(dt.Rows[n]["UpdatedDate"].ToString());
             }
             if (dt.Rows[n]["UpdatedUserID"] != null && dt.Rows[n]["UpdatedUserID"].ToString() != "")
             {
                 model.UpdatedUserID = int.Parse(dt.Rows[n]["UpdatedUserID"].ToString());
             }
             if (dt.Rows[n]["AgentID"] != null && dt.Rows[n]["AgentID"].ToString() != "")
             {
                 model.AgentID = int.Parse(dt.Rows[n]["AgentID"].ToString());
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemple #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";
            if (this.txtIntroduction.Text.Trim().Length == 0)
            {
                strErr += "企业介绍不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtEstablishedDate.Text))
            {
                strErr += "成立时间格式错误!\\n";
            }
            if (string.IsNullOrEmpty(hfRegionID.Value))
            {
                strErr += "请选择省/市!\\n";
            }
            User newUser = new User();
            if (newUser.HasUser(this.txtUserName.Text))
            {
                strErr += Resources.Site.TooltipUserExist;
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int EnterpriseID = 0;
            try
            {
                Maticsoft.Model.Tao.Enterprise model = new Maticsoft.Model.Tao.Enterprise();
                model.Name = this.txtName.Text;
                model.Introduction = this.txtIntroduction.Text;
                model.RegisteredCapital = 0;//this.txtRegisteredCapital.Text;
                model.TelPhone = this.txtTelPhone.Text;
                model.CellPhone = this.txtCellPhone.Text;
                model.ContactMail = this.txtContactMail.Text;
                model.RegionID = Convert.ToInt32(this.hfRegionID.Value);
                model.Address = this.txtAddress.Text;
                model.Remark = this.txtRemark.Text;
                model.Contact = this.txtContact.Text;
                model.UserName = this.txtUserName.Text;
                model.EstablishedDate = Convert.ToDateTime(this.txtEstablishedDate.Text);
                model.EstablishedCity = 0;// this.txtEstablishedCity.Text;
                model.LOGO = UploadImage(FileUploadLogo, 2);
                model.Fax = this.txtFax.Text;
                model.PostCode = this.txtPostCode.Text;
                model.HomePage = this.txtHomePage.Text;
                model.ArtiPerson = this.txtArtiPerson.Text;
                model.EnteRank = 0;// this.txtEnteRank.Text;
                model.EnteClassID = 0;// this.txtEnteClassID.Text;
                model.CompanyType = int.Parse(this.ddlCompanyType.Text);
                model.BusinessLicense = UploadImage(FileUploadBusinessLicense, 2);
                model.TaxNumber = this.txtTaxNumber.Text;
                model.AccountBank = this.txtAccountBank.Text;
                model.AccountInfo = this.txtAccountInfo.Text;
                model.ServicePhone = this.txtServicePhone.Text;
                model.QQ = this.txtQQ.Text;
                model.MSN = this.txtMSN.Text;
                model.Status = Convert.ToInt32(this.ddlStatus.SelectedValue);
                model.CreatedDate = System.DateTime.Now;
                model.CreatedUserID = CurrentUser.UserID;
                model.UpdatedDate = System.DateTime.Now;
                model.UpdatedUserID = CurrentUser.UserID;
                model.AgentID = 0;

                EnterpriseID = bll.Add(model);

                newUser.UserName = txtUserName.Text;
                newUser.Password = AccountsPrincipal.EncryptPassword("111111");
                newUser.TrueName = "";
                newUser.Sex = "1";
                newUser.Phone = this.txtCellPhone.Text;
                newUser.Email = this.txtContactMail.Text;
                newUser.EmployeeID = 0;
                newUser.DepartmentID = EnterpriseID.ToString();
                newUser.Activity = true;
                newUser.UserType = "UU";
                newUser.Style = 1;
                newUser.User_dateCreate = System.DateTime.Now;
                newUser.User_iCreator = CurrentUser.UserID;
                newUser.User_dateValid = DateTime.Now;
                newUser.User_cLang = "zh-CN";

                int userid = newUser.Create();
                if (userid == -100)
                {
                    Maticsoft.Common.MessageBox.Show(this, Resources.Site.TooltipUserExist);
                }
                else
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "List.aspx");
                }
            }
            catch (Exception ex)
            {
                //若创建用户失败则删除创建的企业编号。
                bll.Delete(EnterpriseID);
                throw ex;
            }
            finally
            {
            }
        }
Exemple #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Tao.Enterprise GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 EnterpriseID,Name,Introduction,RegisteredCapital,TelPhone,CellPhone,ContactMail,RegionID,Address,Remark,Contact,UserName,EstablishedDate,EstablishedCity,LOGO,Fax,PostCode,HomePage,ArtiPerson,EnteRank,EnteClassID,CompanyType,BusinessLicense,TaxNumber,AccountBank,AccountInfo,ServicePhone,QQ,MSN,Status,CreatedDate,CreatedUserID,UpdatedDate,UpdatedUserID,AgentID from Tao_Enterprise ");

            if (!string.IsNullOrEmpty(strWhere))
            {
                strSql.Append(" where " + strWhere);
            }

            Maticsoft.Model.Tao.Enterprise model = new Maticsoft.Model.Tao.Enterprise();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["EnterpriseID"] != null && ds.Tables[0].Rows[0]["EnterpriseID"].ToString() != "")
                {
                    model.EnterpriseID = int.Parse(ds.Tables[0].Rows[0]["EnterpriseID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Name"] != null && ds.Tables[0].Rows[0]["Name"].ToString() != "")
                {
                    model.Name = ds.Tables[0].Rows[0]["Name"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Introduction"] != null && ds.Tables[0].Rows[0]["Introduction"].ToString() != "")
                {
                    model.Introduction = ds.Tables[0].Rows[0]["Introduction"].ToString();
                }
                if (ds.Tables[0].Rows[0]["RegisteredCapital"] != null && ds.Tables[0].Rows[0]["RegisteredCapital"].ToString() != "")
                {
                    model.RegisteredCapital = int.Parse(ds.Tables[0].Rows[0]["RegisteredCapital"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TelPhone"] != null && ds.Tables[0].Rows[0]["TelPhone"].ToString() != "")
                {
                    model.TelPhone = ds.Tables[0].Rows[0]["TelPhone"].ToString();
                }
                if (ds.Tables[0].Rows[0]["CellPhone"] != null && ds.Tables[0].Rows[0]["CellPhone"].ToString() != "")
                {
                    model.CellPhone = ds.Tables[0].Rows[0]["CellPhone"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ContactMail"] != null && ds.Tables[0].Rows[0]["ContactMail"].ToString() != "")
                {
                    model.ContactMail = ds.Tables[0].Rows[0]["ContactMail"].ToString();
                }
                if (ds.Tables[0].Rows[0]["RegionID"] != null && ds.Tables[0].Rows[0]["RegionID"].ToString() != "")
                {
                    model.RegionID = int.Parse(ds.Tables[0].Rows[0]["RegionID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Address"] != null && ds.Tables[0].Rows[0]["Address"].ToString() != "")
                {
                    model.Address = ds.Tables[0].Rows[0]["Address"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Remark"] != null && ds.Tables[0].Rows[0]["Remark"].ToString() != "")
                {
                    model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Contact"] != null && ds.Tables[0].Rows[0]["Contact"].ToString() != "")
                {
                    model.Contact = ds.Tables[0].Rows[0]["Contact"].ToString();
                }
                if (ds.Tables[0].Rows[0]["UserName"] != null && ds.Tables[0].Rows[0]["UserName"].ToString() != "")
                {
                    model.UserName = ds.Tables[0].Rows[0]["UserName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EstablishedDate"] != null && ds.Tables[0].Rows[0]["EstablishedDate"].ToString() != "")
                {
                    model.EstablishedDate = DateTime.Parse(ds.Tables[0].Rows[0]["EstablishedDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["EstablishedCity"] != null && ds.Tables[0].Rows[0]["EstablishedCity"].ToString() != "")
                {
                    model.EstablishedCity = int.Parse(ds.Tables[0].Rows[0]["EstablishedCity"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LOGO"] != null && ds.Tables[0].Rows[0]["LOGO"].ToString() != "")
                {
                    model.LOGO = ds.Tables[0].Rows[0]["LOGO"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Fax"] != null && ds.Tables[0].Rows[0]["Fax"].ToString() != "")
                {
                    model.Fax = ds.Tables[0].Rows[0]["Fax"].ToString();
                }
                if (ds.Tables[0].Rows[0]["PostCode"] != null && ds.Tables[0].Rows[0]["PostCode"].ToString() != "")
                {
                    model.PostCode = ds.Tables[0].Rows[0]["PostCode"].ToString();
                }
                if (ds.Tables[0].Rows[0]["HomePage"] != null && ds.Tables[0].Rows[0]["HomePage"].ToString() != "")
                {
                    model.HomePage = ds.Tables[0].Rows[0]["HomePage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ArtiPerson"] != null && ds.Tables[0].Rows[0]["ArtiPerson"].ToString() != "")
                {
                    model.ArtiPerson = ds.Tables[0].Rows[0]["ArtiPerson"].ToString();
                }
                if (ds.Tables[0].Rows[0]["EnteRank"] != null && ds.Tables[0].Rows[0]["EnteRank"].ToString() != "")
                {
                    model.EnteRank = int.Parse(ds.Tables[0].Rows[0]["EnteRank"].ToString());
                }
                if (ds.Tables[0].Rows[0]["EnteClassID"] != null && ds.Tables[0].Rows[0]["EnteClassID"].ToString() != "")
                {
                    model.EnteClassID = int.Parse(ds.Tables[0].Rows[0]["EnteClassID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CompanyType"] != null && ds.Tables[0].Rows[0]["CompanyType"].ToString() != "")
                {
                    model.CompanyType = int.Parse(ds.Tables[0].Rows[0]["CompanyType"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BusinessLicense"] != null && ds.Tables[0].Rows[0]["BusinessLicense"].ToString() != "")
                {
                    model.BusinessLicense = ds.Tables[0].Rows[0]["BusinessLicense"].ToString();
                }
                if (ds.Tables[0].Rows[0]["TaxNumber"] != null && ds.Tables[0].Rows[0]["TaxNumber"].ToString() != "")
                {
                    model.TaxNumber = ds.Tables[0].Rows[0]["TaxNumber"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AccountBank"] != null && ds.Tables[0].Rows[0]["AccountBank"].ToString() != "")
                {
                    model.AccountBank = ds.Tables[0].Rows[0]["AccountBank"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AccountInfo"] != null && ds.Tables[0].Rows[0]["AccountInfo"].ToString() != "")
                {
                    model.AccountInfo = ds.Tables[0].Rows[0]["AccountInfo"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ServicePhone"] != null && ds.Tables[0].Rows[0]["ServicePhone"].ToString() != "")
                {
                    model.ServicePhone = ds.Tables[0].Rows[0]["ServicePhone"].ToString();
                }
                if (ds.Tables[0].Rows[0]["QQ"] != null && ds.Tables[0].Rows[0]["QQ"].ToString() != "")
                {
                    model.QQ = ds.Tables[0].Rows[0]["QQ"].ToString();
                }
                if (ds.Tables[0].Rows[0]["MSN"] != null && ds.Tables[0].Rows[0]["MSN"].ToString() != "")
                {
                    model.MSN = ds.Tables[0].Rows[0]["MSN"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Status"] != null && ds.Tables[0].Rows[0]["Status"].ToString() != "")
                {
                    model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreatedDate"] != null && ds.Tables[0].Rows[0]["CreatedDate"].ToString() != "")
                {
                    model.CreatedDate = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreatedUserID"] != null && ds.Tables[0].Rows[0]["CreatedUserID"].ToString() != "")
                {
                    model.CreatedUserID = int.Parse(ds.Tables[0].Rows[0]["CreatedUserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpdatedDate"] != null && ds.Tables[0].Rows[0]["UpdatedDate"].ToString() != "")
                {
                    model.UpdatedDate = DateTime.Parse(ds.Tables[0].Rows[0]["UpdatedDate"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UpdatedUserID"] != null && ds.Tables[0].Rows[0]["UpdatedUserID"].ToString() != "")
                {
                    model.UpdatedUserID = int.Parse(ds.Tables[0].Rows[0]["UpdatedUserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AgentID"] != null && ds.Tables[0].Rows[0]["AgentID"].ToString() != "")
                {
                    model.AgentID = int.Parse(ds.Tables[0].Rows[0]["AgentID"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Exemple #4
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string strErr = "";
     if (this.txtIntroduction.Text.Trim().Length == 0)
     {
         strErr += "企业介绍不能为空!\\n";
     }
     if (!PageValidate.IsDateTime(txtEstablishedDate.Text))
     {
         strErr += "成立时间格式错误!\\n";
     }
     if (string.IsNullOrEmpty(hfRegionID.Value))
     {
         strErr += "请选择省/市!\\n";
     }
     if (strErr != "")
     {
         MessageBox.Show(this, strErr);
         return;
     }
     if (strErr != "")
     {
         MessageBox.Show(this, strErr);
         return;
     }
     Maticsoft.Model.Tao.Enterprise model = new Maticsoft.Model.Tao.Enterprise();
     model.Name = this.txtName.Text;
     model.Introduction = this.txtIntroduction.Text;
     model.RegisteredCapital = 0;// int.Parse(this.txtRegisteredCapital.Text);
     model.TelPhone = this.txtTelPhone.Text;
     model.CellPhone = this.txtCellPhone.Text;
     model.ContactMail = this.txtContactMail.Text;
     model.RegionID = Convert.ToInt32(this.hfRegionID.Value);
     model.Address = this.txtAddress.Text;
     model.Remark = this.txtRemark.Text;
     model.Contact = this.txtContact.Text;
     model.UserName = this.txtUserName.Text;
     model.EstablishedDate = Convert.ToDateTime(this.txtEstablishedDate.Text);
     model.EstablishedCity = -1;// int.Parse(this.txtEstablishedCity.Text);
     model.LOGO = this.hfImgUrlLogo.Value;
     if (!string.IsNullOrEmpty(UploadImage(FileUploadLogo, 2)))
     {
         model.LOGO = UploadImage(FileUploadLogo, 2);
     }
     model.Fax = this.txtFax.Text;
     model.PostCode = this.txtPostCode.Text;
     model.HomePage = this.txtHomePage.Text;
     model.ArtiPerson = this.txtArtiPerson.Text;
     model.EnteRank = 0;// int.Parse(this.txtEnteRank.Text);
     model.EnteClassID = 0;// int.Parse(this.txtEnteClassID.Text);
     model.CompanyType = int.Parse(this.ddlCompanyType.Text);
     model.BusinessLicense = hfImgUrlBusinessLicense.Value;
     if (!string.IsNullOrEmpty(UploadImage(FileUploadBusinessLicense, 2)))
     {
         model.BusinessLicense = UploadImage(FileUploadBusinessLicense, 2);
     }
     model.TaxNumber = this.txtTaxNumber.Text;
     model.AccountBank = this.txtAccountBank.Text;
     model.AccountInfo = this.txtAccountInfo.Text;
     model.ServicePhone = this.txtServicePhone.Text;
     model.QQ = this.txtQQ.Text;
     model.MSN = this.txtMSN.Text;
     model.Status = Convert.ToInt32(this.ddlStatus.SelectedValue);
     model.CreatedDate = System.DateTime.Now;
     if (!string.IsNullOrEmpty(hfCreatedDate.Value) && PageValidate.IsDateTime(hfCreatedDate.Value))
     {
         model.CreatedDate = DateTime.Parse(hfCreatedDate.Value);
     }
     model.CreatedUserID = CurrentUser.UserID;
     if (!string.IsNullOrEmpty(hfCreatedUserID.Value) && PageValidate.IsNumber(hfCreatedUserID.Value))
     {
         model.CreatedUserID = int.Parse(hfCreatedUserID.Value);
     }
     model.UpdatedDate = System.DateTime.Now;
     model.UpdatedUserID = CurrentUser.UserID;
     model.AgentID = 0;
     model.EnterpriseID = int.Parse(hfEnterpriseID.Value);
     bll.Update(model);
     Maticsoft.Common.MessageBox.ShowAndRedirect(this, "修改成功!", "List.aspx");
 }
Exemple #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (null == CurrentUser)
            {
                Maticsoft.Common.MessageBox.ShowFailTip(this, "您尚未登录,无法进行注册机构!");
                return;
            }
            Maticsoft.Model.Tao.Enterprise model = new Maticsoft.Model.Tao.Enterprise();
            model.Name = this.txtEnterpriseName.Text;
            model.Introduction = this.txtIntroduction.Text;
            model.RegisteredCapital = int.Parse(this.txtRegisteredCapital.Text);
            model.TelPhone = this.txtPhone.Text;
            model.ContactMail = this.txtContactMail.Text;
            model.Contact = this.txtContact.Text;
            model.UserName = CurrentUser.TrueName;
            model.PostCode = this.txtPostCode.Text;
            model.HomePage = this.txtHomePage.Text;
            model.BusinessLicense = this.hfBusinessLicense.Value;
            if (!string.IsNullOrEmpty(uploadFile))
            {
                string outPath = string.Empty;
                Common.FileUpLoad.uploadFileControl(FileUploadBusinessLicense.PostedFile, uploadFile += "/" + CurrentUser.UserID, "pic", out outPath);
                if (!string.IsNullOrEmpty(outPath))
                {
                    model.BusinessLicense = outPath;
                }
            }
            model.Status = 0;
            model.CreatedDate = System.DateTime.Now;
            model.CreatedUserID = CurrentUser.UserID;
            model.UpdatedDate = System.DateTime.Now;
            model.UpdatedUserID = CurrentUser.UserID;
            model.AgentID = 0;
            if (BLL.ExistsByUserID(CurrentUser.UserID))
            {
                Maticsoft.Model.Tao.Enterprise enterpriseModel = BLL.GetModelByUserID(CurrentUser.UserID);
                if (null != enterpriseModel)
                {
                    model.EnterpriseID = enterpriseModel.EnterpriseID;
                    if (enterpriseModel.Status.HasValue)
                    {
                        //0未审核  1正常  2冻结   3删除
                        switch (enterpriseModel.Status.Value)
                        {
                            case 0:
                            case 1:
                                break;

                            case 2://冻结则修改状态为未审核,可以再次请求审核。
                            case 3://删除则修改状态为未审核,可以再次请求审核。
                                model.Status = 0;
                                break;
                        }
                    }
                    if (BLL.Update(model))
                    {
                        ShowInfo();
                        showEnterpriseInfo();
                        Maticsoft.Common.MessageBox.ShowSuccessTip(this, "保存成功!");
                    }
                    else
                    {
                        Maticsoft.Common.MessageBox.ShowFailTip(this, "保存失败!");
                    }
                }
            }
            else
            {
                int rows = BLL.Add(model);
                if (0 < rows)
                {
                    CurrentUser.DepartmentID = rows.ToString();
                    CurrentUser.Update();
                    ShowInfo();
                    showEnterpriseInfo();
                    Maticsoft.Common.MessageBox.Show(this, "注册机构成功!");
                }
                else
                {
                    Maticsoft.Common.MessageBox.Show(this, "注册机构失败!");
                }
            }
        }