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); }
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); }
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); }
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); }
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); }
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; } }
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(); }
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); } }