public void CheckData(Scanner.CodeInfo obj) { string sql = @"select * from CaseNumber"; try { DataTable dt = db.ExecuteDataTable(sql, null); if (dt != null && dt.Rows.Count > 0) { hkMain.Stop(); MsgBox prompt = new MsgBox("还有单据没有上传,是否要删除?", "警告", 3); prompt.ConfirmSelectionDelegate += delegate(int selection) { if (selection == 1) { ClearAllData(); DownloadDetailHandler(obj); } else { hkMain.Start(); } }; prompt.Show(); } else { hkMain.Stop(); DownloadDetailHandler(obj); } } catch (Exception ex) { } }
public void SetGlobalVar() { try { //获取应用程序的目录 string sql = @"select * from AppConfig where Key=@Key"; SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@Key", "AppLocation") }; DataTable dt = db.ExecuteDataTable(sql, parameters); if (dt != null && dt.Rows.Count > 0) { GlobalShare.stratPath = dt.Rows[0].ItemArray[2].ToString(); } //获取端口号 parameters = new SQLiteParameter[] { new SQLiteParameter("@Key", "Port") }; dt = db.ExecuteDataTable(sql, parameters); if (dt != null && dt.Rows.Count > 0) { GlobalShare.port = dt.Rows[0].ItemArray[2].ToString(); } //获取IP地址 parameters = new SQLiteParameter[] { new SQLiteParameter("@Key", "IP") }; dt = db.ExecuteDataTable(sql, parameters); if (dt != null && dt.Rows.Count > 0) { string rs = dt.Rows[0].ItemArray[2].ToString(); GlobalShare.ipAddress = rs; if (Regex.IsMatch(rs, @"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$")) { //IP地址检测 GlobalShare.downloadUrl = rs + ":" + GlobalShare.port; } else if (Regex.IsMatch(rs, @"^([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?$")) { //URL检测 GlobalShare.downloadUrl = rs; } } } catch (Exception ex) { } }
void frm_GetCaseNumberDelegate(int selection, string num, int type, string oldNumber) { if (selection == 1) { SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@ID", Guid.NewGuid().ToString()), new SQLiteParameter("@CaseNumber", num), new SQLiteParameter("@FromID", TerminalInfo.GetDeviceID()), new SQLiteParameter("@LoginID", GlobalShare.LoginID) }; string sql = @"select * from CaseNumber where CaseNumber=@CaseNumber"; try { DataTable dt = db.ExecuteDataTable(sql, parameters); if (dt != null && dt.Rows.Count > 0) { msg.ShowMessage(num + "号箱已存在", 1); } else { if (type == 0) { sql = @"insert into CaseNumber(ID,CaseNumber,FromID,LoginID) values(@ID,@CaseNumber,@FromID,@LoginID)"; } else if (type == 1) { sql = @"update CaseNumber set CaseNumber=@CaseNumber where CaseNumber=@oldCaseNumber"; parameters = new SQLiteParameter[] { new SQLiteParameter("@CaseNumber", num), new SQLiteParameter("@oldCaseNumber", oldNumber) }; } try { db.ExecuteNonQuery(sql, parameters); ReloadCaseData(num); } catch (Exception ex) { } } } catch (Exception ex) { } } hkCaseMgr.Start(); }
/// <summary> /// 更新全部书籍 /// </summary> public static void BooksUpdate(object ob) { //获取全部书籍 DataTable dt = SQLiteDBHelper.ExecuteDataTable("select *from Books", null); List <Book> Books = ModelConvertHelper <Book> .DataTableToList(dt); foreach (Book book in Books) { //获取初始搜索文本 string html = GetHtml.GetHttpWebRequest(book.Url); BookSource bs = GetBookSource(book.Source); //检测书源有效性 if (bs.Title is null) { Tips tips = new Tips(book.Name + "的书源不存在,请检查书源是否已经被删除掉?"); tips.Show(); return; } //获取最新章节 string LatestChapters = Tool.GetRegexStr(html, bs.NewestRegular).Trim(); //获取更新时间 string Update = Tool.GetRegexStr(html, bs.UpdateRegular).Trim(); SQLiteDBHelper.ExecuteNonQuery("Update Books set 'Newest' = '" + LatestChapters + "', 'Update' = '" + Tool.GetUpdataDate(Update) + "' where Id =" + book.Id, null); } ((MainWindow)ob).Dispatcher.Invoke(new Action(() => { ((MainWindow)ob).DataContext = DataFetch.GetBooks(); })); }
public int GetGameBySearch(DateTime start, DateTime end, string team, ref DataTable dt) { SQLiteDBHelper sqliteHelper = new SQLiteDBHelper(); StringBuilder strSql = new StringBuilder(); strSql.Append("select gametime,league,home,visitor,sn from game "); strSql.Append("where 1 = 1 "); if (start != null) { strSql.Append("and gametime >= @start "); } if (end != null) { strSql.Append("and gametime <= @end "); } if (team != "") { strSql.Append("and home like @home or visitor like @visitor "); } strSql.Append(" order by gametime desc"); SQLiteParameter[] para = { sqliteHelper.MakeSQLiteParameter("@start", DbType.DateTime,start), sqliteHelper.MakeSQLiteParameter("@end", DbType.DateTime,end), sqliteHelper.MakeSQLiteParameter("@home", DbType.String,32,"%"+team+"%"), sqliteHelper.MakeSQLiteParameter("@visitor", DbType.String,32,"%"+team+"%") }; int result = sqliteHelper.ExecuteDataTable(strSql, para, ref dt); return result; }
public string GetClassNoCount() { string sql = string.Format("select distinct classNo from worker where groupname = '{0}'", ConfigurationManager.AppSettings["prorealname"].ToString()); DataTable dt = SQLiteDBHelper.ExecuteDataTable(sql); if (dt.Rows.Count <= 0) { return("暂无班组考勤"); } string output = ""; for (int i = 0; i < dt.Rows.Count; i++) { string countsql = string.Format("select count(id) as count from worker where groupname = '{0}' and classNo = '{1}' and DATE(checkinTime) = '{2}';", ConfigurationManager.AppSettings["prorealname"].ToString(), dt.Rows[i]["classNo"].ToString(), DateTime.Now.ToString("yyyy-MM-dd") ); DataTable dtt = SQLiteDBHelper.ExecuteDataTable(countsql); if (dtt.Rows.Count > 0) { int cc = Int32.Parse(dtt.Rows[0]["count"].ToString()); if (cc > 0) { output += string.Format("{0} 考勤人数:{1} ", dt.Rows[i]["classNo"].ToString(), cc); } } } return(output); }
private void AreaDefine_Load(object sender, EventArgs e) { string sql = "select module_type from led_module"; DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); if (table.Rows.Count > 0) { for (int i = 0; i < table.Rows.Count; i++) { moduleType.Items.Add(table.Rows[i]["module_type"]); } } else { MessageBox.Show("输出模板选项为空,请前往模板管理页面新增!"); } if (info.Id > 0) { leftBegin.Text = info.Left_begin.ToString(); topBegin.Text = info.Top_begin.ToString(); width.Text = info.Width.ToString(); height.Text = info.Height.ToString(); areaType.SelectedIndex = info.Area_type; moduleType.Text = info.Module_type; multiNAlignment.SelectedIndex = info.Multi_nAlignment; multiIsVCenter.SelectedIndex = info.Multi_IsVCenter; fontSize.Text = info.Font_size.ToString(); fontBold.SelectedIndex = info.Font_bold; inStyle.SelectedIndex = info.In_style; delayTime.Text = info.Delay_time.ToString(); speed.Text = info.Speed.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { string path = Server.MapPath("test.db"); SQLiteDBHelper db = new SQLiteDBHelper(path); //chuangjiantable string sql = "CREATE TABLE Test3(id integer NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,Name char(3),TypeName varchar(50),addDate datetime,UpdateTime Date,Time time,Comments blob)"; //db.ExecuteNonQuery(sql, null); // string sql2 = "INSERT INTO Test3(Name,TypeName,addDate,UpdateTime,Time,Comments)values(@Name,@TypeName,@addDate,@UpdateTime,@Time,@Comments)"; // System.Data.Common.DbTransaction trans = db.OpenDbTransaction(); // for (char c = 'A'; c <= 'Z'; c++) // { // for (int i = 0; i < 100; i++) // { // SQLiteParameter[] parameters = new SQLiteParameter[]{ //new SQLiteParameter("@Name",c+i.ToString()+"s"), //new SQLiteParameter("@TypeName",c.ToString()), //new SQLiteParameter("@addDate",DateTime.Now), //new SQLiteParameter("@UpdateTime",DateTime.Now.Date), //new SQLiteParameter("@Time",DateTime.Now.ToShortTimeString()), //new SQLiteParameter("@Comments","Just a Test"+i) //}; // db.ExecuteNonQueryWithTrans(sql2, parameters, trans); // } // } // db.CommitDbTransaction(trans); //show System.Data.DataTable dt = db.ExecuteDataTable("select * from test3", null); foreach (System.Data.DataRow dr in dt.Rows) { Response.Write(dr[0] + "=" + dr[1] + "=" + dr[2] + "=" + dr[3] + "=" + dr[4]+"<br>"); } }
private void MultiSettingForm_Load(object sender, EventArgs e) { string sql = "select id,port as 串口,baud_rate as 波特率,(case tag when 1 then '进场' when 2 then '出场' end) as 人员状态 from setting_info"; DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); portData.DataSource = table; }
private void ModuleManager_Load(object sender, EventArgs e) { string sql = "select id,module_type as 模板类型,module_text as 内容 from led_module"; DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); moduleList.DataSource = table; }
/// <summary> /// 根据项目名及考勤状态查询人数 /// </summary> /// <param name="groupanme"></param> /// <param name="state"></param> /// <returns></returns> public string UpdateWorkerNumber(string groupanme, int state) { string sql = string.Format("select count(job) as num from worker where groupname = '{0}' and checkinState = {1} and DATE(checkinTime) = '{2}';", groupanme, state, DateTime.Now.ToString("yyyy-MM-dd")); if (state > 1)//统计参与考勤人数 { sql = string.Format("select count(job) as num from worker where groupname = '{0}' and DATE(checkinTime) = '{1}';", groupanme, DateTime.Now.ToString("yyyy-MM-dd")); } //Console.WriteLine("+++++" + sql); DataTable dt = SQLiteDBHelper.ExecuteDataTable(sql); DataRow row = null; string num = "未知"; if (dt != null && dt.Rows != null) { row = dt.Rows[0]; } if (null != row) { num = row["num"].ToString(); } return(num); }
/// <summary> /// 持久化需要线上获取的统计信息 /// </summary> /// <param name="functionname"></param> /// <param name="res"></param> public static void updateAsyncData(string functionname, string res) { DataTable dt = SQLiteDBHelper.ExecuteDataTable(string.Format("select * from asyncdata where functionname = '{0}'", functionname)); Console.WriteLine(string.Format("select * from asyncdata where functionname = '{0}'", functionname)); DataRow row = null; if (dt.Rows.Count > 0) { row = dt.Rows[0]; } if (null == row) { string insertsql = string.Format("insert into asyncdata(functionname,res)values('{0}','{1}')", functionname, res ); if (SQLiteDBHelper.ExecuteNonQuery(insertsql) > 0) { Console.WriteLine("新增模板记录成功!"); } } else { string insertsql = string.Format("update asyncdata set res = '{0}' where functionname = '{1}'", res, functionname ); if (SQLiteDBHelper.ExecuteNonQuery(insertsql) > 0) { //Console.WriteLine("修改模板记录成功!"); } } }
/// <summary> /// 获取LED屏幕设置信息列表 /// </summary> /// <param name="led_id"></param> /// <returns></returns> public List <ModuleInfo> GetLEDArea(int led_id) { List <ModuleInfo> lla = new List <ModuleInfo>(); string sql = string.Format("select * from led_area where led_id = 1", led_id); DataTable dtt = SQLiteDBHelper.ExecuteDataTable("select * from led_area where led_id = 1"); for (int i = 0; i < dtt.Rows.Count; i++) { ModuleInfo la = new ModuleInfo(); la.Id = Int32.Parse(dtt.Rows[i]["id"].ToString()); la.Led_id = Int32.Parse(dtt.Rows[i]["led_id"].ToString()); la.Left_begin = Int32.Parse(dtt.Rows[i]["left_begin"].ToString()); la.Top_begin = Int32.Parse(dtt.Rows[i]["top_begin"].ToString()); la.Width = Int32.Parse(dtt.Rows[i]["width"].ToString()); la.Height = Int32.Parse(dtt.Rows[i]["height"].ToString()); la.Area_type = Int32.Parse(dtt.Rows[i]["area_type"].ToString()); la.Module_type = dtt.Rows[i]["module_type"].ToString(); la.Multi_nAlignment = Int32.Parse(dtt.Rows[i]["multi_nAlignment"].ToString()); la.Multi_IsVCenter = Int32.Parse(dtt.Rows[i]["multi_IsVCenter"].ToString()); la.Font_size = Int32.Parse(dtt.Rows[i]["font_size"].ToString()); la.Font_bold = Int32.Parse(dtt.Rows[i]["font_bold"].ToString()); la.In_style = Int32.Parse(dtt.Rows[i]["in_style"].ToString()); la.Delay_time = Int32.Parse(dtt.Rows[i]["delay_time"].ToString()); la.Speed = Int32.Parse(dtt.Rows[i]["speed"].ToString()); lla.Add(la); } return(lla); }
/// <summary> /// 获取全部书源 /// </summary> /// <returns>返回全部书源</returns> public static List <BookSource> GetBookSources() { //获取DataTable DataTable dt = SQLiteDBHelper.ExecuteDataTable("select *from BookSource where State=1", null); //获取所有书源 return(ModelConvertHelper <BookSource> .DataTableToList(dt)); }
public void getUserInfo(string message, int type) { string sql = "select * from worker where identityId = '" + message + "';"; DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); if (table.Rows.Count == 0) { //不存在则远程获取 GetUserInfo(message, ConfigurationManager.AppSettings["prorealname"].ToString(), type); //Console.WriteLine("查无数据,可能正在远程获取,请确保项目名和身份证号录入正确!"); return; } DataRow row = table.Rows[0]; string userInfo = string.Format("{0} [{1}]\n{2}({3})", row["username"].ToString(), row["job"].ToString(), DateTime.Now.ToString("MM月dd日 HH:mm:ss"), (type == 1 ? "进场" : "出场")); string updateuser = string.Format("update worker set checkinState = {0},checkinTime = '{1}' where identityId = '{2}';", type, DateTime.Now.ToString("yyyy-MM-dd"), message); SQLiteDBHelper.ExecuteNonQuery(updateuser); string base64 = "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCADIAMgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9O6KKKACiiigAooooAKKK4L41/GnwT8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KKACiiigAooooA2fCfjLxZ4E1mHxF4L8R6jompwfcurC5eGQDuCVIyp7g8HuK+7v2dv+Cn2o209r4X/aHsVurZiI18SafAFlj/ANq4t0GHHq0QBGPuMea/PiionTjPcZ/Qr4f8Q6F4r0Wz8R+GdXtNU0u/iE1rd2kokilQ91YcH/HitGvxg/ZF/a58Ufs4eKY9P1Ce41LwNqc4/tTTN24wE4BubcH7sgHVeA4GDztZf2Q0DXtH8U6JYeJPD2ow3+manbx3dpdQtlJonUMrA+hBFcNSm6bGi/RRRWYwr4f/AOCnPx+ufBfgiw+Cvhu9MOp+Lo2udWeN8PFpittEfHI85wwPqsUinhq+4K/EH9sf4iTfEz9pHxvrv2jzbSy1F9IscHKiC1/cgr7MyM/1c1tQjzSu+gmeL0UUV3khRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABX6Qf8Etfjtc6hZav8A/EF6XOnxtq+gmRuRCWAuIFz2DMsigc/PKegr8369S/Zd8ezfDT9oLwJ4tSfyoYdZgtbts8fZbg+RNn1xHIx+oFRVjzxaGj91KKKK80op6zqMej6RfatLjZZW0tw2fRFLH+Vfz13t5caheT393IZJ7mVppXPVnYkk/maKK68L1EyGiiiuokKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKfFLJBKk0LlJI2DKw6gjkGiigD+hTQNR/tjQdN1fj/TrSG546fOgb+tFFFeUyz//2Q=="; if ("" != row["identityPhoto"].ToString()) { base64 = row["identityPhoto"].ToString(); } if (this.lstBoxWorker.Items.Count > 3) { this.lstBoxWorker.Items.Clear(); //this.images.Clear(); } LoopUser u = new LoopUser(); Bitmap b = new Bitmap(new MemoryStream(Convert.FromBase64String(base64))); //this.images.Add(b); u.info = userInfo; u.photo = base64; this.lstBoxWorker.Items.Insert(0, u); if (type == 1) { this.inuser.BackgroundImage = b; this.nowinname.Text = row["username"].ToString(); this.nowindate.Text = DateTime.Now.ToString("MM月dd日"); this.nowingroup.Text = row["job"].ToString() + "组"; this.nowinjob.Text = row["job"].ToString(); this.nowintime.Text = DateTime.Now.ToString("HH:mm"); } else { this.outuser.BackgroundImage = b; this.nowoutname.Text = row["username"].ToString(); this.nowoutdate.Text = DateTime.Now.ToString("MM月dd日"); this.nowoutgroup.Text = row["job"].ToString() + "组"; this.nowoutjob.Text = row["job"].ToString(); this.nowouttime.Text = DateTime.Now.ToString("HH:mm"); } }
public void SetProdInfo(string model) { try { string sql = string.Empty; List <SQLiteParameter> parameters = new List <SQLiteParameter>(); //sql = "select * from FromERPDetail where Model like '%'+@Model+'%'"; //parameters = new List<SQLiteParameter>() { // new SQLiteParameter("@Model", model.Trim()) //}; sql = "select * from FromERPDetail where Model like '%" + model.Trim() + "%'"; DataTable partsDt = db.ExecuteDataTable(sql, parameters.ToArray()); if (partsDt != null && partsDt.Rows.Count > 0) { this.barcode = partsDt.Rows[0]["Barcode"].ToString(); this.prodID = partsDt.Rows[0]["ProdID"].ToString(); int curTotalNum = GetCurrentCaseProductTotal(this.prodID, this.caseNumberID); int otherTotalNum = GetOtherCaseProductTotal(this.prodID, this.caseNumberID); this.model = partsDt.Rows[0]["Model"].ToString(); lblProdName.Text = partsDt.Rows[0]["ProdName"].ToString(); lblModel.Text = partsDt.Rows[0]["Model"].ToString(); lblsNum.Text = partsDt.Rows[0]["Num"].ToString(); lblTotalNum.Text = (curTotalNum + otherTotalNum).ToString(); if (curTotalNum == 0) { txtNum.Text = ""; } else { txtNum.Text = curTotalNum.ToString(); } txtNum.Focus(); } else { msg.ShowMessage("该配件不在发货单中", 1); lblProdName.Text = "该配件不在发货单中"; } } catch (Exception ex) { } }
//查询电机室公共信息 /// <summary> /// 公共信息 /// </summary> /// <param name="i"></param> /// <returns></returns> public DataTable getdjsCommDataTable(int i) { string sql = "select top 100 oil_mass as '油箱油量',fire_alarm as '烟火报警',up_oil_place as '上油箱油位',up_water_place as '上水箱水位', battery_voltage as '24V蓄电池电压',alarm as '报警' from tab_displayComm where djNumber=@i"; SQLiteParameter[] param = new SQLiteParameter[] { new SQLiteParameter("@i", DbType.Int32) }; param[0].Value = i; SQLiteDBHelper sdb = new SQLiteDBHelper(Program.g_dbPath); return(sdb.ExecuteDataTable(sql, param)); }
private void ModuleManager_Load(object sender, EventArgs e) { string sql = "select id,left_begin as 区域横坐标,top_begin as 区域纵坐标," + "width as 区域宽度,height as 区域高度,area_type as 区域类型,module_type as 输出模板类型,multi_nAlignment as 水平对齐样式," + "multi_IsVCenter as 是否垂直居中,font_size as 字体大小,font_bold as 是否加粗,in_style as 进场动画,delay_time as 页面留停时间," + "speed as 动画的显示速度 from led_area where led_id='" + info.Id + "'"; DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); moduleList.DataSource = table; }
/// <summary> /// 根据书源名获取书源对象 /// </summary> /// <param name="SourceName">书源名</param> /// <returns>返回书源对象</returns> public static BookSource GetBookSource(string SourceName) { //获取DataTable DataTable dt = SQLiteDBHelper.ExecuteDataTable("select *from BookSource where Title='" + SourceName + "'", null); //获取指定ID书籍的对象 BookSource source = DAL.ModelConvertHelper <BookSource> .DataTableToModel(dt); return(source); }
private void submit_Click(object sender, EventArgs e) { if (moduleText.Text == "") { MessageBox.Show("模板内容必填!"); return; } if (moduleType.Text == "") { MessageBox.Show("模板类型必填!"); return; } string sql = ""; try { if (this.minfo == null) { string checkSql = "select * from led_module where module_type='" + moduleType.Text + "'"; DataTable table = SQLiteDBHelper.ExecuteDataTable(checkSql); if (table != null && table.Rows.Count > 0) { MessageBox.Show("此类型模板已存在,请前往列表页进行操作!"); return; } sql = "insert into led_module (module_type,module_text) values ('" + moduleType.Text + "','" + moduleText.Text.Trim() + "')"; } else { if (minfo.Module_type != moduleType.Text) { string checkSql = "select * from led_module where module_type='" + moduleType.Text + "'"; DataTable table = SQLiteDBHelper.ExecuteDataTable(checkSql); if (table != null && table.Rows.Count > 0) { MessageBox.Show("此类型模板已存在,请前往列表页进行操作!"); return; } else { sql = "update led_module set module_type ='" + moduleType.Text + "',module_text='" + moduleText.Text.Trim() + "' where id=" + this.minfo.Id; } } sql = "update led_module set module_type ='" + moduleType.Text + "',module_text='" + moduleText.Text.Trim() + "' where id=" + this.minfo.Id; } SQLiteDBHelper.ExecuteNonQuery(sql); MessageBox.Show("保存成功!"); this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception) { MessageBox.Show("保存失败,请联系管理员!"); return; } }
/// <summary> /// 将Flow数据写入至数据库 /// </summary> /// <param name="f">Flow对象</param> public static void WriteDataByFlow(Flow f) { // 1 : 判断该程序是否存在数据库中 Y:下一步 N:新建 // 2 :查看今天是否存在该PID。 Y:更新 N:新建 //Flow f = (Flow)de.Value; string sql; string now = DateTime.Now.ToString("yyyy-MM-dd"); long up, down; sql = string.Format("select pid from program where name='{0}' AND path='{1}';", f.name, f.path); object id = db.ExecuteScalar(sql, null); if (id == null) { sql = string.Format("insert into program (name,path,describe) values ('{0}','{1}','{2}');", f.name, f.path, f.describe); db.ExecuteNonQuery(sql, null); id = db.ExecuteScalar("select MAX(pid) from program;", null); } sql = string.Format("select COUNT(*) from flow where pid={0} AND note_date='{1}';", id, now); // 如果不存在今天的程序流量 if (Convert.ToInt32(db.ExecuteScalar(sql, null)) == 0) { // 则插入 sql = string.Format("insert into flow (pid,flow_up,flow_down,note_date) values ({0},{1},{2},'{3}');", id, f.up, f.down, now); db.ExecuteNonQuery(sql, null); } else { sql = string.Format("select * from flow where pid={0} AND note_date='{1}';", id, now); DataRow dr = db.ExecuteDataTable(sql, null).Rows[0]; up = (long)dr["flow_up"]; down = (long)dr["flow_down"]; up += f.up - f.note_up; down += f.down - f.note_down; f.note_up = f.up; f.note_down = f.down; sql = string.Format("update flow set flow_up={0}, flow_down={1} where pid={2} AND note_date='{3}';", up, down, id, now); db.ExecuteNonQuery(sql, null); } }
public void ReloadDifferData() { string sql = @"select v.ProdName as 名称,v.Model as 型号,v.yNum as 应发,v.sNum as 数量,v.AreaPlaceCode as 仓位 from ( select a.ProdName,a.Model,a.Num as yNum,ifnull(b.Num,0) as sNum,a.Num-ifnull(b.Num,0) as balance,ifnull(a.AreaPlaceCode,'') as AreaPlaceCode from FromERPDetail a left outer join (select ProdID,SUM(Num) as Num from CaseNumberDetail group by ProdID) b on a.ProdID=b.ProdID ) v where v.balance<>0 order by v.ProdName"; try { DataTable dt = db.ExecuteDataTable(sql, null); DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = dt.TableName; DataGridColumnStyle MCColStyle = new DataGridTextBoxColumn(); MCColStyle.MappingName = "名称"; MCColStyle.HeaderText = "名称"; MCColStyle.Width = 60; ts.GridColumnStyles.Add(MCColStyle); DataGridColumnStyle XHColStyle = new DataGridTextBoxColumn(); XHColStyle.MappingName = "型号"; XHColStyle.HeaderText = "型号"; XHColStyle.Width = 60; ts.GridColumnStyles.Add(XHColStyle); DataGridColumnStyle YFColStyle = new DataGridTextBoxColumn(); YFColStyle.MappingName = "应发"; YFColStyle.HeaderText = "应发"; YFColStyle.Width = 30; ts.GridColumnStyles.Add(YFColStyle); DataGridColumnStyle SLColStyle = new DataGridTextBoxColumn(); SLColStyle.MappingName = "数量"; SLColStyle.HeaderText = "数量"; SLColStyle.Width = 30; ts.GridColumnStyles.Add(SLColStyle); DataGridColumnStyle CWColStyle = new DataGridTextBoxColumn(); CWColStyle.MappingName = "仓位"; CWColStyle.HeaderText = "仓位"; CWColStyle.Width = 60; ts.GridColumnStyles.Add(CWColStyle); CreateNewCaseDetailGrid(); dgDifferList.TableStyles.Add(ts); dgDifferList.DataSource = null; dgDifferList.DataSource = dt; dgDifferList.RowHeadersVisible = false; AutoSizeTable(dgDifferList); if (dt != null && dt.Rows.Count > 0) { dgDifferList.Select(0); } dgDifferList.Invalidate(); } catch (Exception ex) { } }
public string GetWokerNum(string type) { string countsql = ""; if (type == "项目人数") { countsql = string.Format("select count(identityId) as count from worker where groupname = '{0}';", ConfigurationManager.AppSettings["prorealname"].ToString() ); } if (type == "考勤人数") { countsql = string.Format("select count(identityId) as count from worker where groupname = '{0}' and DATE(checkinTime) = '{1}';", ConfigurationManager.AppSettings["prorealname"].ToString(), DateTime.Now.ToString("yyyy-MM-dd") ); } if (type == "在场人数") { countsql = string.Format(@"SELECT count(identityId) AS count FROM worker WHERE groupname = '{0}' AND checkinState = 1 AND DATE(checkinTime) = '{1}';", ConfigurationManager.AppSettings["prorealname"].ToString(), DateTime.Now.ToString("yyyy-MM-dd") ); } if ("" == countsql) { return(""); } DataTable dtt = SQLiteDBHelper.ExecuteDataTable(countsql); if (dtt.Rows.Count <= 0) { return(""); } int cc = Int32.Parse(dtt.Rows[0]["count"].ToString()); if (cc > 0) { return(string.Format(type + ":{0} ", cc)); } else { return(""); } }
/// <summary> /// 执行查询SQL,返回查询结果表 /// </summary> /// <param name="sql">sql语句</param> /// <param name="parameters">参数</param> /// <returns>查询结果表</returns> public DataTable DataTableQuery(string sql, SQLiteParameter[] parameters) { DataTable data = new DataTable(); try { SQLiteDBHelper dbHelper = new SQLiteDBHelper(); data = dbHelper.ExecuteDataTable(sql, parameters); } catch { } return data; }
/// <summary> /// 查询当前用户出入信息用于LED显示 /// </summary> /// <param name="identityId"></param> /// <param name="checktype"></param> /// <returns></returns> public string GetUserInOutInfo(string identityId, int checktype) { string sql = "select * from worker where identityId = '" + identityId + "'"; DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); string userInfo = ""; if (table.Rows.Count > 0) { DataRow row = table.Rows[0]; userInfo = row["job"].ToString() + " " + row["username"].ToString() + (checktype == 1 ? " 进场" : " 出场"); } return(userInfo); }
public void Reload() { //获取基目录,它由程序集冲突解决程序用来探测程序集。 string dbPath = AppDomain.CurrentDomain.BaseDirectory + "Sip2Info.db"; SQLiteDBHelper db = new SQLiteDBHelper(dbPath); // 查询数据 string sql = "select id, name as 名称, ip, port, ao, ap, charset as 字符集, uid, pwd, vp, locationcode, readercode, pin, bookcode from Sip2Info"; DataTable dt = db.ExecuteDataTable(sql, null); DataSet ds = new DataSet(); ds.Tables.Add(dt); dgvSip2Server.DataSource = ds.Tables[0]; }
public int GetGameByKey(int gameSN, ref DataTable dt) { SQLiteDBHelper sqliteHelper = new SQLiteDBHelper(); StringBuilder strSql = new StringBuilder(); strSql.Append("select * from game "); strSql.Append("where sn = @sn order by gametime desc"); SQLiteParameter[] para = { sqliteHelper.MakeSQLiteParameter("@sn", DbType.Int32,gameSN) }; int result = sqliteHelper.ExecuteDataTable(strSql, para, ref dt); return result; }
/// <summary> /// 判断指定表中是否存在某列 /// </summary> /// <param name="table">表名</param> /// <param name="column">列名</param> /// <returns>如果存在返回true</returns> public static bool ColumnExistence(string table, string column) { //获取指定表的全部列信息 DataTable dt = SQLiteDBHelper.ExecuteDataTable("PRAGMA table_info([" + table + "])", null); foreach (DataRow myRow in dt.Rows) { if (myRow[1].ToString() == column) { return(true); } } return(false); }
/// <summary> /// 执行查询SQL,返回查询结果表 /// </summary> /// <param name="sql">sql语句</param> /// <param name="parameters">参数</param> /// <returns>查询结果表</returns> public DataTable DataTableQuery(string sql, SQLiteParameter[] parameters) { DataTable data = new DataTable(); try { SQLiteDBHelper dbHelper = new SQLiteDBHelper(); data = dbHelper.ExecuteDataTable(sql, parameters); } catch (Exception ex) { //Log.Error("DataTableQuery出错:" + ex.ToString()); } return data; }
public void ReloadSettings() { SQLiteDBHelper db = new SQLiteDBHelper(); string sql = @"select * from AppConfig where Key=@Key"; SQLiteParameter[] parameters = new SQLiteParameter[] { new SQLiteParameter("@Key", "IP") }; DataTable dt = db.ExecuteDataTable(sql, parameters); if (dt != null && dt.Rows.Count > 0) { txtIPAddress.Text = dt.Rows[0].ItemArray[2].ToString(); } parameters = new SQLiteParameter[] { new SQLiteParameter("@Key", "Port") }; dt = db.ExecuteDataTable(sql, parameters); if (dt != null && dt.Rows.Count > 0) { txtPort.Text = dt.Rows[0].ItemArray[2].ToString(); } }
public MainWindow() { InitializeComponent(); //190731增加,这里新增加一个判断,判断是否存在指定列,如果不存在将进行增加列操作 if (!DataFetch.ColumnExistence("BookSource", "Code")) { SQLiteDBHelper.ExecuteDataTable("ALTER TABLE BookSource ADD COLUMN Code Text; ", null); } string path = AppDomain.CurrentDomain.BaseDirectory; //this.Icon = BitmapFrame.Create(new Uri(path + "Resources/favicon.ico")); //获取配置项 config = ConfigReadWrite.GetConfig(); about.Text = "本软件只是娱乐之作,所有数据来源皆来自于网络,如果有侵犯到他人的权益,请于我进行联系,我会第一时间删除源站,谢谢合作!\n\n本软件默认有五个源,用户可以自定义增加更多的源站,如果你有更好的源站,可以推荐给我,我会第一时间集成进去。\n\n本软件初始发布于吾爱破解,如果你在使用的过程中有发现BUG或者其他不合理的地方,请进行留言。本软件只作用于学习研究,请在下载内24小时内删除本软件。"; //字体 Typeface.ItemsSource = Tool.GetTypeface(); Typeface.Text = config.Typeface; //绑定字体大小 TypefaceSize.ItemsSource = config.GetTypefaceSize; TypefaceSize.Text = config.FontSize.ToString(); //绑定主题 theme.ItemsSource = config.GetTheme; theme.Text = config.Theme; //更新书源状态 //DataFetch.UpdateSourceState(); //刷新数据 RefreshData(); //绑定书源 SourceStation.ItemsSource = lb; SourceStation.Text = config.SourceStation; //默认显示养肥区 FertilizingArea.Visibility = Visibility.Visible; fatten.IsEnabled = true; //绑定养肥区 fatten.ItemsSource = config.GetFattenNumber; fatten.Text = config.FattenNumber.ToString(); GetFatten(); }
public LedInfo GetLEDInfo() { LedInfo info = new LedInfo(); string sql = "select * from led_info"; DataTable dtt = SQLiteDBHelper.ExecuteDataTable(sql); if (dtt.Rows.Count > 0) { info.LedIp = dtt.Rows[0]["led_ip"].ToString(); info.Width = Int32.Parse(dtt.Rows[0]["width"].ToString()); info.Height = Int32.Parse(dtt.Rows[0]["height"].ToString()); info.ProjectName = dtt.Rows[0]["project_name"].ToString(); } return(info); }
public string getAsyncDataFromDB(string functionname) { string res = string.Empty; string sql = "select res from asyncdata where functionname = '" + functionname + "'"; Console.WriteLine(sql); DataTable table = SQLiteDBHelper.ExecuteDataTable(sql); if (table.Rows.Count > 0) { DataRow row = table.Rows[0]; res = row["res"].ToString(); } return(res); }
private static DataTable QueryDataTable(string sql, string functionName) { DataTable result = null; try { result = SQLiteDBHelper.ExecuteDataTable(sql); } catch (Exception e) { result = null; Log.Write(functionName + " failed. exception is: " + e.Message); } return(result); }
/// <summary> /// 实时统计班组在场人数 /// </summary> public void GetClassCountLocal() { string sql = string.Format("select distinct classNo from worker where groupname = '{0}'", ConfigurationManager.AppSettings["prorealname"].ToString()); DataTable dt = SQLiteDBHelper.ExecuteDataTable(sql); if (dt.Rows.Count <= 0) { return; } CCC.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { string countsql = string.Format("select count(id) as count from worker where groupname = '{0}' and classNo = '{1}' and DATE(checkinTime) = '{2}' and checkinState = 1", ConfigurationManager.AppSettings["prorealname"].ToString(), dt.Rows[i]["classNo"].ToString(), DateTime.Now.ToString("yyyy-MM-dd") ); DataTable dtt = SQLiteDBHelper.ExecuteDataTable(countsql); if (dtt.Rows.Count > 0) { CCC.Add(new ClassCount { classNo = dt.Rows[i]["classNo"].ToString(), count = int.Parse(dtt.Rows[0]["count"].ToString()) }); } } //轨道公司统计数据合并:轨道公司工程管理部 轨道公司质量安全部 轨道公司机电设备部 string substring = "轨道公司工程管理部,轨道公司质量安全部,轨道公司机电设备部"; string[] sub = substring.Split(','); List <ClassCount> outlist = CCC.Where(e => sub.Contains(e.classNo) == false).ToList(); int rescount = 0, descount = 0; foreach (ClassCount c in CCC) { rescount += c.count; } foreach (ClassCount d in outlist) { descount += d.count; } outlist.Add(new ClassCount { classNo = "轨道公司", count = rescount - descount }); CCC = outlist; }
/// <summary> /// 执行查询SQL,返回查询结果的首行首列 /// </summary> /// <param name="sql">sql语句</param> /// <param name="parameters">参数</param> /// <returns></returns> public string StringQuery(string sql, SQLiteParameter[] parameters) { string result = string.Empty; try { SQLiteDBHelper dbHelper = new SQLiteDBHelper(); DataTable data = dbHelper.ExecuteDataTable(sql, parameters); if (data != null && data.Rows.Count > 0) { result = data.Rows[0][0].ToString(); } } catch { } return result; }
public int GetMaxGameSN() { DataTable dt = new DataTable(); SQLiteDBHelper sqliteHelper = new SQLiteDBHelper(); StringBuilder strSql = new StringBuilder(); strSql.Append("select max(sn) from game"); int result = sqliteHelper.ExecuteDataTable(strSql, null, ref dt); if (result != -1) { if (dt.Rows[0][0].ToString().Equals(string.Empty)) { result = 0; } else { result = int.Parse(dt.Rows[0][0].ToString()); } } return result; }
public int GetGameDetailByKey(int gameSN, ref DataTable dt) { SQLiteDBHelper sqliteHelper = new SQLiteDBHelper(); StringBuilder strSql = new StringBuilder(); strSql.Append("select changetime,win,draw,lose,changeminute from gamedetail "); strSql.Append("where gamesn = @gamesn "); SQLiteParameter[] para = { sqliteHelper.MakeSQLiteParameter("@gamesn", DbType.Int32,gameSN) }; int result = sqliteHelper.ExecuteDataTable(strSql, para, ref dt); return result; }