Ejemplo n.º 1
0
 public SqlOperate()
 {
     if (mySS != null)
     {
         mySS = null;
     }
     mySS = new YM.Data.SqlScope(System.Configuration.ConfigurationSettings.AppSettings["connectionStr"]);
 }
        public void SetOutNumber(string id, string outtype, string number)
        {
            YM.Data.SqlScope ss = Dal.Sqler.Instance();
            using (ss.EnterQuery())
            {
                //消防
                if (number != "")
                {
                    int outnum = int.Parse(number);

                    //删除实时报警信息
                    string    select = "select *  from T_Out_Set where FPumpID='" + id + "' and FType='" + outtype + "' and FIndex > '" + outnum + "'";
                    DataTable dt     = ss.ExecuteDataTable(select);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string name      = dt.Rows[i]["FName"].ToString();
                        string sqldelete = @"delete from T_Alarm where FPumpID = '" + id + "' and  (T_Alarm.FContent ='" + name + "出水压力超高报警' or T_Alarm.FContent ='" + name + "出水压力超低报警')";
                        ss.ExecuteNonQuery(sqldelete);
                    }

                    //删除管道设置
                    string del = "delete from T_Out_Set where FPumpID='" + id + "' and FType='" + outtype + "' and FIndex > '" + outnum + "'";
                    ss.ExecuteNonQuery(del);

                    //增加多出的管道
                    for (int i = 0; i < outnum; i++)
                    {
                        int num = i + 1;

                        string    sqlselect = "select * from T_Out_Set where FPumpID='" + id + "' and FType='" + outtype + "' and FIndex ='" + num + "'";
                        DataTable dtselect  = ss.ExecuteDataTable(sqlselect);
                        if (dtselect.Rows.Count == 0)
                        {
                            string sqlinsert = "INSERT INTO [dbo].T_Out_Set([FPumpID],[FType],[FIndex],[FName])VALUES('" + id + "','" + outtype + "','" + num + "','" + outtype + "管道" + num + "号')";
                            ss.ExecuteNonQuery(sqlinsert);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     // TODO:  添加 SqlOperate.Dispose 实现
     mySS.Dispose();
     mySS = null;
 }