示例#1
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();
        }
    }
示例#2
0
 /// <summary>
 /// 更新登陆操作日志
 /// </summary>
 protected void UpdateLogin(string username)
 {
     SqlServerProvider conn = new SqlServerProvider();
     conn.Open();
     conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName) values('登录系统~~','" + DateTime.Now + "','" + username + "')");
     conn.Close();
 }
示例#3
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();
     }
 }
示例#4
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();
     }
 }
示例#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();
     }
 }
示例#6
0
 protected void BtnReceive_Click(object sender, EventArgs e)
 {
     string str = Request["subBox"];//获得选中的checkbox的value,多个会用","隔开
     if (string.IsNullOrEmpty(str))
     {
         Response.Write("<script>alert('请先选择!');window.history.go(-1)</script>");
         return;
     }
     string[] checkbox_id = str.Split(',');
     SqlServerProvider conn = new SqlServerProvider();
     conn.Open();
     for (int i = 0; i < checkbox_id.Length; i++)
     {
         conn.Execute("update Y_Order set conditionId=2 where orderId='"+checkbox_id[i]+"'");
         conn.Execute("insert into Y_OrderChange (orderChangeTypeId,changeTime,userName,orderId) values(3,'"+DateTime.Now+"','"+Session["userName"]+"','"+checkbox_id[i]+"')");
     }
     Response.Write("<script>alert('确认成功,请在未派工单中查看已确认的工单!')</script>");
 }
示例#7
0
    //删除
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        string str = Request["subBox"];//获得选中的checkbox的value,多个会用","隔开
        if (string.IsNullOrEmpty(str))
        {
            Response.Write("<script>alert('请先选择!')</script>");
            return;
        }
        string[] checkbox_id = str.Split(',');
        SqlServerProvider conn = new SqlServerProvider();
        conn.Open();
        for (int i = 0; i < checkbox_id.Length; i++)
        {
            try
            {
                conn.Execute("delete from Y_Order where orderId='"+checkbox_id[i]+"'");
                conn.Execute("delete from Y_OrderChange where orderId='"+checkbox_id[i]+"'");
                conn.Execute("insert into Y_LogOperation (actionInfo,changeTime,userName)values('删除一张工单。','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','"+Session["userName"]+"')");//写操作日志
                
            }
            catch
            {
                Response.Write("<script>alert('删除工单失败!')</script>");
            }
        }
        Response.Write("<script>alert('删除工单成功!')</script>");
           

           
    }