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(); } }
public static bool BoolenYanzhong(int order_id) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); int conditionId = Convert.ToInt32(conn.GetItem("select conditionId from Y_Order where orderId='" + order_id + "'", "0")); if ((conditionId != 3 && conditionId != 4 && conditionId != 5) || conditionId == 0) { return false; } else { //查询获得最新的一个更新时间 DateTime changeTime = Convert.ToDateTime(conn.GetItem("select top 1 changeTime from Y_OrderChange where orderId='" + order_id + "' order by changeTime desc", "0001/1/1 0:00:00")); if (changeTime.ToString() != "0001/1/1 0:00:00") { int yanzhongTime = Convert.ToInt32(conn.GetItem("select yanzhong from Y_Chaoshi where conditionId='" + conditionId + "'", "0")); TimeSpan ts = DateTime.Now - changeTime;//获得两个时间差 if (ts.TotalHours >= yanzhongTime)//ts.TotalHours把时间差转换为小时 { return true; } else { return false; } } else { return false; } } }
public static bool BoolenYanzhong(int order_id) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); int conditionId = Convert.ToInt32(conn.GetItem("select conditionId from Y_Order where orderId='" + order_id + "'", "0")); if ((conditionId != 3 && conditionId != 4 && conditionId != 5) || conditionId == 0) { conn.Close(); return false; } else { string time = ""; //待安装 if (conditionId == 5) { time = conn.GetItem("select top 1 subscribeTime from Y_OrderChange where orderId='" + order_id + "' order by changeTime desc", "0001/1/1 0:00:00"); } //待确认需电联 else { time = conn.GetItem("select top 1 changeTime from Y_OrderChange where orderId='" + order_id + "' order by changeTime desc", "0001/1/1 0:00:00"); } if (time != "") { DateTime Time = Convert.ToDateTime(time); if (Time.ToString() != "0001/1/1 0:00:00") { int yanzhongTime = Convert.ToInt32( conn.GetItem("select yanzhong from Y_Chaoshi where conditionId='" + conditionId + "'", "0")); conn.Close(); TimeSpan ts = DateTime.Now - Time; //获得两个时间差 if (ts.TotalHours >= yanzhongTime) //ts.TotalHours把时间差转换为小时 { return true; } else { return false; } } else { conn.Close(); return false; } } else { conn.Close(); return false; } } }
public static bool BoolenYiban(int order_id) { SqlServerProvider conn = new SqlServerProvider(); conn.Open(); int conditionId = Convert.ToInt32(conn.GetItem("select conditionId from Y_Order where orderId='" + order_id + "'", "0")); if ((conditionId != 3 && conditionId != 4 && conditionId != 5) || conditionId == 0) { return false; } else { //查询获得最新的一个更新时间 DateTime changeTime = Convert.ToDateTime(conn.GetItem("select top 1 changeTime from Y_OrderChange where orderId='" + order_id + "' order by changeTime desc", "0001/1/1 0:00:00"));//这里随便写个查不到的时间,防止查不到的时候出错 if (changeTime.ToString() != "0001/1/1 0:00:00") { DataSet ds = new DataSet(); ds = conn.GetDataSet("select yiban,yanzhong from Y_Chaoshi where conditionId='" + conditionId + "'", ds, "t1"); int yibanTime = Convert.ToInt32(ds.Tables["t1"].Rows[0]["yiban"]); int yanzhongTime = Convert.ToInt32(ds.Tables["t1"].Rows[0]["yanzhong"]); TimeSpan ts = DateTime.Now - changeTime;//获得两个时间差 if (ts.TotalHours > yibanTime && ts.TotalHours < yanzhongTime)//ts.TotalHours把时间差转换为小时 { return true; } else { return false; } } else { return false; } } }