public string SaveDBWithTime(string time)
    {
        LoadJson load      = new LoadJson(this._name, time, "");
        string   sRes      = load.LoadJsonLikeTime();
        string   DBcommand = "";

        if (sRes != "[]")          //已经有数据
        {
            DBcommand =
                @"UPDATE [EPInfoSystem].[dbo].[JsonTable]
					SET 
						
						[内容] ='"                         + _jsonobj + @"'
					where [时间]= '"                     + time + "' AND [表名]='" + this._name + "'";
        }
        else
        {
            DBcommand =
                @"INSERT INTO [EPInfoSystem].[dbo].[JsonTable]
            ([表名]
            ,[时间]
           ,[类型]
           ,[内容])
     VALUES
           ('" + _name + "','" + time + "','json','" + _jsonobj + "')";
        }
        string ret;
        string source = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();

        DBOper DBop = new DBOper(source, DBcommand);

        ret = DBop.ReturnRows();
        return("数据库录入成功,影响" + ret);
    }
    public static string InfoDel(string id)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"DELETE FROM [EPInfoSystem].[dbo].[CheckInfo]
									 WHERE [Id]="                                     + id;

        ret = DBOper.ReturnRows(source, DBcommand);
        return(ret);
    }
    public void DelStatus()
    {
        string _ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"DELETE FROM [EPInfoSystem].[dbo].[ListStatus]
							WHERE [时间]='"                             + this._Time + "'";
        DBOper dbcom     = new DBOper(source, DBcommand);

        _ret = dbcom.ReturnRows();
        this._MonthstatusStr = "[]";
    }
    public static string staticDelDB(string _time)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"DELETE FROM [EPInfoSystem].[dbo].[DRash]
							 WHERE [日期]='"                             + _time + "'";
        DBOper DBop      = new DBOper(source, DBcommand);

        ret = "删除成功" + DBop.ReturnRows();
        return(ret);
    }
Beispiel #5
0
    public string DelDB()
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"
							DELETE FROM [EPInfoSystem].[dbo].[CMresult]							
							WHERE [日期]='"                             + this._Time + "' AND [监测点]='" + this._Name + "'";

        DBOper DBop = new DBOper(source, DBcommand);

        ret = "删除成功" + DBop.ReturnRows();
        return(ret);
    }
    public static string DRMChange(string name, string time)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"UPDATE [EPInfoSystem].[dbo].[DRMStatus]
								SET 
								[状态] = ([状态]+1)%2
							WHERE [位置]='"                             + name + "'";
        DBOper DBop      = new DBOper(source, DBcommand);

        ret = DBop.ReturnRows();
        return(ret);
    }
Beispiel #7
0
    public string UpdateDB(string total)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"UPDATE [EPInfoSystem].[dbo].[DustSourceRecord]
								SET 
								[data] = '"                                 + this._Jsondata + @"'
								,[total]='"                                 + total + @"'
								WHERE [time] LIKE'"                                 + this._Time + "%' AND [workshop]='" + this._Workshop + "'";

        DBOper DBop = new DBOper(source, DBcommand);

        ret = DBop.ReturnRows();
        return(ret);
    }
    public static string staticUpdateDB(string _time, string _jsondata)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"
UPDATE [EPInfoSystem].[dbo].[DRash]
   SET 
      [数据] = '" + _jsondata + "'"
                           + " WHERE [日期]='" + _time + "'";

        DBOper DBop = new DBOper(source, DBcommand);

        ret = "修改成功" + DBop.ReturnRows();
        return(ret);
    }
Beispiel #9
0
    public string UpdateDB()
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"
							UPDATE [EPInfoSystem].[dbo].[CMresult]
							SET 
								[数据] = '"                                 + this._Jsondata + @"'
							WHERE [日期]='"                             + this._Time + "' AND [监测点]='" + this._Name + "'";

        DBOper DBop = new DBOper(source, DBcommand);

        ret = "修改成功" + DBop.ReturnRows();
        return(ret);
    }
    public static string ManualList(string time, string RuleId)
    {
        string DBcommand;
        string source = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();

        DBcommand = @"
								UPDATE [EPInfoSystem].[dbo].[ListStatus]
								   SET [自动] = 0
									  ,[挂牌] = ([挂牌]+1)%2
								 WHERE [时间] ='"                                 + time + "'AND [RuleId]=" + RuleId;

        DBOper dbcom = new DBOper(source, DBcommand);
        string _ret  = dbcom.ReturnRows();

        return(_ret);
    }
    public static string staticSaveToDB(string _time, string _jsondata)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"INSERT INTO [EPInfoSystem].[dbo].[DRash]
           ([日期]
           ,[修改人]
           ,[数据])
     VALUES
           ('" + _time + "'"
                           + ",'zztdan'"
                           + ",'" + _jsondata + "')";

        ret = DBOper.ReturnRows(source, DBcommand);
        return("修改成功" + ret);
    }
Beispiel #12
0
    public string InsertDB(string total)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"INSERT INTO [EPInfoSystem].[dbo].[DustSourceRecord]
								([time]
								,[workshop]
								,[data]
								,[total])
							 VALUES
								('"                                 + _Time + @"'
								,'"                                 + _Workshop + @"'
								,'"                                 + _Jsondata + @"'
								,'"                                 + total + "')";

        ret = DBOper.ReturnRows(source, DBcommand);
        return(ret);
    }
    public string SaveDB()
    {
        string ret;
        string time      = DateTime.Now.ToString();
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand =
            @"INSERT INTO [EPInfoSystem].[dbo].[JsonTable]
            ([表名]
            ,[时间]
           ,[类型]
           ,[内容])
     VALUES
           ('" + _name + "','" + time + "','json','" + _jsonobj + "')";
        DBOper DBop = new DBOper(source, DBcommand);

        ret = DBop.ReturnRows();
        return("数据库备份录入成功,影响" + ret);
    }
Beispiel #14
0
    public string SaveToDB()
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"INSERT INTO [EPInfoSystem].[dbo].[CMresult]
							([日期]
							,[监测点]
							,[类型]
							,[修改人]
							,[数据])
						VALUES
							('"                             + this._Time + @"'
							,'"                             + this._Name + @"'
							,'"                             + this._Type + @"'
							,'"                             + this._Editor + @"'
							,'"                             + this._Jsondata + "')";

        ret = DBOper.ReturnRows(source, DBcommand);
        return("修改成功" + ret);
    }
    public string InfoSave()
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"INSERT INTO [EPInfoSystem].[dbo].[CheckInfo]
								([真实时间]
								,[统计时间]	
								,[车间]
								,[检查类型]
								,[合格]
								,[详情])
							VALUES
								('"                                 + this._Realtime + @"'
								,'"                                 + this._Counttime + @"'
								,'"                                 + this._Factory + @"'
								,'"                                 + this._Type + @"'
								,"                                 + this._Pass + @"
								,'"                                 + this._Jsondata + "')";

        ret = DBOper.ReturnRows(source, DBcommand);
        return("保存结果为:" + ret);
    }
Beispiel #16
0
    public string InsertDB()
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"INSERT INTO [EPInfoSystem].[dbo].[NewInfo]
								([ClassifyN]
								,[时间]
								,[分类]
								,[作者]
								,[标题]
								,[内容])
							 VALUES
								('"                                 + this._ClassifyN + @"'
								,'"                                 + this._Time + @"'
								,'"                                 + this._Classify + @"'
								,'"                                 + this._Editor + @"'
								,'"                                 + this._Title + @"'
								,'"                                 + this._Container + "')";

        ret = DBOper.ReturnRows(source, DBcommand);
        return("保存结果为:" + ret);
    }
    public string CreateStatus()
    {
        string DBcommand;
        string source          = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        JArray Monthstatusjarr = JArray.Parse(this._MonthstatusStr);
        Dictionary <string, ListStatusByFac> MonthstatusObj = BuildMonthObj(Monthstatusjarr);
        string ListRulesStr = this.ReadRules();
        JArray LRulesObj    = JArray.Parse(ListRulesStr);

        foreach (JObject Ruleobj in LRulesObj)
        {
            //看Monthstatus有没有这个规则结果。如果有,那么更新则使用update语句,如果没有这个Id的规则结果,则使用insert语句
            string ObjFactory = Ruleobj["车间"].ToString();
            string ObjTime    = this._Time;
            string KeyStr     = ObjFactory + "|" + ObjTime;
            string Objid      = Ruleobj["RuleId"].ToString();
            int    hasrule;
            if (MonthstatusObj.ContainsKey(KeyStr))
            {
                hasrule = MonthstatusObj[KeyStr].Factory_List_Status.FindIndex(delegate(ListStatusbyRule sch) { return(sch.RuleId == Objid); });
            }
            else
            {
                hasrule = -1;
            }
            //不管有没有这个规则,都需要先实例化由rule生成的规则结果类,以录入或覆盖原来的规则
            ListStatusbyRule newLStatu = new ListStatusbyRule(Ruleobj["RuleId"].ToString(), ObjTime, ObjFactory, Ruleobj["项目"].ToString(), Ruleobj["规则"].ToString(), float.Parse(((JValue)Ruleobj["阀值"]).Value.ToString()), true);
            newLStatu.GetCValueFromDB();
            newLStatu.ListValue = newLStatu.SetListValue();
            int ifauto;
            int lvalue;
            if (newLStatu.IfAuto)
            {
                ifauto = 1;
            }
            else
            {
                ifauto = 0;
            }
            if (newLStatu.ListValue)
            {
                lvalue = 1;
            }
            else
            {
                lvalue = 0;
            }
            if (hasrule == -1)                          //没有这个规则
            {
                if (MonthstatusObj.ContainsKey(KeyStr)) //有车间无规则,直接在车间里面加这个规则
                {
                    MonthstatusObj[KeyStr].Factory_List_Status.Add(newLStatu);
                }
                else                  //规则车间都没有
                {
                    ListStatusByFac newfac = new ListStatusByFac(ObjFactory, ObjTime);
                    newfac.Factory_List_Status.Add(newLStatu);
                    MonthstatusObj.Add(KeyStr, newfac);
                }
                DBcommand =
                    @"INSERT INTO [EPInfoSystem].[dbo].[ListStatus]
											   ([时间]
											   ,[车间]
											   ,[项目]
											   ,[RuleId]
											   ,[规则类]
											   ,[阀值]
											   ,[采集值]
											   ,[自动]
											   ,[挂牌])
										 VALUES
											   ('"                                             + this._Time + @"'
											   ,'"                                             + ObjFactory + @"'
											   ,'"                                             + newLStatu.Type + @"'
											   ,'"                                             + newLStatu.RuleId + @"'
											   ,'"                                             + newLStatu.RuleType + @"'
											   ,'"                                             + newLStatu.ThresHold + @"'
											   ,'"                                             + newLStatu.CollectionValue + @"'
											   ,"                                             + ifauto + @"
											   ,"                                             + lvalue + @"
												)"                                                ;
            }
            else              //有这个规则,修改Month类中的这个规则,然后使用update语句而不是insert
            {
                MonthstatusObj[KeyStr].Factory_List_Status[hasrule] = newLStatu;
                DBcommand = @"
								UPDATE [EPInfoSystem].[dbo].[ListStatus]
								   SET 
									   [车间] = '"                                     + ObjFactory + @"'
									  ,[项目] = '"                                     + newLStatu.Type + @"'									
									  ,[规则类] = '"                                     + newLStatu.RuleType + @"'
									  ,[阀值] = "                                     + newLStatu.ThresHold + @"
									  ,[采集值] ="                                     + newLStatu.CollectionValue + @"
									  ,[自动] = "                                     + ifauto + @"
									  ,[挂牌] = "                                     + lvalue + @"
								 WHERE [时间] ='"                                 + this._Time + "'AND [RuleId]=" + newLStatu.RuleId;
            }
            DBOper dbcom = new DBOper(source, DBcommand);
            string _ret  = dbcom.ReturnRows();
        }
        return(JsonConvertHelper.SerializeObject(MonthstatusObj));
    }