示例#1
0
    protected void BtnLogin_Click(object sender, EventArgs e)
    {
        if (AuthenticationCode1.AuthenticationCodeValidate(yanZheng.Text.Trim()))
        {
            string userName = CommonFunction.FilterSqlStr(Request.Form["userName"]);
                string passWord = Request.Form["passWord"];
                if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(passWord))
                {
                    Response.Write("<Script language=JavaScript>alert('账号密码输入有误,请重新输入!');window.location.href='index.aspx';</script>");
                }
                else
                {
                    passWord = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(passWord, "MD5");
                    string sql=string.Empty;
                    string userRole = string.Empty;
                    if(yuangong.Checked==true)
                    {
                        sql = "select * from Y_Admin where userName='******' and passWord='******' and isLock=0";
                    }
                    else if (merchant.Checked)
                    {
                        sql = "select * from Y_Merchant where userName='******' and passWord='******' and isLock=0";
                    }
                    SqlServerProvider conn = new SqlServerProvider();
                    conn.Open();
                    if (conn.ExistData(sql))
                    {
                        if (yuangong.Checked)
                        {
                            Session["userName"] = userName.ToString();
                            Session["UserIdentity"] = "manager";
                            userRole = "admin";
                        }
                        else if (merchant.Checked)
                        {
                            Session["userName"] = userName.ToString();
                            Session["UserIdentity"] = "merchant";
                            userRole = "merchant";
                        }
                        UpdateLogin(userName);
                        AccountSystem(userName, userRole);
                    }
                    else
                    {
                        Response.Write("<Script language=JavaScript>alert('账号或密码错误,请重新输入!');window.location.href='index.aspx';</script>");
                    }
                    conn.Close();
                }
        }
        else
        {
            Response.Write("<Script language=JavaScript>alert('验证码输入有误,请重新输入!');window.location.href='index.aspx';</script>");
        }

    }
示例#2
0
    protected void BtnSaveEditCity_Click(object sender, EventArgs e)
    {
        string id = Request.QueryString["id"];
        int idd = Convert.ToInt32(id);
        if (string.IsNullOrEmpty(TxtEditCity.Text.Trim()))
        {
            Response.Write("<script>alert('不能为空!');window.history.go(-1);</script>");
        }
        else
        {
            SqlServerProvider conn = new SqlServerProvider();
            conn.Open();
            string proId = conn.GetItem("select c.provinceId from Y_City c left outer join Y_Area a on a.cityId=c.cityId where a.areaId='" + idd + "'", "0");
            string sql = "select * from Y_City where cityName='" + TxtEditCity.Text.ToString().Trim() + "' and provinceId='"+Convert.ToInt32(proId)+"'";
            if (proId != "0")
            {
                if (conn.ExistData(sql))
                {
                    Response.Write("<script>alert('该市已存在!请重新输入');window.history.go(-1);</script>");
                }
                else
                {
                    string cityId = conn.GetItem("select cityId from Y_Area where areaId='"+idd+"'", "0");
                    if (cityId != "0")
                    {
                        conn.Execute("update Y_City set cityName='" + TxtEditCity.Text.Trim() + "' where cityId='" + Convert.ToInt32(cityId) + "'");
                        conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('修改市," + TxtEditPro.Text.Trim() + "','" + DateTime.Now + "','" + Session["userName"] + "')");
                        Response.Write("<script>alert('修改市成功!');window.history.go(-1);</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('修改失败!');window.history.go(-1);</script>");
                    }

                }
            }
            else
            {
                Response.Write("<script>alert('修改失败!');window.history.go(-1);</script>");
            }
            
            conn.Close();
        }
    }
示例#3
0
 protected void BtnEditSave_Click(object sender, EventArgs e)
 {
     //if (string.IsNullOrEmpty(TxtEditPro.Text.Trim()))
     //{
     //    Response.Write("<script>alert('省不能为空!');window.history.go(-1);</script>");
     //}
     //else if (string.IsNullOrEmpty(TxtEditCity.Text.Trim()))
     //{
     //    Response.Write("<script>alert('市不能为空!');window.history.go(-1);</script>");
     //}
     //else 
     string id = Request.QueryString["id"];
     int idd = Convert.ToInt32(id);
     if(string.IsNullOrEmpty(TxtEditArea.Text.Trim()))
     {
         Response.Write("<script>alert('地区不能为空!');window.history.go(-1);</script>");
     }
     else
     {
         SqlServerProvider conn = new SqlServerProvider();
         conn.Open();
         string sql = "select * from Y_Area a left outer join Y_City c on c.cityId=a.areaId where cityName='"+TxtEditCity.Text.ToString().Trim()+"'";
         if (conn.ExistData(sql))
         {
             Response.Write("<script>alert('该地区已存在!请重新输入');window.history.go(-1);</script>");
         }
         else
         {
             conn.Execute("update Y_Area set areaName='" + TxtEditArea.Text.Trim() + "' where areaId='"+idd+"'");
             conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('修改地区," + TxtEditArea.Text.Trim() + "','" + DateTime.Now + "','" + Session["userName"] + "')");
             Response.Write("<script>alert('修改地区成功!');window.history.go(-1);</script>");
         }
         conn.Close();
     }
 }
示例#4
0
 protected void BtnSaveArea_Click(object sender, EventArgs e)
 {
     if (DropDownListProvince2.SelectedValue == "0")
     {
         Response.Write("<script>alert('请先选择省!');window.history.go(-1);</script>");
     }
     else if (DropDownListCity.SelectedValue == "0")
     {
         Response.Write("<script>alert('请先选择市!');window.history.go(-1);</script>");
     }
     else if (string.IsNullOrEmpty(TxtArea.Text.Trim()))
     {
         Response.Write("<script>alert('请输入地区名或县名!');window.history.go(-1);</script>");
         return;
     }
     else
     {
         SqlServerProvider conn = new SqlServerProvider();
         conn.Open();
         string sql = "select * from Y_Area where areaName='" + TxtArea.Text.Trim() + "' and cityId='" + DropDownListCity.SelectedValue + "'";
         if (conn.ExistData(sql))
         {
             Response.Write("<script>alert('该地区已存在!请重新输入');window.history.go(-1);</script>");
         }
         else
         {
             conn.Execute("insert into Y_Area (areaName,cityId) values('" + TxtArea.Text.Trim() + "'," + DropDownListCity.SelectedValue + ")");
             conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('添加地区," + TxtArea.Text.Trim() + "','" + DateTime.Now + "','" + Session["userName"] + "')");
             Response.Write("<script>alert('添加地区成功!');window.history.go(-1);</script>");
         }
         conn.Close();
     }
 }
示例#5
0
 protected void BtnSavePro_Click(object sender, EventArgs e)
 {
     
     if (string.IsNullOrEmpty(TxtProvince.Text.Trim()))
     {
         Response.Write("<script>alert('请输入省份!');window.history.go(-1);</script>");
         return;
     }
     else
     {
         SqlServerProvider conn = new SqlServerProvider();
         conn.Open();
         string sql="select * from Y_Province where provinceName='"+TxtProvince.Text.Trim()+"'";
         if (conn.ExistData(sql))
         {
             Response.Write("<script>alert('该省份已存在!请重新输入');window.history.go(-1);</script>");
         }
         else
         {
             conn.Execute("insert into Y_Province (provinceName) values ('" + TxtProvince.Text.Trim() + "')");
             conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('添加省份,"+TxtProvince.Text.Trim()+"','" + DateTime.Now + "','" + Session["userName"] + "')");
             Response.Write("<script>alert('添加省份成功!');window.history.go(-1);</script>");
         }
         conn.Close();
     }
 }