void SaveProcessNodeUsers(List <ProcessNodeUser> flowPermission) { foreach (ProcessNodeUser nodeUser in flowPermission) { string cmdSql = "insert into sfcdatProcessNodeUser(ProcessId,NodeConfigId,targetId,type,name)values(@ProcessId,@NodeConfigId,@targetId,@type,@name)"; CmdParameter[] paras = new CmdParameter[5]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@ProcessId", Value = nodeUser.ProcessId }; paras[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@NodeConfigId", Value = nodeUser.NodeConfigId }; paras[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@targetId", Value = nodeUser.targetId }; paras[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@type", Value = nodeUser.type }; paras[4] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@name", Value = nodeUser.name }; bool flag = new BaseSQL(sqlConn).ExeSql(cmdSql, paras); } }
private static void Excute(string args) { args = args.Replace("\\", "\\\\"); try { CmdParameter cmdParameter = CmdParameter.Create(args); if (string.IsNullOrEmpty(cmdParameter.inDir)) { return; } if (!string.IsNullOrEmpty(cmdParameter.docDir)) { DocBuilder docBuilder = new DocBuilder(cmdParameter); docBuilder.Excute(); } if (!string.IsNullOrEmpty(cmdParameter.outDir)) { CompressBuilder compressor = new CompressBuilder(cmdParameter); compressor.Excute(); } } catch (Exception ex) { Console.WriteLine(string.Format("error:\"{0}\".", ex.Message)); } }
ReturnMsg GetEquiparameter() { CmdParameter[] paras = new CmdParameter[1]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@usetime", Value = model.Usetime }; StringBuilder cmdSql = new StringBuilder(); string where = (string.IsNullOrWhiteSpace(model.Usetime) ? null : $" where v.`启用日期` is not null and v.`启用日期`= @usetime "); switch (model.FuncName) { case "SummaryByDepartment": cmdSql.AppendFormat(@"SELECT v.`部门编码`, v.`部门名称`, COUNT(1) 设备数量, SUM(v.`原值`) 设备原值, SUM(v.`累计折旧`) 累计折旧, SUM(v.`原值`) - SUM(v.`累计折旧`) 设备净值 FROM v_sfcdatcurrentequiparameter v {0} GROUP BY v.`部门名称`, v.`部门编码`", where); var ds = new BaseSQL(sqlConn).QuserDs(cmdSql.ToString(), paras); var json = JsonConvert.SerializeObject(ds.Tables[0]); resultData.item = ds.Tables[0]; break; case "SummaryBySpecies": cmdSql.AppendFormat(@"SELECT v.`设备种类`, v.`设备种类编码`, COUNT(1) 设备数量, SUM(v.`原值`) 设备原值, SUM(v.`累计折旧`) 累计折旧, SUM(v.`原值`) - SUM(v.`累计折旧`) 设备净值 FROM v_sfcdatcurrentequiparameter v {0} GROUP BY v.`设备种类`, v.`设备种类编码`", where); var ds1 = new BaseSQL(sqlConn).QuserDs(cmdSql.ToString(), paras); var json1 = JsonConvert.SerializeObject(ds1.Tables[0]); resultData.item = ds1.Tables[0]; break; default: break; } Success(); return(resultData); }
/// <summary> /// 写入记录到日志表中 /// </summary> /// <param name="requestUrl"></param> /// <param name="requestBody"></param> /// <param name="response"></param> /// <param name="isSuccess"></param> /// <param name="sqlConn"></param> /// <param name="tableName"></param> public static void WriteLogToTable(string requestUrl, string requestBody, string response, string isSuccess, string sqlConn, string tableName) { try { CmdParameter[] parameters = new CmdParameter[4]; parameters[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@requestUrl", Value = requestUrl }; parameters[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@requestBody", Value = requestBody }; parameters[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@response", Value = response }; parameters[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@isSuccess", Value = isSuccess }; var strSql = $@"INSERT INTO {tableName}(RequestUrl,RequestBody,Response,IsSuccess) VALUES (@requestUrl,@requestBody,@response,@isSuccess);"; new BaseSQL(sqlConn).ExeSql(strSql.ToString(), parameters); } catch (Exception ex) { } }
public DataTable ExecSQL(string sql, Hashtable htAppend) { CmdParameterCollection cpc = new CmdParameterCollection(); DataTable dt = null; _data = DataAccessFactory.Instance.CreateDataAccess(); try { if (htAppend != null) { foreach (DictionaryEntry de in htAppend) { CmdParameter cp = new CmdParameter(de.Key.ToString(), de.Value); cpc.Add(cp); } } _data.Open(); dt = _data.ExecuteDataSet(sql, cpc).Tables[0]; } catch (Exception e) { throw e; } finally { _data.Close(); } return(dt); }
/// <summary> /// 并获取hostPath,获取审批节点ID /// </summary> /// <returns></returns> string GetHostPath() { CmdParameter[] parameters = new CmdParameter[] { }; string cmd = "SELECT hosturl from sysdatcompany limit 1;"; DataSet dataSet = new BaseSQL(sqlConn).QuserDs(cmd, parameters); return(dataSet.Tables[0].Rows[0]["hosturl"].ToString()); }
public CssCompressor(CmdParameter cmdParameter) : base(cmdParameter) { this.InnerCompressor = new yui.CssCompressor(); this.InnerCompressor.CompressionType = CompressionType.Standard; this.InnerCompressor.LineBreakPosition = cmdParameter.lineBreak < 1 ? int.MaxValue : cmdParameter.lineBreak; this.InnerCompressor.RemoveComments = cmdParameter.removeComments; this.Encoding = Encoding.GetEncoding(string.IsNullOrEmpty(cmdParameter.encoding) ? "UTF-8" : cmdParameter.encoding); }
ReturnMsg GetWarning() { string cmdSql = string.Empty; CmdParameter[] paras = new CmdParameter[3]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@pageindex", Value = (model.PageIndex - 1) * model.PageSize }; paras[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@pagesize", Value = model.PageSize }; paras[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@advancedays", Value = model.AdvanceDays }; switch (model.FuncName) { case "GetEquipmentWarrantyWarning": cmdSql = GetEquipmentWarrantyWarningCmdSql(paras); break; case "GetEquipmentScrapWarning": cmdSql = GetEquipmentScrapWarningCmdSql(paras); break; case "GetEquipmentMaintenanceWarning": cmdSql = GetEquipmentMaintenanceWarningCmdSql(paras); break; default: break; } try { DataSet ds = new BaseSQL(sqlConn).QuserDs(cmdSql, paras); resultData.item = new { data = ds.Tables[0], dataCount = ds.Tables[0].Rows.Count }; Success(); } catch (Exception ex) { Fail(ex.ToString()); } var msg = JsonConvert.SerializeObject(resultData); //return msg; return(resultData); }
public CompressBuilder(CmdParameter cmdParameter) { this.cmdParameter = cmdParameter; this.Separator = this.cmdParameter.platform == "windows" ? "\\" : "/"; this.cmdParameter.inDir = this.cmdParameter.inDir.Replace("\\", this.Separator).Replace("/", this.Separator); this.cmdParameter.outDir = this.cmdParameter.outDir.Replace("\\", this.Separator).Replace("/", this.Separator); this.Compressors = new Dictionary <string, CompressorBase>(); this.Compressors.Add(".*", new GeneralCompressor(this.cmdParameter)); this.Compressors.Add(".js", new JsCompressor(this.cmdParameter)); this.Compressors.Add(".css", new CssCompressor(this.cmdParameter)); this.Compressors.Add(".less", new CssCompressor(this.cmdParameter)); }
public JsCompressor(CmdParameter cmdParameter) : base(cmdParameter) { this.InnerCompressor = new JavaScriptCompressor(); this.InnerCompressor.CompressionType = CompressionType.Standard; this.InnerCompressor.DisableOptimizations = cmdParameter.optimize; this.InnerCompressor.ObfuscateJavascript = cmdParameter.obfuscate; this.Encoding = Encoding.GetEncoding(string.IsNullOrEmpty(cmdParameter.encoding) ? "UTF-8" : cmdParameter.encoding); this.InnerCompressor.Encoding = this.Encoding; this.InnerCompressor.LineBreakPosition = cmdParameter.lineBreak < 1 ? int.MaxValue : cmdParameter.lineBreak; this.InnerCompressor.PreserveAllSemicolons = true; this.InnerCompressor.IgnoreEval = cmdParameter.ignoreEval; }
/// <summary> /// 返回一个CmdParameter类型的对象 /// </summary> /// <param name="paraName"></param> /// <param name="Value"></param> /// <param name="paramtype"></param> /// <param name="dbtype"></param> /// <param name="size"></param> /// <param name="paramDirection"></param> /// <returns></returns> public CmdParameter CmdParameter(string paraName, object Value, string paramtype, string dbtype, int size, ParameterDirection paramDirection) { try { CmdParameter cmp = new CmdParameter(paraName, Value, paramtype, dbtype, size, paramDirection); return(cmp); } catch (Exception ex) { CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } return(null); }
public void SaveProcessDetail(ProcessDetail model) { string cmdSql = @"insert into sfcdatProcessDetail(CurrentProcessInfoId,SettingId,LoginId,ProcessStatus,Content,CurrentNodePositionId,NextNodePostionId , Creator) values(@CurrentProcessInfoId,@SettingId,@LoginId,@ProcessStatus,@Content,@CurrentNodePositionId,@NextNodePostionId , @Creator)"; CmdParameter[] paras = new CmdParameter[8]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@SettingId", Value = model.SettingId }; paras[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@LoginId", Value = model.LoginId }; paras[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@ProcessStatus", Value = model.ProcessStatus }; paras[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Content", Value = model.Content }; paras[4] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@CurrentNodePositionId", Value = model.CurrentNodePositionId }; paras[5] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@NextNodePostionId", Value = model.NextNodePostionId }; paras[6] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Creator", Value = Creator }; paras[7] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@CurrentProcessInfoId", Value = model.CurrentProcessInfoId }; bool flag = new BaseSQL(sqlConn).ExeSql(cmdSql, paras); if (!flag) { Fail("插入数据库sfcdatProcessDetail失败!"); } else { Success(); } }
/// <summary> /// 增加 /// </summary> /// <param name="model">MdcDatSuppliesManage表实体</param> /// <returns></returns> public static bool Insert(MdcDatSuppliesManage model) { string sqlcmd = @"insert into MdcDatSuppliesManage(SupplierName,SupplierCode)values (@SupplierName,@SupplierCode)"; CmdParameter[] cps = new CmdParameter[] { new CmdParameter { ParameterName = "SupplierName", Value = model.SupplierName }, new CmdParameter { ParameterName = "SupplierCode", Value = model.SupplierCode }, }; return(NMS.ExecTransql(PubUtils.uContext, sqlcmd, cps)); }
string GetMailGroupGuid(string sendLoginID) { string cmd = $"SELECT a.*,b.UserID FROM `sysdatmailgroup` a LEFT JOIN sysdatmailgroupdetail b on a.Guid=b.MailGroupID where MailGroupID='{sendLoginID}';"; CmdParameter[] parameters = new CmdParameter[0]; DataTable dt = new BaseSQL(sqlConn).QueryDt(cmd, parameters); if (dt.Rows.Count > 0) { return(dt.Rows[0]["guid"].ToString()); } else { // 新增 string guid = Guid.NewGuid().ToString(); cmd = "insert into sysdatmailgroup(guid,mailgroupname,isenable,creator) values "; cmd += "(@guid,@mailgroupname,1,@creator);"; cmd += "insert into sysdatmailgroupdetail(mailgroupid,userid,username,creator) values "; cmd += "(@guid,@userid,(select username from sysdatuser where userid=@userid),@creator);"; parameters = new CmdParameter[4]; parameters[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@guid", Value = guid }; parameters[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@mailgroupname", Value = "system(" + sendLoginID + "):" + guid }; parameters[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@creator", Value = creator }; parameters[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@userid", Value = sendLoginID.Remove(0, 3) }; bool flag = new BaseSQL(sqlConn).ExeSql(cmd, parameters); if (flag) { return(guid); } else { throw new Exception("自动设置群组失败"); } } }
/// <summary> /// 创建CmdParameter类型的带参构造函数,因为WCF不支持带参数的构造函数,所以放在这里创建 /// </summary> /// <param name="paraName"></param> /// <param name="Value"></param> /// <returns></returns> public CmdParameter CmdParameter(string paraName, object Value) { CmdParameter cmp = new CmdParameter(); try { cmp.ParameterName = paraName; cmp.Value = Value; } catch (Exception ex) { CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } return(cmp); }
/// <summary> /// 修改 /// </summary> /// <param name="model">SysdatMPNCustomer表实体</param> /// <returns></returns> public static bool Update(SysdatMPNCustomer model) { string sqlcmd = @" update SysdatMPNCustomer set CustomerID=@CustomerID, CustomerCode=@CustomerCode, CustomerName=@CustomerName, Creator=@Creator, CreateTime=@CreateTime, Contact=@Contact, ContactNumber=@ContactNumber, Email=@Email, ShippingAddress=@ShippingAddress where CustomerID=@CustomerID" ; CmdParameter[] cps = new CmdParameter[] { new CmdParameter { ParameterName = "CustomerID", Value = model.CustomerID }, new CmdParameter { ParameterName = "CustomerCode", Value = model.CustomerCode }, new CmdParameter { ParameterName = "CustomerName", Value = model.CustomerName }, new CmdParameter { ParameterName = "Creator", Value = model.Creator }, new CmdParameter { ParameterName = "CreateTime", Value = model.CreateTime }, new CmdParameter { ParameterName = "Contact", Value = model.Contact }, new CmdParameter { ParameterName = "ContactNumber", Value = model.ContactNumber }, new CmdParameter { ParameterName = "Email", Value = model.Email }, new CmdParameter { ParameterName = "ShippingAddress", Value = model.ShippingAddress } }; return(NMS.ExecTransql(PubUtils.uContext, sqlcmd, cps)); }
void CreateNotifMsg(string title, string mailGroupGuid, string sendLoginID, string addTitle, string endTitle, string addGuid) { CmdParameter[] parameters = new CmdParameter[0]; string cmd = "insert into sysdatnotify(title,eventid,content,type,level,isenable,isgroup,groupid,groupname,starttime,endtime,creator)values"; cmd += "(@title,1,@content,1,1,1,1,@groupid,@groupname,(select now() as 'starttime'),(select date_add(NOW(), interval 1 MONTH) as 'endtime'),@creator);"; //cmd += "insert into sysdatusernotify(loginid,msgid,isread,isenable,creator)values"; //cmd += "(@loginid,(select id from sysdatnotify where title=@title limit 1),0,1,@creator);"; parameters = new CmdParameter[10]; parameters[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@groupid", Value = mailGroupGuid }; parameters[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@groupname", Value = mailGroupGuid }; parameters[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@title", Value = title + addGuid }; parameters[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@content", Value = addTitle + title + " " + endTitle }; parameters[4] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@loginid", Value = sendLoginID }; parameters[5] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@creator", Value = creator }; bool flag = new BaseSQL(sqlConn).ExeSql(cmd, parameters); if (!flag) { throw new Exception("创建通知消息失败"); } }
/// <summary> /// 修改 /// </summary> /// <param name="model">MdcDatSuppliesManage表实体</param> /// <returns></returns> public static bool Update(MdcDatSuppliesManage model, string oldSupplierCode) { string sqlcmd = @" update MdcDatSuppliesManage set SupplierName=@SupplierName, SupplierCode=@SupplierCode where SupplierCode=@oldSupplierCode" ; CmdParameter[] cps = new CmdParameter[] { new CmdParameter { ParameterName = "SupplierName", Value = model.SupplierName }, new CmdParameter { ParameterName = "SupplierCode", Value = model.SupplierCode }, new CmdParameter { ParameterName = "oldSupplierCode", Value = oldSupplierCode } }; return(NMS.ExecTransql(PubUtils.uContext, sqlcmd, cps)); }
protected static void WriteErrorLog(string sqlConn, object content, string creator) { try { var strSql = @"INSERT INTO logdaterror (Content,Creator) VALUES (@Content,@Creator);"; CmdParameter[] parameters = new CmdParameter[3]; parameters[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Content", Value = JsonConvert.SerializeObject(content) }; parameters[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Creator", Value = creator }; new BaseSQL(sqlConn).ExeSqlTrans(strSql.ToString(), parameters); } catch (Exception ex) { } }
ReturnMsg SetErrortypeCode(sfcdaterrortype model) { if (string.IsNullOrWhiteSpace(model.parentcode)) { model.parentcode = "0"; } if (model != null) { string maxCode = string.Empty; string maxCodeSql = "select CONCAT('00',max(c.errorcode)+1) maxcode from sfcdaterrortype c where c.parentcode=@parentcode;"; CmdParameter[] maxCodeparas = new CmdParameter[1]; maxCodeparas[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@parentcode", Value = model.parentcode }; DataSet ds = new BaseSQL(sqlConn).QuserDs(maxCodeSql, maxCodeparas); if (ds.Tables[0].Rows.Count > 0) { var row = ds.Tables[0].Rows[0]; maxCode = row["maxcode"] != DBNull.Value ? row["maxcode"].ToString() : (model.parentcode + "001"); } else { Fail("未查询到数据表sfcdaterrortype对应的parentcode数据"); } model.errorcode = maxCode; bool flag = AddBysql <sfcdaterrortype>(model); if (flag) { Success(); } else { Fail($"插入数据表sfcdaterrortype失败!"); } } return(resultData); }
/// <summary> /// 将SqlParameter类型转换为CmdParameter /// </summary> /// <param name="prams"></param> /// <returns></returns> private CmdParameter[] RecoverParameter(SqlParameter[] prams) { if (prams == null) { return(null); } CmdParameter[] sqlPrams = new CmdParameter[prams.Length]; try { for (int i = 0; i < prams.Length; i++) { CmdParameter sqlPram = new CmdParameter(prams[i].ParameterName, prams[i].Value); sqlPrams[i] = sqlPram; //sqlPrams[i].Direction = prams[i]. .Direction;// ParameterDirection.Output; } } catch (Exception ex) { CFunctions.HandleException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex); } return(sqlPrams); }
/// <summary> /// 保存流程配置 /// </summary> public void SaveProcessSetting(ProcessSetting model) { string cmdSql = "insert into sfcdatProcessSetting(Code,Content,Status,LoginId,Creator) values(@Code,@Content,@Status,@LoginId,@Creator)"; CmdParameter[] paras = new CmdParameter[5]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Code", Value = model.Code }; paras[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Content", Value = model.Content }; paras[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Status", Value = model.Status }; paras[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@LoginId", Value = model.LoginId }; paras[4] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Creator", Value = Creator }; bool flag = new BaseSQL(sqlConn).ExeSql(cmdSql, paras); if (!flag) { Fail("插入数据库ApprovalProcessSetting失败!"); } else { Success(); } }
public void SaveProcessInfo(ProcessInfo model) { SaveProcessNodeUsers(model.flowPermission); string cmdSql = "insert into sfcdatProcessInfo(Code,tableId,workFlowVersionId,workFlowDef,directorMaxLevel,nodeConfig)values(@Code,@tableId,@workFlowVersionId,@workFlowDef,@directorMaxLevel,@nodeConfig)"; CmdParameter[] paras = new CmdParameter[5]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Code", Value = model.Code }; paras[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@tableId", Value = model.tableId }; paras[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@workFlowVersionId", Value = model.workFlowVersionId }; paras[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@workFlowDef", Value = model.workFlowDef }; paras[4] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@directorMaxLevel", Value = model.directorMaxLevel }; paras[5] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@nodeConfig", Value = model.nodeConfig }; bool flag = new BaseSQL(sqlConn).ExeSql(cmdSql, paras); if (!flag) { Fail("插入数据库ProcessInfo失败!"); } }
/// <summary> /// 增加 /// </summary> /// <param name="model">SysdatMPNCustomer表实体</param> /// <returns></returns> public static bool Insert(SysdatMPNCustomer model) { string sqlcmd = @"insert into SysdatMPNCustomer(CustomerID,CustomerCode,CustomerName,Creator,CreateTime,Contact,ContactNumber,Email,ShippingAddress) values (@CustomerID,@CustomerCode,@CustomerName,@Creator,@CreateTime,@Contact,@ContactNumber,@Email,@ShippingAddress)"; CmdParameter[] cps = new CmdParameter[] { new CmdParameter { ParameterName = "CustomerID", Value = model.CustomerID }, new CmdParameter { ParameterName = "CustomerCode", Value = model.CustomerCode }, new CmdParameter { ParameterName = "CustomerName", Value = model.CustomerName }, new CmdParameter { ParameterName = "Creator", Value = model.Creator }, new CmdParameter { ParameterName = "CreateTime", Value = model.CreateTime }, new CmdParameter { ParameterName = "Contact", Value = model.Contact }, new CmdParameter { ParameterName = "ContactNumber", Value = model.ContactNumber }, new CmdParameter { ParameterName = "Email", Value = model.Email }, new CmdParameter { ParameterName = "ShippingAddress", Value = model.ShippingAddress } }; return(NMS.ExecTransql(PubUtils.uContext, sqlcmd, cps)); }
/// <summary> /// 将设计器中的对像列表保存到文件中 /// </summary> /// <param name="designer">所要保存的设计器</param> /// <param name="fileName">要保存的文件名称</param> public static void SaveFile(Designer designer, string Name) { if (Name.Trim().Length > 0) { Name = Name.Replace("当前模板名称为:", ""); ObjectSerializer osave = new ObjectSerializer(designer.Items, designer.Width, designer.Height, designer.PrinterConfig, designer.PageRows, designer.RowHeight); //定义一个流 MemoryStream stream = new MemoryStream(); //定义一个格式化器 BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(stream, osave); //序列化 byte[] array = null; array = new byte[stream.Length]; //将二进制流写入数组 stream.Position = 0; stream.Read(array, 0, (int)stream.Length); //关闭流 stream.Close(); CmdParameter[] cmd = new CmdParameter[1]; CmdParameter cmd1 = new CmdParameter(); cmd1.ParameterName = "val"; cmd1.Value = array; cmd[0] = cmd1; NMS.ExecTransql(PubUtils.uContext, "if exists( select *from mdcdatbarcodetemplet where name='" + Name + "') begin update mdcdatbarcodetemplet set context=@val,updator='" + PubUtils.uContext.UserName + "',updatetime=getdate() where name='" + Name + "' end else begin insert into mdcdatbarcodetemplet(fguid,name,context,creator,createtime)values('','" + Name + "',@val,'" + PubUtils.uContext.UserName + "',getdate()) end", cmd); } //using (FileStream fs = new FileStream(fileName, FileMode.Create)) //{ // BinaryFormatter bf = new BinaryFormatter(); // bf.Serialize(fs, osave); // fs.Close(); // bf = null; //} }
public CompressorBase(CmdParameter cmdParameter) { this.CmdParameter = cmdParameter; }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(CIT.Model.SfcDatProductProRouteLog model) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SfcDatProductProRouteLog("); strSql.Append("SfcNO,fguid,RepairHouseName,RepairHouse,Wocode,Product,ProductName,PCBCode,ProcessID,ProcessName,RouteID,RouteName,Type,Status,ErrorCode,Fnote,Creator,Createtime,line,msg,station)"); strSql.Append(" values ("); strSql.Append("@SfcNO,@Fguid,@RepairHouseName,@RepairHouse,@Wocode,@Product,@ProductName,@PCBCode,@ProcessID,@ProcessName,@RouteID,@RouteName,@Type,@Status,@ErrorCode,@Fnote,@Creator,getdate(),@line,@msg,@station)"); SqlParameter[] parameters = { new SqlParameter("@SfcNO", SqlDbType.NVarChar, 50), new SqlParameter("@Fguid", SqlDbType.NVarChar, 50), new SqlParameter("@RepairHouseName", SqlDbType.NVarChar, 50), new SqlParameter("@RepairHouse", SqlDbType.NVarChar, 50), new SqlParameter("@Wocode", SqlDbType.NVarChar, 50), new SqlParameter("@Product", SqlDbType.NVarChar, 50), new SqlParameter("@ProductName", SqlDbType.NVarChar, 50), new SqlParameter("@PCBCode", SqlDbType.NVarChar, 50), new SqlParameter("@ProcessID", SqlDbType.NVarChar, 50), new SqlParameter("@ProcessName", SqlDbType.NVarChar, 50), new SqlParameter("@RouteID", SqlDbType.NVarChar, 50), new SqlParameter("@RouteName", SqlDbType.NVarChar, 50), new SqlParameter("@Type", SqlDbType.NVarChar, 50), new SqlParameter("@Status", SqlDbType.NVarChar, 50), new SqlParameter("@ErrorCode", SqlDbType.NVarChar, 50), new SqlParameter("@Fnote", SqlDbType.NVarChar, 50), new SqlParameter("@Creator", SqlDbType.NVarChar, 50), new SqlParameter("@line", SqlDbType.NVarChar, 50), new SqlParameter("@msg", SqlDbType.NVarChar, 500), new SqlParameter("@station", SqlDbType.NVarChar, 500) }; parameters[0].Value = model.SfcNO; parameters[1].Value = model.Fguid; parameters[2].Value = model.RepairHouseName; parameters[3].Value = model.RepairHouse; parameters[4].Value = model.Wocode; parameters[5].Value = model.Product; parameters[6].Value = model.ProductName; parameters[7].Value = model.PCBCode; parameters[8].Value = model.ProcessID; parameters[9].Value = model.ProcessName; parameters[10].Value = model.RouteID; parameters[11].Value = model.RouteName; parameters[12].Value = model.Type; parameters[13].Value = model.Status; parameters[14].Value = model.ErrorCode; parameters[15].Value = model.Fnote; parameters[16].Value = model.Creator; parameters[17].Value = model.Line; parameters[18].Value = model.Msg; parameters[19].Value = model.Station; CmdParameter[] cmd = new CmdParameter[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { cmd[i].ParameterName = parameters[i].ParameterName; cmd[i].Value = parameters[i].Value; } return(NMS.ExecTransql(CIT.MES.PubUtils.uContext, strSql.ToString(), cmd)); } catch { return(false); } }
private void Button_Click(object sender, RoutedEventArgs e) { //ServiceReference1.DbServiceClient clien = new ServiceReference1.DbServiceClient(); //clien.Test(); try { ServiceReference3.DbServiceClient client = new ServiceReference3.DbServiceClient(); // ServiceReference2.OraDbServiceClient client = new ServiceReference2.OraDbServiceClient(); //int Pindex, string Psql, int Psize, out int Pcount, out int Prowcount //CmdParameter[] paras = new CmdParameter[] { // dbc.CmdParameter("@Pindex",0), // dbc.CmdParameter("@Psql",menu.LABEL_TYPE_ID), // dbc.CmdParameter("@Psize",menu.LABEL_NAME), // dbc.CmdParameter("@Pcount",menu.LABEL_CODE), // dbc.CmdParameter("@Prowcount",menu.LABEL_CODE) //} //DataTable dt = client.getDataBySql(" select * from CL_WLQD "); //OracleParameterCollection pars = new OracleParameterCollection(); //pars.Add(new OracleParameter("PSQL", OracleType.VarChar, 500)); //pars["PSQL"].Value = " 1=1 "; //pars["PSQL"].Direction = ParameterDirection.Input; //pars.Add(new OracleParameter("v_cur", OracleType.Cursor)); //pars["v_cur"].Direction = ParameterDirection.Output; //OracleParameter[] paras = new OracleParameter[]{ // new OracleParameter("PSQL",OracleType.VarChar,500), // new OracleParameter("v_cur", OracleType.Cursor) //}; //paras[0].Value = " 1=1 "; //paras[0].Direction = ParameterDirection.Input; //paras[1].Direction = ParameterDirection.Output;// System.Data.OracleClient.OracleType.VarChar; // }; // (); //paras.["PSQL"].Value = " 1=1 "; // da.SelectCommand.Parameters["PSQL"].Direction = ParameterDirection.Input; // da.SelectCommand.Parameters.Add(new OracleParameter("v_cur", OracleType.Cursor)); // da.SelectCommand.Parameters["v_cur"].Direction = ParameterDirection.Output; //DataTable dt2 = client.GetTableByProc(" BIM.CL_WLQD_GET", paras); //新增数据 // OracleParameter[] paras = new OracleParameter[]{ // new OracleParameter("WL_GUID",OracleType.VarChar,50), // new OracleParameter("CLFL_GUID",OracleType.VarChar,50), // new OracleParameter("ZLX",OracleType.VarChar,300), // new OracleParameter("GG",OracleType.VarChar,300), // new OracleParameter("CLXH",OracleType.VarChar,300), // new OracleParameter("CD",OracleType.VarChar,300), // new OracleParameter("KD",OracleType.VarChar,300), // new OracleParameter("GD",OracleType.VarChar,300), // new OracleParameter("GCL",OracleType.Number), // new OracleParameter("DW",OracleType.VarChar,300), // new OracleParameter("BZ",OracleType.VarChar,800), // new OracleParameter("RESULTVALUE", OracleType.Int32) // }; // paras[0].Value = " ASDAS2233"; // // paras[0].Direction = ParameterDirection.Input; // paras[1].Value = ""; ////paras[1].Direction = ParameterDirection.Input; // paras[2].Value = " ASDAS"; // paras[3].Value = " ASDAS"; // paras[4].Value = " ASDAS"; // paras[5].Value = " ASDAS"; // paras[6].Value = " ASDAS"; // paras[7].Value = " ASDAS"; // paras[8].Value = 33; // paras[9].Value = " ASDAS"; // paras[10].Value = " ASDAS"; // paras[11].Direction = ParameterDirection.Output;// System.Data.OracleClient.OracleType.VarChar; // int vv = client.ExcuteProc("BIM.CL_WLQD_ADD", paras); client.init("PlatFormDB", "ORACLE"); if (1 == 2) { } CmdParameter[] paras = new CmdParameter[] { client.CmdParameter("PSQL", " 1=1 ", "Varchar", "ORACLE", 500, ParameterDirection.Input), client.CmdParameter("v_cur", "", "Cursor", "ORACLE", 500, ParameterDirection.Output) }; DataTable dt2 = client.GetTableByProc("PlatForm_Auth_User.SP_SYS_USER_GET", paras); int i = 0; //dbc.init(Utility.Funtcions.getConfigValue("PlatFormDB")); // CmdParameter[] paras = new CmdParameter[] { dbc.CmdParameter("@VALUE",uWhere) // }; //CmdParameter[] paras2 = new CmdParameter[] { new CmdParameter(){ParameterName= "@VALUE",Value =uWhere} // }; //DataTable dt = dbc.GetTableByProc("SP_SYS_USER_GET", paras); //ServiceReference4.SqlDbServiceClient client = new ServiceReference4.SqlDbServiceClient(); // client.init("PlatFormDB"); // CmdParameter[] paras = new CmdParameter[] { client.CmdParameter("@VALUE"," and 1=1 ") // }; // DataTable dt = client.GetTableByProc("SP_SYS_USER_GET", paras); //client = new ServiceReference3.DbServiceClient(); //client.init("PlatFormDB", "SQLSERVER"); //CmdParameter[] pars = new CmdParameter[1] ; //CmdParameter cm = client.CmdParameter("@VALUE", " AND 1=1 ", "Varchar", "SQLSERVER", 500, ParameterDirection.Input); //pars[0] = cm; //DataTable dt = client.GetTableByProc("SP_SYS_USER_GET", pars); int k = 0; } catch (Exception ex) { } }
/// <summary> /// 删除单个台账管理信息 /// </summary> /// <param name="Parameter"></param> /// <returns></returns> public ReturnMsg DeleteEqui(InvokeEntity Parameter) { userInfo = BasePubCommon.FindLoginUserInfo(Parameter.token); var JO = JsonConvert.DeserializeObject <JObject>(Parameter.obj.ToString()); var code = JO["equiCode"].ToString(); this.sqlConn = Parameter.SqlConnection; var conn = new BaseSQL(sqlConn); bool flag = false; try { Fail("删除失败"); //删除设备以及关联的表信息 conn.BeginTrans(); //删除设备信息 string Sql = "delete from sfcdatequipmentinfo where code=@code"; CmdParameter[] paras = new CmdParameter[1]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@code", Value = code }; flag = conn.ExeSql(Sql, paras); //删除附件信息 Sql = "delete from sfcdatattachment where equipmentinfocode=@code"; flag = conn.ExeSql(Sql, paras); //删除文档信息 Sql = "delete from sfcdatdocument where equipmentinfocode=@code"; flag = conn.ExeSql(Sql, paras); //删除图片信息 Sql = "delete from sfcdatpic where equipmentinfocode=@code"; flag = conn.ExeSql(Sql, paras); //删除维修记录 Sql = "delete from sfcdatmaintenancerecord where equipmentcode=@code"; flag = conn.ExeSql(Sql, paras); //删除调拨记录 Sql = "delete from sfcdattransferrecord where equipmentinfocode=@code"; flag = conn.ExeSql(Sql, paras); //删除报废记录 Sql = "delete from sfcdatscraprecord where equipmentinfocode =@code"; flag = conn.ExeSql(Sql, paras); //删除其它异动 Sql = "delete from sfcdatothermove where equipmentinfocode =@code"; flag = conn.ExeSql(Sql, paras); //删除定期检修 Sql = "delete from sfcdatrepairinfo where equipmentcode =@code"; flag = conn.ExeSql(Sql, paras); conn.Commit(); Success(); return(resultData); } catch (Exception ex) { conn.Rollback(); return(resultData); } }
ReturnMsg SetEquipmentSpecieCode(Sfcdatequipmentspecies model) { if (string.IsNullOrWhiteSpace(model.parentcode)) { model.parentcode = "0"; } if (model != null) { string maxCode = string.Empty; string maxCodeSql = "select CONCAT('00',max(c.code)+1) maxcode from Sfcdatequipmentspecies c where c.parentcode=@parentcode;"; CmdParameter[] maxCodeparas = new CmdParameter[1]; maxCodeparas[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@parentcode", Value = model.parentcode }; DataSet ds = new BaseSQL(sqlConn).QuserDs(maxCodeSql, maxCodeparas); if (ds.Tables[0].Rows.Count > 0) { var row = ds.Tables[0].Rows[0]; maxCode = row["maxcode"] != DBNull.Value ? row["maxcode"].ToString() : (model.parentcode + "001"); } else { Fail("未查询到数据parentCode对应的数据"); } #region Insert Sql string cmdSql = @"insert into Sfcdatequipmentspecies( code, name, parentcode, parentname, internalcode, warrantymonth, scrapmonth, depreciationwayname, depreciationwayid, salvage, depreciationmonth, Creator, Attributionname, Attributionid )values( @code, @name, @parentcode, @parentname, @internalcode, @warrantymonth, @scrapmonth, @depreciationwayname, @depreciationwayid, @salvage, @depreciationmonth, @Creator, @Attributionname, @Attributionid ); "; #endregion CmdParameter[] paras = new CmdParameter[14]; paras[0] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@code", Value = maxCode }; paras[1] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@name", Value = model.name }; paras[2] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@parentcode", Value = model.parentcode }; paras[3] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@parentname", Value = model.parentname }; paras[4] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@internalcode", Value = model.internalcode }; paras[5] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@warrantymonth", Value = model.warrantymonth }; paras[6] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@scrapmonth", Value = model.scrapmonth }; paras[7] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@depreciationwayname", Value = model.depreciationwayname }; paras[8] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@depreciationwayid", Value = model.depreciationwayid }; paras[9] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@salvage", Value = model.salvage }; paras[10] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@depreciationmonth", Value = model.depreciationmonth }; paras[11] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Creator", Value = model.Creator }; paras[12] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Attributionname", Value = model.Attributionname }; paras[13] = new CmdParameter() { DBtype = DBType.String, ParameterName = "@Attributionid", Value = model.Attributionid }; bool flag = new BaseSQL(sqlConn).ExeSql(cmdSql, paras); if (!flag) { Fail("插入数据库Sfcdatequipmentspecies失败!"); } } Success(); return(resultData); }