Ejemplo n.º 1
0
        private VCodeImgModel CreateVCodeImg()
        {
            VCodeImgModel rtnResult = new VCodeImgModel {
                VCodePos = new List <PointPosModel>()
            };
            string code = RandomCode.Create(this._options);

            rtnResult = VCodeImage.Create(code, 200, 200, this._options);

            return(rtnResult);
        }
Ejemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string domain   = SqlInject(this.txtdomain.Text.Trim());
         string domain2  = ddldomain.SelectedValue;
         string realname = SqlInject(this.txtrealname.Text.Trim());
         string name     = SqlInject(this.txtname.Text.Trim());
         string phone    = SqlInject(txtphone.Text.Trim());
         string status   = ddlstatus.SelectedValue;
         string mail     = SqlInject(this.txtemail.Text.Trim());
         int    agentId  = int.Parse(SqlInject(this.dllagent.SelectedValue.ToString()));
         if (identity != null)
         {
             //添加
             if (schoolId == 0)
             {
                 Exam.Entity.tb_SchoolEntity model = Exam.BLL.tb_SchoolBLL.GetInstance().GetModel("@" + domain + ddldomain.SelectedValue);
                 if (model != null)
                 {
                     MessageBox.ShowMsg(this, "域名已存在!");
                     return;
                 }
                 else
                 {
                     RandomCode r = new RandomCode();
                     r.IncludeSpecial = false;
                     r.MaximumLength  = 6;
                     string pwd        = r.Create();
                     int    locationid = 0;
                     if (ddleurozone.Value == "0")
                     {
                         int.TryParse(ddlcity.Value, out locationid);
                     }
                     else
                     {
                         int.TryParse(ddleurozone.Value, out locationid);
                     }
                     string body = Jnwf.Utils.Config.ConfigurationUtil.GetAppSettingValue("body");
                     int    rows = 0;
                     if (identity._roleID == 4)
                     {
                         if (agentId == 0)
                         {
                             rows = Exam.BLL.tb_SchoolBLL.GetInstance().InsertSchool("@" + domain + ddldomain.SelectedValue,
                                                                                     name, locationid, realname, male.Checked ? 1 : 0, phone, mail, pwd, 0, 1);
                         }
                         else
                         {
                             rows = Exam.BLL.tb_SchoolBLL.GetInstance().InsertSchool("@" + domain + ddldomain.SelectedValue,
                                                                                     name, locationid, realname, male.Checked ? 1 : 0, phone, mail, pwd, agentId, 1);
                         }
                         Exam.Entity.tb_SchoolEntity tmodel = Exam.BLL.tb_SchoolBLL.GetInstance().GetModel("@" + domain + ddldomain.SelectedValue);
                         body = string.Format(body, "<p><b>", name, "</b></p><p>", "<br/>", "admin@" + domain + domain2 + "<br/>", pwd + "<br/><p>", tmodel.SchoolId + "</p>", "</p>");
                         if (rows > 0)
                         {
                             Jnwf.Utils.Mail.MailHelper.SendEmail(
                                 Jnwf.Utils.Config.ConfigurationUtil.GetAppSettingValue("smtpServer"),
                                 Jnwf.Utils.Config.ConfigurationUtil.GetAppSettingValue("smtpUser"),
                                 Jnwf.Utils.Config.ConfigurationUtil.GetAppSettingValue("smtpPass"),
                                 mail, "欢迎加入快去读", body, true, null);
                             MessageBox.ShowAndRedirect(this, "添加成功!", "listschool.aspx");
                         }
                     }
                     //代理商
                     else if (identity._roleID == 5)
                     {
                         Exam.BLL.tb_SchoolBLL.GetInstance().InsertSchool("@" + domain + ddldomain.SelectedValue,
                                                                          name, locationid, realname, male.Checked ? 1 : 0, phone, mail, pwd, identity.UserID, 0);
                     }
                 }
             }
             //修改
             else
             {
                 Exam.Entity.tb_SchoolEntity model = Exam.BLL.tb_SchoolBLL.GetInstance().GetAdminSingle(schoolId);
                 if (model != null)
                 {
                     if (selecteurozone.Text != "0")
                     {
                         model.LocationId = int.Parse(ddleurozone.Value);
                     }
                     else if (selectcity.Text != "0")
                     {
                         model.LocationId = int.Parse(ddlcity.Value);
                     }
                     model.Name       = name;
                     model.Linkman    = txtrealname.Text;
                     model.Mail       = mail;
                     model.Phone      = txtphone.Text;
                     model.Status     = int.Parse(status);
                     model.Updatetime = DateTime.Now;
                     Exam.BLL.tb_SchoolBLL.GetInstance().Update(model);
                 }
                 Response.Redirect("listschool.aspx");
             }
         }
     }
     catch (Exception ex)
     {
         Jnwf.Utils.Log.Logger.Log4Net.Error("AddSchool.aspx.cs,btnSave_Click,ex:" + ex.Message + "|" + ex.StackTrace);
         //throw;
     }
 }
Ejemplo n.º 3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (string.IsNullOrEmpty(txtyuming.Text.Trim()))
            {
                MessageBox.ShowMsg(this, "域名不能为空");
                return;
            }
            if (string.IsNullOrEmpty(txtname.Text.Trim()))
            {
                MessageBox.ShowMsg(this, "学校名称不能为空");
                return;
            }
            if (string.IsNullOrEmpty(txtrealname.Text.Trim()))
            {
                MessageBox.ShowMsg(this, "姓名不能为空");
                return;
            }
            if (string.IsNullOrEmpty(txtphone.Text.Trim()))
            {
                MessageBox.ShowMsg(this, "电话不能为空");
                return;
            }
            if (string.IsNullOrEmpty(txtmail.Text.Trim()))
            {
                MessageBox.ShowMsg(this, "邮箱不能为空");
                return;
            }
            Exam.Entity.tb_SchoolEntity model = Exam.BLL.tb_SchoolBLL.GetInstance().GetModel("@" + txtyuming.Text.Trim() + ddldomain.SelectedValue);
            if (model == null)
            {
                RandomCode r = new RandomCode();
                r.IncludeSpecial = false;
                r.MaximumLength  = 6;
                string pwd        = r.Create();
                int    locationid = 0;

                //if (ddleurozone.SelectedValue =="0")
                //{
                //    int.TryParse(ddlcity.SelectedValue,out locationid);
                //}
                //else
                //{
                //    int.TryParse(ddleurozone.SelectedValue, out locationid);
                //}

                int rows = Exam.BLL.tb_SchoolBLL.GetInstance().InsertSchool("@" + txtyuming.Text.Trim() + ddldomain.SelectedValue,
                                                                            txtname.Text.Trim(), locationid, txtrealname.Text.Trim(), male.Checked ? 1 : 0, txtphone.Text.Trim(), txtmail.Text.Trim(), pwd, 0);

                /*model = new Exam.Entity.tb_SchoolEntity();
                 * model.Name = txtname.Text.Trim();
                 * model.Domain = "@" + txtyuming.Text.Trim();
                 * model.LocationId = 0;
                 * model.Linkman = txtrealname.Text.Trim();
                 * model.Phone = txtphone.Text.Trim();
                 * model.Tel = "";
                 * model.Mail = txtmail.Text.Trim();
                 * model.Addtime = DateTime.Now;
                 * model.Updatetime = DateTime.Now;
                 * model.Begintime = DateTime.Now;
                 * model.Endtime = DateTime.Now.AddYears(1);
                 *
                 * int row = Exam.BLL.tb_SchoolBLL.GetInstance().Insert(model);
                 *
                 * Exam.Entity.tb_UserEntity user = new Exam.Entity.tb_UserEntity();
                 * user.SchoolId = row;
                 * user.DepartmentId = 0;
                 * user.RoleId = 1;
                 * user.Name = "admin";
                 * user.Pwd = "admin";
                 * user.RealName = txtrealname.Text.Trim();
                 * user.Sex = male.Checked ? 1 : 0;
                 * user.Position = "管理员";
                 * user.Mail = txtmail.Text.Trim();
                 * user.IdentityCard = "";
                 * user.Phone = txtphone.Text.Trim();
                 * user.Description = "";
                 * user.Status = 1;
                 * user.Addtime = DateTime.Now;
                 *
                 * Exam.BLL.tb_UserBLL.GetInstance().Insert(user);
                 */
                MessageBox.ShowMsg(this, "添加成功,请等待管理员审核");



                //SendWelcome(txtrealname.Text.Trim(), txtmail.Text.Trim(),"admin",pwd);
            }
            else
            {
                MessageBox.ShowMsg(this, "注册域名重复");
                return;
            }
        }
        catch (Exception ex)
        {
            MessageBox.ShowMsg(this, ex.Message);
        }
    }