public static bool InsertTmpFileMsg(FileMsg fileMsg) { try { string sql1 = string.Format(@"INSERT into tmpfilemsg( UserID,FileName,FullName,Count,VerForm,PrintColor,PaperType,Printer,PageCount,Price,LoadTime,FinishTime,DeleteTime,State,isRemove,isNormalFile,InitPrice,FileSize) VALUES ('{0}','{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')", fileMsg.UserID, fileMsg.FileName, fileMsg.FullName, fileMsg.Count, fileMsg.VerForm, fileMsg.PrintColor, fileMsg.PaperType, fileMsg.Printer, fileMsg.PageCount, fileMsg.Price, fileMsg.LoadTime, fileMsg.FinishTime, fileMsg.DeleteTime, fileMsg.state, fileMsg.isRemove ? "1" : "0", fileMsg.isNormalFile ? "1" : "0", fileMsg.InitPrice, fileMsg.FileSize); sql1 = sql1.Replace("\\", "\\\\"); int i = SQLiteHelper.ExecuteNonQuery(sql1); string s = i > 0 ? "成功" : "失败"; LogOperate.Add("插入订单:" + fileMsg.UserID + " " + fileMsg.FileName + " " + s); if (i == 0) { return(false); } else { return(true); } } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
public static List <FileMsg> selectTmpFileMsg(string userid) { try { List <FileMsg> FileMsgList = new List <FileMsg>(); string sql1 = string.Format(@" select DISTINCT UserID, FullName, FileName, Count, state, LoadTime, FinishTime, DeleteTime, VerForm, PrintColor, PaperType, Printer, PageCount, Price, isNormalFile, isRemove, InitPrice, FileSize from tmpfilemsg where UserID = '{0}' ", userid); SQLiteDataReader msdr = SQLiteHelper.ExecuteDataReader(sql1); while (msdr.Read()) { FileMsg fileMsg = new FileMsg(); fileMsg.UserID = msdr["UserID"] == DBNull.Value ? "" : msdr["UserID"].ToString(); fileMsg.FileName = msdr["FileName"] == DBNull.Value ? "" : msdr["FileName"].ToString(); fileMsg.FullName = msdr["FullName"] == DBNull.Value ? "" : msdr["FullName"].ToString(); fileMsg.Count = msdr["Count"] == DBNull.Value ? "" : msdr["Count"].ToString(); fileMsg.VerForm = msdr["VerForm"] == DBNull.Value ? "" : msdr["VerForm"].ToString(); fileMsg.PrintColor = msdr["PrintColor"] == DBNull.Value ? "" : msdr["PrintColor"].ToString(); fileMsg.PaperType = msdr["PaperType"] == DBNull.Value ? "" : msdr["PaperType"].ToString(); fileMsg.Printer = msdr["Printer"] == DBNull.Value ? "" : msdr["Printer"].ToString(); fileMsg.PageCount = msdr["PageCount"] == DBNull.Value ? "" : msdr["PageCount"].ToString(); fileMsg.Price = msdr["Price"] == DBNull.Value ? "" : msdr["Price"].ToString(); fileMsg.InitPrice = msdr["InitPrice"] == DBNull.Value ? "" : msdr["InitPrice"].ToString(); fileMsg.LoadTime = msdr["LoadTime"] == DBNull.Value ? "" : msdr["LoadTime"].ToString(); fileMsg.FinishTime = msdr["FinishTime"] == DBNull.Value ? "" : msdr["FinishTime"].ToString(); fileMsg.DeleteTime = msdr["DeleteTime"] == DBNull.Value ? "" : msdr["DeleteTime"].ToString(); fileMsg.state = msdr["State"] == DBNull.Value ? "" : msdr["State"].ToString(); string s = msdr["isRemove"] == DBNull.Value ? "0" : msdr["isRemove"].ToString(); fileMsg.isRemove = (s == "0" ? false : true); s = msdr["isNormalFile"] == DBNull.Value ? "0" : msdr["isNormalFile"].ToString(); fileMsg.isNormalFile = (s == "0" ? false : true); fileMsg.FileSize = (double)msdr["FileSize"]; FileMsgList.Add(fileMsg); } msdr.Close(); return(FileMsgList); } catch (Exception ex) { MessageBox.Show(ex.Message); return(null); } }
public static bool InsertFileMsg(FileMsg fileMsg, string username) { try { string sql1 = string.Format(@"INSERT INTO 文件信息 (UserID, UserName, FileName, Count, VerForm, PrinterColor, PaperType, Printer, PageCount, Price, State, LoadTime, FinishTime, ModifyTime,FileSize) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}',{14})", fileMsg.UserID.ToString(), username, fileMsg.FileName, fileMsg.Count.ToString(), fileMsg.VerForm.ToString(), fileMsg.PrintColor.ToString(), fileMsg.PaperType.Split(':')[0], fileMsg.Printer, fileMsg.PageCount == "-1"?"0": fileMsg.PageCount.ToString(), (fileMsg.Price == "" || fileMsg.Price == "----") ?"0": fileMsg.Price, fileMsg.state.ToString(), fileMsg.LoadTime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "", fileMsg.FileSize.ToString()); sql1 = sql1.Replace("\\", "\\\\"); SQLiteHelper.ExecuteNonQuery(sql1); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
public static bool UpdateTmpFileMsg(FileMsg fileMsg) { try { string sql1 = string.Format(@"update tmpfilemsg set UserID = '{0}',FileName = '{1}',FullName = '{2}',Count = '{3}',VerForm = '{4}',PrintColor = '{5}',PaperType = '{6}',Printer = '{7}',PageCount = '{8}',Price = '{9}',LoadTime = '{10}',FinishTime = '{11}',DeleteTime = '{12}',State = '{13}',isRemove = '{14}',isNormalFile = '{15}',InitPrice = '{16}' where UserID = '{17}' and FileName ='{18}' and FullName = '{19}' ", fileMsg.UserID, fileMsg.FileName, fileMsg.FullName, fileMsg.Count, fileMsg.VerForm, fileMsg.PrintColor, fileMsg.PaperType, fileMsg.Printer, fileMsg.PageCount, fileMsg.Price, fileMsg.LoadTime, fileMsg.FinishTime, fileMsg.DeleteTime, fileMsg.state, fileMsg.isRemove ? "1" : "0", fileMsg.isNormalFile ? "1" : "0", fileMsg.InitPrice, fileMsg.UserID, fileMsg.FileName, fileMsg.FullName); sql1 = sql1.Replace("\\", "\\\\"); int i = SQLiteHelper.ExecuteNonQuery(sql1); string s = i > 0 ? "成功" : "失败"; LogOperate.Add("更新文件:" + fileMsg.UserID + " " + fileMsg.FileName + " " + s); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } }
public static GroupMsg GetGroupMsg(string UserID, string UserName) { GroupMsg groupMsg = new GroupMsg(); groupMsg.FileMsgList = new List <FileMsg>(); SQLiteDataReader msdr = getUserMsg(UserName, UserID); while (msdr.Read()) { groupMsg.GroupName = msdr["UserName"].ToString(); groupMsg.Note = msdr["Note"].ToString() == ""?" ": msdr["Note"].ToString(); groupMsg.Area = msdr["Aera"].ToString(); groupMsg.Time = msdr["Time"].ToString(); groupMsg.Price = msdr["Price"].ToString(); groupMsg.FileName = msdr["FileName"].ToString(); groupMsg.VerForm = msdr["VerForm"].ToString(); groupMsg.Count = msdr["Count"].ToString(); groupMsg.Phone = msdr["Phone"].ToString(); } msdr.Close(); msdr = null; msdr = getFileMsg(UserID); while (msdr.Read()) { FileMsg fileMsg = new FileMsg(); fileMsg.Printer = msdr["Printer"].ToString(); fileMsg.FileName = msdr["FileName"].ToString(); fileMsg.Count = msdr["Count"].ToString(); fileMsg.VerForm = msdr["VerForm"].ToString(); fileMsg.FileSize = (double)msdr["FileSize"]; groupMsg.FileMsgList.Add(fileMsg); } if (groupMsg.FileMsgList == null || groupMsg.FileMsgList.Count == 0) { groupMsg.isManual = true; } msdr.Close(); return(groupMsg); }