コード例 #1
0
    public string ReadRules()
    {
        string _ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT [RuleId]
							,[车间]
							,[项目]
							,[规则]
							,[阀值]
						FROM [EPInfoSystem].[dbo].[ListRule]"                        ;
        DBOper dbcom     = new DBOper(source, DBcommand);

        _ret = dbcom.ReturnJson();
        return(_ret);
    }
コード例 #2
0
ファイル: OperRecord.cs プロジェクト: zztdandan/Env_Protect
        public static void SaveOper(string action, string username, string ip)
        {
            string ret;
            string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
            string DBcommand = @"INSERT INTO [EPInfoSystem].[dbo].[OperRecord]
									   ([时间]
									   ,[ip]
									   ,[用户名]
									   ,[操作])
								 VALUES
									   ('"                                     + DateTime.Now.ToString() + @"'
									   ,'"                                     + ip + @"'
									   ,'"                                     + username + @"'
									   ,'"                                     + action + "')";

            ret = DBOper.ReturnJson(source, DBcommand);
        }
コード例 #3
0
    public static string InfoLoadByStartEnd(string starttime, string endtime, string fac, string type)
    {
        string _ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT 
							[真实时间] as [时间],
							[车间],
							[合格],    
							[详情],
							[Id]
				FROM [EPInfoSystem].[dbo].[CheckInfo]
				where ([真实时间] BETWEEN '"                 + starttime + @"' AND '" + endtime + @"') AND [检查类型]='" + type + @"' AND [车间] LIKE'" + fac + @"%'
				Order by [真实时间]"                ;
        DBOper dbcom     = new DBOper(source, DBcommand);

        _ret = dbcom.ReturnJson();
        return(_ret);
    }
コード例 #4
0
    public static string InfoLoadByMon(string mon, string type)
    {
        string _ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT 
							[真实时间] as [时间],
							[车间],
							[合格],    
							[详情],
							[Id]
				FROM [EPInfoSystem].[dbo].[CheckInfo]
				where [统计时间] LIKE '"                 + mon + "%' AND [检查类型]='" + type + @"'
				Order by [真实时间]"                ;
        DBOper dbcom     = new DBOper(source, DBcommand);

        _ret = dbcom.ReturnJson();
        return(_ret);
    }
コード例 #5
0
    public static string ReadNameListByClass(string classify, string limit)
    {
        string ret;

        if (limit == "-1")
        {
            limit = "99999";
        }
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT TOP " + limit + @" 
									[Id]
									,[时间]     
									,[标题]
								FROM [EPInfoSystem].[dbo].[NewInfo]
								WHERE [分类]='"                                 + classify + @"' 
								ORDER BY [时间] DESC"                                ;

        ret = DBOper.ReturnJson(source, DBcommand);
        return(ret);
    }
コード例 #6
0
    public UserInfo(string name, string pw)
    {
        this.uname = name;
        this.upw   = pw;
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT    [账号名]
									  ,[口令]
								  FROM [EPInfoSystem].[dbo].[UserInfo]
								  WHERE [账号名]='"                                 + name + "' AND 口令='" + pw + "'";

        ret = DBOper.ReturnJson(source, DBcommand);
        if (ret == "[]")           //没有这个用户
        {
            this.IsTrue = false;
        }
        else
        {
            this.IsTrue = true;
        }
    }
コード例 #7
0
    public ListStatus(string time, string fac)
    {
        this._Time = time;
        this._Fac  = fac;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT
							[RuleId]
							,[时间]
							,[车间]
							,[项目]
							,[规则类]
							,[阀值]
							,[采集值]
							,[自动]
							,[挂牌]
						FROM [EPInfoSystem].[dbo].[ListStatus]
						WHERE [时间] LIKE'"                         + this._Time + "%' AND [车间] LIKE '" + this._Fac + @"%'
						ORDER BY [RuleId]"                        ;
        DBOper dbcom     = new DBOper(source, DBcommand);

        this._MonthstatusStr = dbcom.ReturnJson();
    }
コード例 #8
0
    public string SaveToDB(string total)
    {
        string ret;
        string source    = ConfigurationManager.ConnectionStrings["EPInfoSys"].ConnectionString.ToString();
        string DBcommand = @"SELECT 
									[total]
									FROM [EPInfoSystem].[dbo].[DustSourceRecord]
								WHERE [time] LIKE'"                                 + this._Time + "%' AND [workshop]='" + this._Workshop + "'";
        DBOper dbcom     = new DBOper(source, DBcommand);

        ret = dbcom.ReturnJson();
        if (ret == "[]")       //没有这个数据,用insert
        {
            ret = InsertDB(total);
            return("保存成功" + ret);
        }
        else         //有这个数据,用update
        {
            ret = UpdateDB(total);
            return("修改成功" + ret);
        }
    }