示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ROYcms.Sys.Model.ROYcms_Enterprise> DataTableToList(DataTable dt)
        {
            List <ROYcms.Sys.Model.ROYcms_Enterprise> modelList = new List <ROYcms.Sys.Model.ROYcms_Enterprise>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Enterprise model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Enterprise();
                    if (dt.Rows[n]["bh"].ToString() != "")
                    {
                        model.bh = int.Parse(dt.Rows[n]["bh"].ToString());
                    }
                    if (dt.Rows[n]["user_id"].ToString() != "")
                    {
                        model.user_id = int.Parse(dt.Rows[n]["user_id"].ToString());
                    }
                    model.introduces         = dt.Rows[n]["introduces"].ToString();
                    model.business_scope     = dt.Rows[n]["business_scope"].ToString();
                    model.intelligence_honor = dt.Rows[n]["intelligence_honor"].ToString();
                    model.contacts_us        = dt.Rows[n]["contacts_us"].ToString();
                    model.enterprise_culture = dt.Rows[n]["enterprise_culture"].ToString();
                    model.marketing_network  = dt.Rows[n]["marketing_network"].ToString();
                    model.other_1            = dt.Rows[n]["other_1"].ToString();
                    model.other_2            = dt.Rows[n]["other_2"].ToString();
                    model.other_3            = dt.Rows[n]["other_3"].ToString();
                    model.other_4            = dt.Rows[n]["other_4"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void _Update(ROYcms.Sys.Model.ROYcms_Enterprise model)
 {
     dal._Update(model);
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ROYcms.Sys.Model.ROYcms_Enterprise model)
 {
     return(dal.Add(model));
 }
示例#4
0
        /// <summary>
        /// Handles the Click event of the Button_add control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Button_add_Click(object sender, EventArgs e)
        {
            string name     = this.txtname.Value;
            string password = this.txtpassword.Value;
            string qq       = "";
            string email    = "";
            int    age      = 0;
            string sex      = "";
            string pic      = "";
            string username = "";

            ROYcms.Sys.Model.ROYcms_user model = new ROYcms.Sys.Model.ROYcms_user();


            model.name       = name;
            model.password   = password;
            model.qq         = qq;
            model.email      = email;
            model.age        = age;
            model.sex        = sex;
            model.pic        = pic;
            model.login_time = DateTime.Now;
            //默认可选参数组
            model.money    = 0;
            model.quanxian = "Enterprise";
            model.username = username;
            model.GUID     = ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("guid");

            ROYcms.Sys.BLL.ROYcms_user bll = new ROYcms.Sys.BLL.ROYcms_user();


            if (yanzhengma.Value.Trim().ToUpperInvariant() == Session["code"].ToString())
            {
                ROYcms.Sys.BLL.ROYcms_user user = new ROYcms.Sys.BLL.ROYcms_user();
                if (!user.Exists(name))
                {
                    int _bh = bll.Add(model);
                    if (_bh != 1)
                    {
                        ROYcms.Sys.Model.ROYcms_user _model = bll.GetModel(this.txtname.Value);
                        ROYcms.Common.Session.Add("user_id", _model.bh.ToString().Trim());
                        ROYcms.Common.Session.Add("user", _model.name.Trim());


                        ROYcms.Sys.Model.ROYcms_Enterprise Enterprise_model = new ROYcms.Sys.Model.ROYcms_Enterprise();
                        if (ROYcms.Common.Session.Get("user_id") != null)
                        {
                            Enterprise_model.user_id = Convert.ToInt32(ROYcms.Common.Session.Get("user_id"));
                        }
                        string mesbox = "请尽快完善您的企业企业信息!";
                        Enterprise_model.gs_name     = this.GSname.Value; //公司名称
                        Enterprise_model.gs_tel      = this.GStel.Value;  //公司电话
                        Enterprise_model.keyword     = this.GSname.Value;
                        Enterprise_model.description = this.GSname.Value;


                        Enterprise_model.introduces         = mesbox;
                        Enterprise_model.business_scope     = mesbox;
                        Enterprise_model.intelligence_honor = mesbox;
                        Enterprise_model.contacts_us        = mesbox;
                        Enterprise_model.enterprise_culture = mesbox;
                        Enterprise_model.marketing_network  = mesbox;
                        Enterprise_model.other_1            = mesbox;
                        Enterprise_model.other_2            = mesbox;
                        Enterprise_model.other_3            = mesbox;
                        Enterprise_model.other_4            = mesbox;

                        ROYcms.Sys.BLL.ROYcms_Enterprise Enterprise_bll = new ROYcms.Sys.BLL.ROYcms_Enterprise();

                        if (Enterprise_bll.Add(Enterprise_model) != 1)
                        {
                            //非主站点
                            if (ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("ucenter_webserver") != "index")
                            {
                                try
                                {
                                    ////webserver接口数据
                                    //ROYcms.UI.Admin.WC_ROYcms_user.ROYcms_user1 WC_model = new ROYcms_user1();
                                    //WC_model.name = name;
                                    //WC_model.password = password;
                                    //WC_model.qq = qq;
                                    //WC_model.email = email;
                                    //WC_model.age = age;
                                    //WC_model.sex = sex;
                                    //WC_model.pic = pic;
                                    //WC_model.login_time = DateTime.Now;

                                    ////默认可选参数组
                                    //WC_model.money = 0;
                                    //WC_model.quanxian = "Enterprise";
                                    //WC_model.username = username;
                                    //WC_model.GUID = ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("guid");

                                    ////webserver api 到主站注册
                                    //ROYcms.UI.Admin.WC_ROYcms_user.ROYcms_user User = new ROYcms.UI.Admin.WC_ROYcms_user.ROYcms_user();
                                    //User.Url = ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("ucenter_webserver") + "administrator/WebService/ROYcms_user.asmx";
                                    //if (User.Add(WC_model) != 1)
                                    //{
                                    //    //为实现验证是否存在该用户
                                    //    MessageBox.ShowAndRedirect(this, "注册本站/通行证成功!可以在站群之间漫游!", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_host") + "administrator/index.aspx");
                                    //}
                                    //else
                                    //{
                                    //    MessageBox.ShowAndRedirect(this, "注册本站成功!注册通行证失败!将直接转到会员后台!", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_host") + "administrator/index.aspx");
                                    //}
                                }
                                catch
                                {
                                    MessageBox.ShowAndRedirect(this, "注册本站成功!注册通行证失败!将直接转到会员后台!", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_host") + "administrator/index.aspx");
                                }
                            }
                            else
                            {
                                MessageBox.ShowAndRedirect(this, "注册主站点成功!将直接转到会员后台!", ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_host") + "administrator/index.aspx");
                            }
                        }
                        else
                        {
                            try
                            {
                                user.Delete(_bh);//回滚删除刚注册的用户
                            }
                            catch
                            {
                                MessageBox.ShowAndRedirect(this, "初始化店铺失败!", "Enterprise_reg.aspx");
                            }

                            MessageBox.ShowAndRedirect(this, "初始化店铺失败!", "Enterprise_reg.aspx");
                        }
                    }
                    else
                    {
                        MessageBox.ShowAndRedirect(this, "注册失败!", "Enterprise_reg.aspx");
                    }
                }
                else
                {
                    MessageBox.Show(this, "该用户已经存在!");
                }
            }
            else
            {
                MessageBox.Show(this, "验证码错误!");
            }
        }