private Tb_AutoDeployLog_Mod Tb_AutoDeployLog_Info(string otherId, string deployState) { Tb_AutoDeployLog_Mod info = new Tb_AutoDeployLog_Mod(); info.NewListId = Guid.NewGuid().ToString("N"); info.OldListId = "1"; info.OtherType = "2"; info.OtherId = otherId; info.DeployType = "2"; info.DeployState = deployState; info.Status = "1"; info.OperaTime = DateTime.Now; info.OperateType = "1"; return(info); }
public static void Insert(Tb_AutoDeployLog_Mod info) { Database db = DataConnect.GetConnect; DbCommand cmd = db.GetSqlStringCommand("INSERT INTO TB_AUTODEPLOYLOG (NEWLISTID,Oldlistid,Othertype,Otherid,Deploytype,Deploystate,Status,Operatime,OPERATETYPE)VALUES(:NEWLISTID,:Oldlistid,:Othertype,:Otherid,:Deploytype,:Deploystate,:Status, :Operatime,:OPERATETYPE )"); db.AddInParameter(cmd, ":NEWLISTID", DbType.String, info.NewListId); db.AddInParameter(cmd, ":Oldlistid", DbType.String, info.OldListId); db.AddInParameter(cmd, ":Othertype", DbType.String, info.OtherType); db.AddInParameter(cmd, ":Otherid", DbType.String, info.OtherId); db.AddInParameter(cmd, ":Deploytype", DbType.String, info.DeployType); db.AddInParameter(cmd, ":Deploystate", DbType.String, info.DeployState); db.AddInParameter(cmd, ":Status", DbType.String, info.Status); db.AddInParameter(cmd, ":Operatime", DbType.Date, info.OperaTime); db.AddInParameter(cmd, ":OPERATETYPE", DbType.String, info.OperateType); db.ExecuteNonQuery(cmd); }
public bool Execute() { try { byte[] bDianBiao1 = new byte[4]; Array.Copy(_content, 0, bDianBiao1, 0, 4); string dianbiao1 = (Convert.ToUInt32(ConverUtil.ByteToStr_A(bDianBiao1), 16)).ToString(); string dianbiaoState1 = _content[4].ToString(); byte[] bDianBiao2 = new byte[4]; Array.Copy(_content, 5, bDianBiao2, 0, 4); string dianbiao2 = (Convert.ToInt32(ConverUtil.ByteToStr_A(bDianBiao2), 16)).ToString(); string dianbiaoState2 = _content[9].ToString(); string sblx = "257"; string room = Tb_DeviceInfo_Dal.Select(sblx, dianbiao1, dianbiaoState1); string bfState = dianbiaoState1 == "1" ? "1" : "2"; Info = Tb_AutoDeployLog_Info(room, bfState); Tb_AutoDeployLog_Dal.Insert(Info); if (!string.IsNullOrEmpty(room)) { Tb_RoomInfo_Dal.Update(room, bfState); } room = Tb_DeviceInfo_Dal.Select(sblx, dianbiao2, dianbiaoState2); string bfState2 = dianbiaoState2 == "1" ? "1" : "2"; Info = Tb_AutoDeployLog_Info(room, bfState2); Tb_AutoDeployLog_Dal.Insert(Info); if (!string.IsNullOrEmpty(room)) { Tb_RoomInfo_Dal.Update(room, bfState2); } } catch (Exception ex) { MyLibrary.Log.Error(Name + "错误: " + ex.Message + " 原始代码:" + OriginalCode); } return(true); }