Beispiel #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != "")
     {
         try
         {
             //生成图片
             AstroMod mod = new AstroMod();
             mod.graphicID = Request.QueryString["ID"];
             if (Request.QueryString["fa"] != "")
             {
                 mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + Request.QueryString["fa"];
             }
             if (Request.QueryString["fb"] != "")
             {
                 mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + Request.QueryString["fb"];
             }
             AstroBiz.GetInstance().GetGraphic(mod);
             //输出
             CreateImageOnPage(AstroBiz.GetInstance().GetGraphicPath(mod.graphicID), HttpContext.Current);
         }
         catch (Exception ex)
         {
             LogManagement.getInstance().WriteException(ex, "星盘显示", Request.UserHostAddress);
         }
     }
 }
Beispiel #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            UploadIMG m_upload = new UploadIMG();

            m_upload.Path        = @"..\MainSite\WebResources\ArticleImg\";
            m_upload.IsThumbnail = false;
            try
            {
                if (m_upload.UpLoadIMG(FileUpload1))
                {
                    Image1.ImageUrl  = AppConfig.WebResourcesPath() + "ArticleImg/" + m_upload.OFileName;
                    Image1.Visible   = true;
                    TextBox1.Text    = AppConfig.WebResourcesPath() + "ArticleImg/" + m_upload.OFileName;
                    TextBox1.Visible = true;
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('" + m_upload.MSG + "');", true);
                }
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 上传头像
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            UploadIMG m_upload = new UploadIMG();

            m_upload.Path        = @"WebResources\UpUserFiles\Photos\Tmp";
            m_upload.IsThumbnail = false;
            try
            {
                if (m_upload.UpLoadIMG(FileUpload1))
                {
                    ImageDrag.ImageUrl         = "~/ControlLibrary/ShowPhoto.aspx?type=tmp&id=" + m_upload.OFileName.Replace("o", "");
                    ImageIcon.ImageUrl         = "~/ControlLibrary/ShowPhoto.aspx?type=tmp&id=" + m_upload.OFileName.Replace("o", "");
                    hdfPicID.Value             = m_upload.OFileName.Replace("o", "");
                    MultiView1.ActiveViewIndex = 4;
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('" + m_upload.MSG + "');", true);
                }
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true);
            }
        }
Beispiel #4
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            SYS_DistrictMod m_area = new SYS_DistrictMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_area = SYS_DistrictBll.GetInstance().GetModel(SysNo);
            }
            try
            {
                m_area.Name        = txtName.Text.Trim();
                m_area.EnglishName = txtEnglishName.Text.Trim();
                m_area.DR          = int.Parse(drpStatus.SelectedValue);
                SYS_DistrictBll.GetInstance().Update(m_area);
                LogManagement.getInstance().WriteTrace(m_area.SysNo, "District.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch
            {
                ltrError.Text = "输入资料格式有误,请检查!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 执行SQL语句返回是否有记录(SQL语句必须过滤参数)
        /// </summary>
        /// <param name="CommandText"></param>
        /// <returns></returns>
        public bool CmdtoHasRow(string CommandText)
        {
            bool ret = false;

            try
            {
                m_cmd.CommandText = CommandText;
                m_conn.Open();
                SqlDataReader m_dr = m_cmd.ExecuteReader();
                m_dr.Read();
                if (m_dr.HasRows)
                {
                    ret = false;
                }
                else
                {
                    ret = true;
                }
                m_dr.Close();
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "SQLData,相关SQL语句:" + CommandText, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress);
            }
            finally
            {
                m_conn.Close();
            }
            return(ret);
        }
Beispiel #6
0
        /// <summary>
        /// 执行存储过程返回是否有记录
        /// </summary>
        /// <param name="StoredProcedure"></param>
        /// <returns></returns>
        public bool SPtoHasRow(string StoredProcedure)
        {
            bool ret = false;

            try
            {
                SqlParameter retpara = m_cmd.Parameters.Add("@reValue", SqlDbType.Int);
                retpara.Direction = ParameterDirection.ReturnValue;

                m_cmd.CommandText = StoredProcedure;
                m_cmd.CommandType = CommandType.StoredProcedure;
                m_conn.Open();
                SqlDataReader m_dr = m_cmd.ExecuteReader();
                m_dr.Read();
                if (m_dr.HasRows)
                {
                    ret = false;
                }
                else
                {
                    ret = true;
                }
                ReturnValue = m_cmd.Parameters["@reValue"].Value.ToString();
                m_dr.Close();
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "SQLData,相关SP:" + StoredProcedure, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress);
            }
            finally
            {
                m_conn.Close();
            }
            return(ret);
        }
Beispiel #7
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            SYS_AdminMod m_supplier = new SYS_AdminMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_supplier = SYS_AdminBll.GetInstance().GetModel(SysNo);
            }
            if (txtUserName.Text.Trim() == "")
            {
                ltrError.Text = "请填写用户登录名!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (txtPass.Text.Trim() == "" && type == "ADD")
            {
                ltrError.Text = "请输入初始密码!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            m_supplier.CustomerSysNo = int.Parse(Request.QueryString["user"]);
            m_supplier.Username      = txtUserName.Text;

            try
            {
                if (type == "ADD")
                {
                    m_supplier.DR        = 0;
                    m_supplier.Password  = txtPass.Text;
                    m_supplier.TS        = DateTime.Now;
                    m_supplier.LastLogin = DateTime.Now;
                    m_supplier.SysNo     = SYS_AdminBll.GetInstance().Add(m_supplier);

                    SetPrivilege(m_supplier.SysNo);
                    LogManagement.getInstance().WriteTrace(m_supplier.SysNo, "Article.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                else if (type == "EDIT")
                {
                    if (txtPass.Text.Trim() != "加密存储")
                    {
                        m_supplier.Password = txtPass.Text;
                    }
                    SYS_AdminBll.GetInstance().Update(m_supplier);
                    SetPrivilege(m_supplier.SysNo);
                    LogManagement.getInstance().WriteTrace(m_supplier.SysNo, "Article.Edit", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch (Exception ex)
            {
                ltrError.Text = "系统错误,保存失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                LogManagement.getInstance().WriteException(ex, "Article.Save", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
            }
        }
Beispiel #8
0
        protected void Button7_Click(object sender, EventArgs e)
        {
            string OPath = @"~\WebResources\UpUserFiles\Photos\O";

            try
            {
                int imageWidth  = Int32.Parse(txt_width.Text);
                int imageHeight = Int32.Parse(txt_height.Text);
                int cutTop      = Int32.Parse(txt_top.Text);
                int cutLeft     = Int32.Parse(txt_left.Text);
                int dropWidth   = Int32.Parse(txt_DropWidth.Text);
                int dropHeight  = Int32.Parse(txt_DropHeight.Text);

                string filename = ImageHelper.SaveCutPic(Server.MapPath(@"~\WebResources\UpUserFiles\Photos\Tmp\o" + hdfPicID.Value), Server.MapPath(OPath), 0, 0, dropWidth,
                                                         dropHeight, cutLeft, cutTop, imageWidth, imageHeight);
                ImageHelper.SaveThumbnail(Server.MapPath(OPath + @"\" + filename), Server.MapPath(@"~\WebResources\UpUserFiles\Photos\T"), filename, 70, 70, true);
                m_user       = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                m_user.Photo = filename.Replace(".jpg", "");
                USR_CustomerBll.GetInstance().Update(m_user);
                MultiView1.ActiveViewIndex = 0;
                //DataBind();
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('头像更新成功');", true);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Userphoto.Upload", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "photook", "alert('系统故障,请联系管理员');", true);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 编辑信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button3_Click(object sender, EventArgs e)
        {
            #region 检查输入
            if (RadioButtonList1.SelectedIndex == -1)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "nogender", "alert('请选择性别');", true);
                return;
            }
            #endregion
            try
            {
                m_user             = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                m_user.FateType    = int.Parse(drpFateType.SelectedValue);
                m_user.Gender      = int.Parse(RadioButtonList1.SelectedValue);
                m_user.Birth       = DatePicker2.SelectedTime;
                m_user.IsShowBirth = int.Parse(drpBirthType.SelectedValue);
                m_user.HomeTown    = District2.Area3SysNo;
                m_user.Intro       = txtIntro.Text;

                USR_CustomerBll.GetInstance().Update(m_user);

                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity           = m_user;
                m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;

                Page.ClientScript.RegisterStartupScript(this.GetType(), "infook", "alert('用户信息更新成功');", true);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.UserInfo.Edit", Request.UserHostAddress);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "noinfo", "alert('系统故障,请联系管理员');", true);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 执行存储过程返回DataRow
        /// </summary>
        /// <param name="StoredProcedure"></param>
        /// <returns></returns>
        public DataRow SPtoDataRow(string StoredProcedure)
        {
            DataTable ret = new DataTable();

            try
            {
                SqlParameter retpara = m_cmd.Parameters.Add("@reValue", SqlDbType.Int);
                retpara.Direction = ParameterDirection.ReturnValue;

                m_cmd.CommandText = StoredProcedure;
                m_cmd.CommandType = CommandType.StoredProcedure;
                m_conn.Open();
                SqlDataAdapter m_adpt = new SqlDataAdapter(m_cmd);
                m_adpt.Fill(ret);
                ReturnValue = m_cmd.Parameters["@reValue"].Value.ToString();
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "SQLData,相关SP:" + StoredProcedure, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress);
            }
            finally
            {
                m_conn.Close();
            }
            return(ret.Rows[0]);
        }
Beispiel #11
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button5_Click(object sender, EventArgs e)
        {
            if (txtOldPass.Text.Trim() == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('请输入旧密码');", true);
                return;
            }
            if (txtNewPass.Text.Trim() == "" || txtPassAgain.Text.Trim() == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('新的密码不能为空');", true);
                return;
            }
            if (txtNewPass.Text.Trim().Length < 6 || txtNewPass.Text.Trim().Length > 16)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码长度必须在6-16字符内!');", true);
                return;
            }
            if (txtPassAgain.Text.Trim() != txtPassAgain.Text.Trim())
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('密码输入不一致!');", true);
                return;
            }

            if (txtOldPass.Text.Trim() != GetSession().CustomerEntity.Password)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您输入的旧密码与原密码不一致,请重新输入!');", true);
                return;
            }
            if (CommonTools.CheckPasswordLevel(txtNewPass.Text.Trim()) == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "passwrong", "alert('您的密码实在太过简单,请重新输入!');", true);
                return;
            }
            else
            {
                try
                {
                    //更新数据库中的用户密码
                    m_user          = USR_CustomerBll.GetInstance().GetModel(int.Parse(Request.QueryString["id"]));
                    m_user.Password = txtNewPass.Text.Trim();
                    USR_CustomerBll.GetInstance().Update(m_user);

                    //更新session中的密码
                    SessionInfo m_session = new SessionInfo();
                    m_session.CustomerEntity           = m_user;
                    m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                    Session[AppConfig.CustomerSession] = m_session;

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "passok", "alert('修改成功');", true);
                }
                catch (Exception ex)
                {
                    LogManagement.getInstance().WriteException(ex, "WebForMain.UserPass.Edit", Request.UserHostAddress);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "nopass", "alert('系统故障,请联系管理员');", true);
                }
            }
        }
Beispiel #12
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            CMS_CategoryMod m_cate = new CMS_CategoryMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_cate = CMS_CategoryBll.GetInstance().GetModel(SysNo);

                try
                {
                    m_cate.Name   = txtName.Text.Trim();
                    m_cate.IsHide = int.Parse(drpHide.SelectedValue);
                    m_cate.DR     = int.Parse(drpStatus.SelectedValue);
                    CMS_CategoryBll.GetInstance().Update(m_cate);
                    LogManagement.getInstance().WriteTrace(m_cate.SysNo, "CMS.Category.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                    ltrNotice.Text = "该记录已保存成功!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
                }
                catch
                {
                    ltrError.Text = "输入资料格式有误,请检查!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
            }
            else if (type == "ADD")
            {
                try
                {
                    m_cate.Name        = txtName.Text.Trim();
                    m_cate.IsHide      = int.Parse(drpHide.SelectedValue);
                    m_cate.DR          = int.Parse(drpStatus.SelectedValue);
                    m_cate.TS          = DateTime.Now;
                    m_cate.ParentSysNo = Convert.ToInt32(ViewState["parent"]);
                    m_cate.TopSysNo    = CMS_CategoryBll.GetInstance().GetModel(Convert.ToInt32(ViewState["parent"])).TopSysNo;
                    CMS_CategoryBll.GetInstance().Add(m_cate);
                    LogManagement.getInstance().WriteTrace(m_cate.SysNo, "CMS.Category.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                    ltrNotice.Text = "该记录已保存成功!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
                }
                catch
                {
                    ltrError.Text = "输入资料格式有误,请检查!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
            }
        }
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            AdvTopicMod m_topic = new AdvTopicMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_topic = AdvTopicBll.GetInstance().GetModel(SysNo);

                try
                {
                    m_topic.Title = txtName.Text.Trim();
                    m_topic.Group = int.Parse(drpGroup.SelectedValue);
                    m_topic.DR    = int.Parse(drpStatus.SelectedValue);
                    AdvTopicBll.GetInstance().Update(m_topic);
                    LogManagement.getInstance().WriteTrace(m_topic.SysNo, "APP.AdvTopic.Update", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                    ltrNotice.Text = "该记录已保存成功!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
                }
                catch
                {
                    ltrError.Text = "输入资料格式有误,请检查!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
            }
            else if (type == "ADD")
            {
                try
                {
                    m_topic.Title = txtName.Text.Trim();
                    m_topic.Group = int.Parse(drpGroup.SelectedValue);
                    m_topic.DR    = int.Parse(drpStatus.SelectedValue);
                    m_topic.TS    = DateTime.Now;
                    AdvTopicBll.GetInstance().Add(m_topic);
                    LogManagement.getInstance().WriteTrace(m_topic.SysNo, "APP.AdvTopic.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                    ltrNotice.Text = "该记录已保存成功!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
                }
                catch
                {
                    ltrError.Text = "输入资料格式有误,请检查!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                    return;
                }
            }
        }
Beispiel #14
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            if (ValidateCode() && ValidateEmail())
            {
                try
                {
                    //生成6位随机新密码,并MD5加密;
                    string[] arr       = ("A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X,Y,Z,2,3,4,5,6,7,8,9").Split(',');
                    string   Password  = "";
                    int      randValue = -1;
                    Random   rand      = new Random(unchecked ((int)DateTime.Now.Ticks));
                    for (int i = 0; i < 6; i++)
                    {
                        randValue = rand.Next(0, arr.Length - 1);
                        Password += arr[randValue];
                    }
                    m_user.Password = Password;
                    USR_CustomerBll.GetInstance().Update(m_user);
                    //TCPMail oMail = new TCPMail();
                    //string url = "http://www.diafans.com/Login/LoginSuccess.aspx?opt=ValidateEmail&ID=" + this.txt_NickName.Text.Trim() + "&Email=" + this.txt_Email.Text.Trim();
                    string mailadd     = m_user.Email;
                    string mailSubject = "上上签密码找回";

                    #region SetEmailContent
                    string mailBody = CommonTools.ReadHtmFile(AppConfig.AdvFolderPath + @"EmailTemplate/FindPassword.htm");
                    mailBody.Replace("@nickname", m_user.NickName);
                    mailBody.Replace("@password", m_user.Password);
                    //mailBody.Replace("@userid", m_user.SysNo.ToString());
                    //mailBody.Replace("@md5",CommonTools.md5(m_user.NickName+m_user.Password+DateTime.Now.ToString("yyyyMMddHHmmss"),32);
                    #endregion SetEmailContent

                    //邮件发送
                    TCPMail oMail = new TCPMail();
                    oMail.Html = true;
                    if (oMail.Send(mailadd,
                                   mailSubject,
                                   mailBody))
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('邮件已发送,请注意查收!');", true);
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('发送邮件失败,请联系管理员!');", true);
                    }
                }
                catch (Exception exp)
                {
                    LogManagement.getInstance().WriteException(exp, "FindPass", Request.UserHostAddress);
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "emailsend", "alert('发送邮件失败,请联系管理员!');", true);
                }
            }
        }
Beispiel #15
0
        public void LoginCheck(string username, string password)
        {
            SYS_AdminMod m_admin = SYS_AdminBll.GetInstance().CheckAdmin(username, password);

            if (m_admin.CustomerSysNo != AppConst.IntNull)//COOKIES验证成功
            {
                WebForAnalyse.SessionInfo m_session = new SessionInfo();
                m_session.AdminEntity           = m_admin;
                m_session.PrivilegeDt           = SYS_AdminBll.GetInstance().GetAdminPrivilege(m_admin.CustomerSysNo);
                Session[AppConfig.AdminSession] = m_session;
                //记住我
                if (CheckBox1.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000Admin");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000Admin");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000Admin", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000Admin", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace(m_session.AdminEntity, "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.AdminEntity.Username);
                //跳转
                if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
                {
                    Response.Redirect(Request.QueryString["url"]);
                }
                else
                {
                    Response.Redirect("BaZi/PatternList.aspx");
                }
            }
            else
            {
                this.ltrNotice.Text = "用户名或密码错误!";
                base.ClientScript.RegisterStartupScript(base.GetType(), "", "document.getElementById('" + divNotice.ClientID + "').style.display='';", true);
            }
        }
Beispiel #16
0
 /// <summary>
 /// 执行SQL语句无返回(SQL语句必须过滤参数)
 /// </summary>
 /// <param name="CommandText"></param>
 public void CmdtoNone(string CommandText)
 {
     try
     {
         m_cmd.CommandText = CommandText;
         m_conn.Open();
         m_cmd.ExecuteNonQuery();
         ReturnValue = "1";
     }
     catch (Exception ex)
     {
         LogManagement.getInstance().WriteException(ex, "SQLData,相关SQL语句:" + CommandText, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress);
         ReturnValue = "0";
     }
     finally
     {
         m_conn.Close();
     }
 }
Beispiel #17
0
        protected void Unnamed2_Click(object sender, EventArgs e)
        {
            string username = txtEmail.Text.Trim();
            string password = txtPass.Text.Trim();

            #region 验证邮箱有效性
            #endregion

            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password);
            if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功
            {
                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity           = m_user;
                m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;
                //记住我
                if (chkRemember.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|AdminID:" + m_session.CustomerEntity.Email);
                //跳转
                Response.Redirect("Qin/View/" + m_user.SysNo);
            }
            else
            {
                Response.Redirect("Passport/Login.aspx?email=" + txtEmail.Text.Trim() + "&error=" + (int)AppEnum.ErrorType.WrongAccount);
            }
        }
Beispiel #18
0
 public string GetTopicByPhone(string PhoneNum, string TimeStamp, string sign)
 {
     if (CommonTools.md5(PhoneNum + TimeStamp + AppConfig.AnXin360Key(), 32) == sign.ToLower())
     {
         try
         {
             return(SearchTopic(PhoneNum));
         }
         catch (Exception ex)
         {
             LogManagement.getInstance().WriteException(ex, "AnXin360App", "", "通过手机号获取推广主题");
             return("Service Error");
         }
     }
     else
     {
         return("Wrong Key");
     }
 }
Beispiel #19
0
        protected void Unnamed2_Click(object sender, EventArgs e)
        {
            try
            {
                USR_SMSMod m_sms = new USR_SMSMod();
                m_sms.Context       = SQLData.SQLFilter(txtReply.Text.Trim());
                m_sms.DR            = (int)AppEnum.State.normal;
                m_sms.FromSysNo     = GetSession().CustomerEntity.SysNo;
                m_sms.IsFromDeleted = (int)AppEnum.BOOL.False;
                m_sms.IsRead        = (int)AppEnum.BOOL.False;
                m_sms.IsToDeleted   = (int)AppEnum.BOOL.False;
                if (SysNo != 0)
                {
                    m_sms.Parent = SysNo;
                }
                else
                {
                    m_sms.Parent = 0;
                }
                m_sms.ReplyCount = 0;
                m_sms.Title      = "";
                m_sms.TS         = DateTime.Now;
                m_sms.ToSysNo    = TargetID;

                int tmp = USR_SMSBll.GetInstance().AddSMS(m_sms);

                if (SysNo != 0)
                {
                    BindList();
                    ClientScript.RegisterStartupScript(this.GetType(), "reply", "alert('发送成功!');", true);
                }
                else
                {
                    Response.Redirect("MsgDetail.aspx?id=" + tmp);
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "reply", "alert('系统故障,请重新尝试');", true);
                LogManagement.getInstance().WriteException(ex, "SMS-reply", Request.UserHostAddress, "发送短信失败");
            }
        }
Beispiel #20
0
        public void LoginCheck(string username, string password)
        {
            USR_CustomerMod m_user = USR_CustomerBll.GetInstance().CheckUser(username, password);

            if (m_user.SysNo != AppConst.IntNull)//COOKIES验证成功
            {
                SetSession(m_user);
                //记住我
                if (CheckBox1.Checked)
                {
                    HttpCookie Cookie = CookiesHelper.GetCookie("upup1000");
                    if (Cookie == null || Cookie.Value == null || Cookie.Value == "")
                    {
                        Cookie = new HttpCookie("upup1000");
                        Cookie.Values.Add("uname", CommonTools.Encode(username));
                        Cookie.Values.Add("psd", CommonTools.Encode(password));
                        //设置Cookie过期时间
                        Cookie.Expires = DateTime.Now.AddYears(50);
                        CookiesHelper.AddCookie(Cookie);
                    }
                    else
                    {
                        CookiesHelper.SetCookie("upup1000", "uname", CommonTools.Encode(username), DateTime.Now.AddYears(50));
                        CookiesHelper.SetCookie("upup1000", "psd", CommonTools.Encode(password), DateTime.Now.AddYears(50));
                    }
                }
                LogManagement.getInstance().WriteTrace("前台会员登录", "Login", "IP:" + Request.UserHostAddress + "|UserID:" + GetSession().CustomerEntity.Email);
                //跳转
                if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
                {
                    Response.Redirect(Request.QueryString["url"]);
                }
                else
                {
                    Response.Redirect("../Qin/View/" + m_user.SysNo);
                }
            }
            else
            {
                password1Tip.InnerHtml = AppEnum.GetErrorType(2);
            }
        }
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text.Trim() == "")
            {
                ltrError.Text = "请输入标题!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (txtContext.Text.Trim() == "")
            {
                ltrError.Text = "请输入内容!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }

            try
            {
                USR_NoticeMod m_notice = new USR_NoticeMod();
                m_notice.Condition   = txtWhere.Text.Trim();
                m_notice.Context     = txtContext.Text.Trim();
                m_notice.DR          = (int)AppEnum.State.prepare;
                m_notice.Title       = txtTitle.Text.Trim();
                m_notice.TS          = DateTime.Now;
                m_notice.CustomerNum = 0;
                USR_NoticeBll.GetInstance().Add(m_notice);

                LogManagement.getInstance().WriteTrace(m_notice.SysNo, "Notice.Send", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                ltrNotice.Text = "该消息已添加到发送队列中!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);

                PrepareForm();
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "Notice.Send", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                ltrError.Text = "系统错误,请检查!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
        }
Beispiel #22
0
        /// <summary>
        /// 执行SQL语句返回DataRow(SQL语句必须过滤参数)
        /// </summary>
        /// <param name="CommandText"></param>
        /// <returns></returns>
        public DataRow CmdtoDataRow(string CommandText)
        {
            DataTable ret = new DataTable();

            try
            {
                m_cmd.CommandText = CommandText;
                m_conn.Open();
                SqlDataAdapter m_adpt = new SqlDataAdapter(m_cmd);
                m_adpt.Fill(ret);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "SQLData,相关SQL语句:" + CommandText, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress);
            }
            finally
            {
                m_conn.Close();
            }
            return(ret.Rows[0]);
        }
Beispiel #23
0
        /// <summary>
        /// 执行存储过程无返回
        /// </summary>
        /// <param name="StoredProcedure"></param>
        public void SPtoNone(string StoredProcedure)
        {
            try
            {
                SqlParameter retpara = m_cmd.Parameters.Add("@reValue", SqlDbType.Int);
                retpara.Direction = ParameterDirection.ReturnValue;

                m_cmd.CommandText = StoredProcedure;
                m_cmd.CommandType = CommandType.StoredProcedure;
                m_conn.Open();
                m_cmd.ExecuteNonQuery();
                ReturnValue = m_cmd.Parameters["@reValue"].Value.ToString();
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "SQLData,相关SP:" + StoredProcedure, HttpContext.Current.Request.RawUrl + " | " + HttpContext.Current.Request.UserHostAddress);
            }
            finally
            {
                m_conn.Close();
            }
        }
Beispiel #24
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         SYS_Famous_CommentMod m_comment = new SYS_Famous_CommentMod
         {
             Context       = base.Server.HtmlEncode(this.TextBox1.Text.Trim()),
             CustomerSysNo = base.GetSession().CustomerEntity.SysNo,
             DR            = 0,
             FamousSysNo   = this.sysno,
             TS            = DateTime.Now
         };
         SYS_Famous_CommentBll.GetInstance().Add(m_comment);
         this.BindComment();
         this.TextBox1.Text = "";
         ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "addcomment", "alert('评论发布成功!');", true);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.UpdatePanel1.GetType(), "addcomment", "alert('系统错误,请联系管理员!');", true);
         LogManagement.getInstance().WriteException(ex, "FamousComment-Add", base.Request.UserHostAddress, "发布评论失败");
     }
 }
Beispiel #25
0
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            if (drpQACate.SelectedIndex == 0)
            {
                ltrError.Text = "请选择问答分类!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            if (REL_Customer_CategoryBll.GetInstance().HasRecord(int.Parse(Request.QueryString["user"]), int.Parse(drpQACate.SelectedValue), (int)AppEnum.CategoryType.QA))
            {
                ltrError.Text = "该用户已经是该分类的版主了!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            REL_Customer_CategoryMod m_medal = new REL_Customer_CategoryMod();

            m_medal.CustomerSysNo = int.Parse(Request.QueryString["user"]);
            m_medal.CategorySysNo = int.Parse(drpQACate.SelectedValue);
            m_medal.Type          = (int)AppEnum.CategoryType.QA;
            m_medal.TS            = DateTime.Now;
            m_medal.DR            = 0;
            try
            {
                REL_Customer_CategoryBll.GetInstance().Add(m_medal);
                LogManagement.getInstance().WriteTrace(m_medal.SysNo, "CustomerMedal.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);

                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
                PrepareForm();
            }
            catch
            {
                ltrError.Text = "系统错误,添加失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
        }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表

                    //商户订单号

                    string out_trade_no = Request.QueryString["out_trade_no"];
                    orderID = out_trade_no;
                    //支付宝交易号

                    string trade_no = Request.QueryString["trade_no"];

                    //交易状态
                    string trade_status = Request.QueryString["trade_status"];


                    if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS")
                    {
                        succ = true;
                        if (out_trade_no.Contains("C"))
                        {
                            ordertype = 1;
                        }
                        else if (out_trade_no.Contains("P"))
                        {
                            ordertype = 2;
                        }
                        ORD_CashMod m_mod = ORD_CashBll.GetInstance().GetModelByOrderID(out_trade_no);
                        if (m_mod == null)
                        {
                            ShowError("");//订单号错误
                        }
                        if (m_mod.Status == (int)AppEnum.CashOrderStatus.beforepay)
                        {
                            m_mod.CurrentID = trade_no;//记录支付流水号
                            ORD_CashBll.GetInstance().SetPaySucc(m_mod);
                        }
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序
                    }
                    else
                    {
                        LogManagement.getInstance().WriteTrace("订单" + orderID + "支付宝返回" + Request.QueryString["trade_status"], "PayReturnForAlipay", base.Request.UserHostAddress);
                    }

                    //打印页面
                    ShowResult();

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    LogManagement.getInstance().WriteTrace("订单" + orderID + "支付宝返回验证失败", "PayReturnForAlipay", base.Request.UserHostAddress);
                }
            }
            else
            {
                LogManagement.getInstance().WriteTrace("支付宝返回无参数", "PayReturnForAlipay", base.Request.UserHostAddress);
                ShowError("请从正确的入口进入");
            }
        }
Beispiel #27
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            #region 验证输入
            if (!ValidateCode())
            {
                code.Text = "";
                return;
            }
            if (!ValidateEmail())
            {
                code.Text = "";
                return;
            }
            if (!ValidatePass())
            {
                code.Text = "";
                return;
            }
            if (!ValidateNickName())
            {
                code.Text = "";
                return;
            }

            #endregion

            #region 保存数据
            USR_CustomerMod m_user = new USR_CustomerMod();
            try
            {
                m_user.Email         = email.Text.Trim();
                m_user.FateType      = int.Parse(drpType.SelectedValue);
                m_user.GradeSysNo    = AppConst.OriginalGrade;;
                m_user.NickName      = name.Text.Trim();
                m_user.Password      = password1.Text.Trim();
                m_user.RegTime       = DateTime.Now;
                m_user.Point         = AppConst.OriginalPoint;
                m_user.Photo         = AppConst.OriginalPhoto;
                m_user.LastLoginTime = DateTime.Now;
                if (AppConfig.RegisterEmailCheck.ToLower() == "true")
                {
                    m_user.Status = (int)AppEnum.State.prepare;
                }
                else
                {
                    m_user.Status = (int)AppEnum.State.normal;
                }

                m_user.Credit         = 0;
                m_user.Birth          = AppConst.DateTimeNull;
                m_user.IsShowBirth    = 1;
                m_user.IsStar         = 0;
                m_user.BestAnswer     = 0;
                m_user.TotalAnswer    = 0;
                m_user.TotalQuest     = 0;
                m_user.HomeTown       = AppConst.IntNull;
                m_user.Intro          = AppConst.OriginalIntro;
                m_user.Signature      = AppConst.OriginalSign;
                m_user.Exp            = 0;
                m_user.TotalReply     = 0;
                m_user.HasNewInfo     = 0;
                m_user.TotalTalk      = 0;
                m_user.TotalTalkReply = 0;
                m_user.SetOrderCount  = 0;
                m_user.BuyOrderCount  = 0;
                m_user.SellOrderCount = 0;
                m_user.TotalSellRMB   = 0;
                m_user.TotalBuyRMB    = 0;
                m_user.TotalBuyPoint  = 0;


                m_user.SysNo = USR_CustomerBll.GetInstance().Add(m_user);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "WebForMain.Register", Request.UserHostAddress);
                return;
            }
            #endregion

            #region 发送验证邮件
            if (AppConfig.RegisterEmailCheck.ToLower() == "true")
            {
            }
            #endregion

            #region 登陆状态设置
            if (!(AppConfig.RegisterEmailCheck.ToLower() == "true"))
            {
                SessionInfo m_session = new SessionInfo();
                m_session.CustomerEntity           = m_user;
                m_session.GradeEntity              = USR_GradeBll.GetInstance().GetModel(m_user.SysNo);
                Session[AppConfig.CustomerSession] = m_session;
            }
            #endregion
            if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
            {
                Response.Redirect("RegisterSucc.aspx?url=" + Request.QueryString["url"]);
            }
            else
            {
                Response.Redirect("RegisterSucc.aspx");
            }
        }
Beispiel #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]);

                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                    //商户订单号

                    string out_trade_no = Request.Form["out_trade_no"];
                    orderID = out_trade_no;
                    //支付宝交易号

                    string trade_no = Request.Form["trade_no"];

                    //交易状态
                    string trade_status = Request.Form["trade_status"];


                    if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS")
                    {
                        succ = true;
                        if (out_trade_no.Contains("C"))
                        {
                            ordertype = 1;
                        }
                        else if (out_trade_no.Contains("P"))
                        {
                            ordertype = 2;
                        }
                        ORD_CashMod m_mod = ORD_CashBll.GetInstance().GetModelByOrderID(out_trade_no);
                        if (m_mod == null)
                        {
                            ShowError("");//订单号错误
                        }
                        if (m_mod.Status == (int)AppEnum.CashOrderStatus.beforepay)
                        {
                            m_mod.CurrentID = trade_no;//记录支付流水号
                            ORD_CashBll.GetInstance().SetPaySucc(m_mod);
                        }
                        //判断该笔订单是否在商户网站中已经做过处理
                        //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                        //如果有做过处理,不执行商户的业务程序

                        //注意:
                        //该种交易状态只在两种情况下出现
                        //1、开通了普通即时到账,买家付款成功后。
                        //2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。
                    }
                    //else if (Request.Form["trade_status"] == "TRADE_SUCCESS")
                    //{
                    //    //判断该笔订单是否在商户网站中已经做过处理
                    //    //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                    //    //如果有做过处理,不执行商户的业务程序

                    //    //注意:
                    //    //该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。
                    //}
                    else
                    {
                        LogManagement.getInstance().WriteTrace("订单" + orderID + "支付宝返回" + Request.QueryString["trade_status"], "PayReturnForAlipay", base.Request.UserHostAddress);
                    }

                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    Response.Write("success");  //请不要修改或删除

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Beispiel #29
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            Login(Request.Url.ToString());
            #region 判断输入项
            if (drpCate.SelectedIndex == 0)
            {
                CateTip.InnerHtml           = "请选择分类";
                CateTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }
            if (txtTitle.Text.Trim() == "")
            {
                TitleTip.InnerHtml           = "请输入标题";
                TitleTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }
            if (txtTitle.Text.Trim().Length > 200)
            {
                TitleTip.InnerHtml           = "您输入的标题太长,请控制在200字以内";
                TitleTip.Attributes["class"] = "err";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true);
                return;
            }

            #endregion

            try
            {
                QA_QuestionMod m_quest = new QA_QuestionMod();
                m_quest.Award         = 0;
                m_quest.CateSysNo     = int.Parse(drpCate.SelectedValue);
                m_quest.Context       = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(txtContext.Text.Trim()));
                m_quest.CustomerSysNo = GetSession().CustomerEntity.SysNo;
                m_quest.LastReplyTime = DateTime.Now;
                m_quest.ReplyCount    = 0;
                m_quest.ReadCount     = 0;
                m_quest.BuyCount      = 0;
                m_quest.OrderCount    = 0;
                m_quest.Title         = AppCmn.CommonTools.SystemInputFilter(txtTitle.Text.Trim());
                m_quest.TS            = DateTime.Now;
                m_quest.DR            = (int)AppEnum.State.normal;

                int sysno = 0;

                QA_QuestionBll.GetInstance().AddQuest(ref m_quest, false);
                sysno = m_quest.SysNo;
                RefreshSession();

                FATE_ChartMod m_chart = new FATE_ChartMod();
                m_chart.CharType = int.Parse(drpType.SelectedValue);
                if (m_chart.CharType != (int)AppEnum.ChartType.nochart)
                {
                    m_chart.FirstBirth    = DatePicker1.SelectedTime;
                    m_chart.FirstPoi      = District1.lng + "|" + District1.lat;
                    m_chart.Transit       = DateTime.Now;
                    m_chart.TransitPoi    = m_chart.FirstPoi;
                    m_chart.TheoryType    = 0;
                    m_chart.FirstPoiName  = District1.Area1Name + "-" + District1.Area2Name + "-" + District1.Area3Name;
                    m_chart.FirstTimeZone = -8;
                    m_chart.FirstGender   = int.Parse(drpGender1.SelectedValue);
                    if (chkDaylight1.Checked)
                    {
                        m_chart.FirstDayLight = (int)AppEnum.BOOL.True;
                    }
                    else
                    {
                        m_chart.FirstDayLight = (int)AppEnum.BOOL.False;
                    }
                    if (m_chart.CharType == (int)AppEnum.ChartType.relation)
                    {
                        m_chart.SecondBirth    = DatePicker2.SelectedTime;
                        m_chart.SecondPoi      = District2.lng + "|" + District2.lat;
                        m_chart.SecondPoiName  = District2.Area1Name + "-" + District2.Area2Name + "-" + District2.Area3Name;
                        m_chart.SecondTimeZone = -8;
                        m_chart.SecondGender   = int.Parse(drpGender2.SelectedValue);
                        if (chkDaylight2.Checked)
                        {
                            m_chart.SecondDayLight = (int)AppEnum.BOOL.True;
                        }
                        else
                        {
                            m_chart.SecondDayLight = (int)AppEnum.BOOL.False;
                        }
                    }
                    m_chart.TS = DateTime.Now;
                    m_chart.DR = (int)AppEnum.State.normal;
                    int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart);

                    REL_Question_ChartMod m_qchart = new REL_Question_ChartMod();
                    m_qchart.Chart_SysNo    = fatesysno;
                    m_qchart.Question_SysNo = sysno;
                    REL_Question_ChartBll.GetInstance().Add(m_qchart);
                }



                LogManagement.getInstance().WriteTrace("前台话题", "Ask", "IP:" + Request.UserHostAddress + "|UID:" + GetSession().CustomerEntity.Email);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('话题发布成功!');", true);
                Response.Redirect(AppConfig.HomeUrl() + "Quest/Topic/" + sysno, false);
            }
            catch (Exception ex)
            {
                LogManagement.getInstance().WriteException(ex, "QA-Add", Request.UserHostAddress, "发布话题失败");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('系统故障,请联系管理员!');", true);
            }
        }
Beispiel #30
0
        protected void Unnamed3_Click(object sender, EventArgs e)
        {
            string[]      keys     = this.txtKey.Text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            DataTable     m_keys   = new DataTable();
            SYS_FamousMod m_famous = new SYS_FamousMod();

            if (type == "EDIT")
            {
                if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
                {
                    SysNo = int.Parse(Request.QueryString["id"]);
                }
                m_famous = SYS_FamousBll.GetInstance().GetModel(SysNo);
                m_keys   = REL_Famous_KeyWordBll.GetInstance().GetFamousList(SysNo);
            }
            try
            {
                m_famous.BirthYear = int.Parse(txtYear.Text);
                m_famous.BirthTime = new DateTime(AppConst.DateTimeNull.Year, int.Parse(txtMonth.Text), int.Parse(txtDay.Text),
                                                  int.Parse(txtHour.Text), int.Parse(txtMinute.Text), 0);
                m_famous.CateSysNo     = int.Parse(drpCate.SelectedValue);
                m_famous.CustomerSysNo = GetSession().AdminEntity.CustomerSysNo;
                m_famous.Description   = txtDesc.Text;
                m_famous.FullName      = txtFullName.Text;
                m_famous.Gender        = int.Parse(drpGender.SelectedValue);
                if (txtHeight.Text != AppConst.StringNull)
                {
                    m_famous.Height = int.Parse(txtHeight.Text);
                }
                if (drpDistrict3.SelectedValue == "0")
                {
                    ltrError.Text = "请选择第三级地区!";
                    this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                }
                m_famous.HomeTown = int.Parse(drpDistrict3.SelectedValue);
                m_famous.Name     = txtName.Text;
                if (type == "INPUT")
                {
                    m_famous.Source = "AstroTheme";
                }
                else
                {
                    m_famous.Source = "手动添加";
                }
                m_famous.TimeUnknown = int.Parse(chkTime.SelectedValue);
            }
            catch
            {
                ltrError.Text = "输入资料格式有误,请检查!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                return;
            }
            try
            {
                if (type == "ADD")
                {
                    m_famous.SysNo = SYS_FamousBll.GetInstance().Add(m_famous);
                    for (int i = 0; i < keys.Length; i++)
                    {
                        SYS_Famous_KeyWordsMod tmp_key = new SYS_Famous_KeyWordsMod();
                        tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().GetSysNoByName(keys[i]);
                        if (tmp_key.SysNo == AppConst.IntNull)
                        {
                            tmp_key.KeyWords = keys[i];
                            tmp_key.SysNo    = SYS_Famous_KeyWordsBll.GetInstance().Add(tmp_key);
                        }
                        REL_Famous_KeyWordMod tmp_rel = new REL_Famous_KeyWordMod();
                        tmp_rel.Famous_SysNo  = m_famous.SysNo;
                        tmp_rel.KeyWord_SysNo = tmp_key.SysNo;
                        REL_Famous_KeyWordBll.GetInstance().Add(tmp_rel);
                    }
                    LogManagement.getInstance().WriteTrace(m_famous.SysNo, "Celebrity.Add", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                else if (type == "EDIT")
                {
                    SYS_FamousBll.GetInstance().Update(m_famous);
                    REL_Famous_KeyWordBll.GetInstance().RemoveAllKeyByFamous(m_famous.SysNo);
                    for (int i = 0; i < keys.Length; i++)
                    {
                        SYS_Famous_KeyWordsMod tmp_key = new SYS_Famous_KeyWordsMod();
                        tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().GetSysNoByName(keys[i]);
                        if (tmp_key.SysNo == AppConst.IntNull)
                        {
                            tmp_key.KeyWords = keys[i];
                            tmp_key.SysNo    = SYS_Famous_KeyWordsBll.GetInstance().Add(tmp_key);
                        }
                        REL_Famous_KeyWordMod tmp_rel = new REL_Famous_KeyWordMod();
                        tmp_rel.Famous_SysNo  = m_famous.SysNo;
                        tmp_rel.KeyWord_SysNo = tmp_key.SysNo;
                        REL_Famous_KeyWordBll.GetInstance().Add(tmp_rel);
                    }
                    LogManagement.getInstance().WriteTrace(m_famous.SysNo, "Celebrity.Edit", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                else if (type == "INPUT")
                {
                    m_famous.SysNo = SYS_FamousBll.GetInstance().Add(m_famous);
                    int           spider   = int.Parse(Request.QueryString["id"]);
                    SPD_FamousMod m_spider = SPD_FamousBll.GetInstance().GetModel(spider);
                    m_spider.FamousSysNo = m_famous.SysNo;
                    SPD_FamousBll.GetInstance().Update(m_spider);
                    for (int i = 0; i < keys.Length; i++)
                    {
                        SYS_Famous_KeyWordsMod tmp_key = new SYS_Famous_KeyWordsMod();
                        tmp_key.SysNo = SYS_Famous_KeyWordsBll.GetInstance().GetSysNoByName(keys[i]);
                        if (tmp_key.SysNo == AppConst.IntNull)
                        {
                            tmp_key.KeyWords = keys[i];
                            tmp_key.SysNo    = SYS_Famous_KeyWordsBll.GetInstance().Add(tmp_key);
                        }
                        REL_Famous_KeyWordMod tmp_rel = new REL_Famous_KeyWordMod();
                        tmp_rel.Famous_SysNo  = m_famous.SysNo;
                        tmp_rel.KeyWord_SysNo = tmp_key.SysNo;
                        REL_Famous_KeyWordBll.GetInstance().Add(tmp_rel);
                    }
                    LogManagement.getInstance().WriteTrace(m_famous.SysNo, "Celebrity.Input", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
                }
                ltrNotice.Text = "该记录已保存成功!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';", true);
            }
            catch (Exception ex)
            {
                ltrError.Text = "系统错误,保存失败!";
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('errordiv').style.display='';closeforseconds();", true);
                LogManagement.getInstance().WriteException(ex, "Celebrity.Save", "IP:" + Request.UserHostAddress + "|AdminID:" + GetSession().AdminEntity.Username);
            }
        }