/// <summary> /// 更新用户信息 /// </summary> /// <param name="info">用户信息</param> public void UpdateUser(UserInfo info) { sqlStr = "UPDATE tblUser SET LoginID = @LoginID, Name = @Name, RoleID = @RoleID, " + " Mobile = @Mobile,Email=@Email,Address = @Address, IsActive = @IsActive,LoginPwd = @LoginPwd,Department = @Department,VerifyStatus = @VerifyStatus,Comments = @Comments "; sqlStr += "WHERE ID = @ID"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@LoginID", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.LoginID); command.Parameters.Add("@LoginPwd", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.LoginPwd); command.Parameters.Add("@Name", SqlDbType.NVarChar).Value = info.Name; command.Parameters.Add("@RoleID", SqlDbType.Int).Value = info.Role.ID; command.Parameters.Add("@Mobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Mobile); command.Parameters.Add("@Address", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Address); command.Parameters.Add("@Email", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Email); command.Parameters.Add("@IsActive", SqlDbType.Bit).Value = info.IsActive; command.Parameters.Add("@Department", SqlDbType.Int).Value = info.Department.ID; command.Parameters.Add("@VerifyStatus", SqlDbType.Int).Value = info.VerifyStatus.ID; command.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Comments); command.Parameters.Add("@ID", SqlDbType.Int).Value = info.ID; command.ExecuteNonQuery(); } }
/// <summary> /// 保存服务凭证信息 /// </summary> /// <param name="dispatchJournal">服务凭证信息</param> /// <returns>服务凭证ID</returns> public int AddDispatchJournal(DispatchJournalInfo dispatchJournal) { sqlStr = "INSERT INTO tblDispatchJournal(DispatchID,FaultCode,JobContent,FujiComments,ResultStatusID, " + " FollowProblem,Advice,UserName,UserMobile,Signed,StatusID) " + " VALUES(@DispatchID,@FaultCode,@JobContent,@FujiComments,@ResultStatusID, " + " @FollowProblem,@Advice,@UserName,@UserMobile,@Signed,@StatusID); " + " SELECT @@IDENTITY"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@DispatchID", SqlDbType.Int).Value = dispatchJournal.Dispatch.ID; command.Parameters.Add("@FaultCode", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.FaultCode); command.Parameters.Add("@JobContent", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.JobContent); command.Parameters.Add("@ResultStatusID", SqlDbType.Int).Value = dispatchJournal.ResultStatus.ID; command.Parameters.Add("@FollowProblem", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.FollowProblem); command.Parameters.Add("@Advice", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.Advice); command.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(dispatchJournal.UserName); command.Parameters.Add("@UserMobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(dispatchJournal.UserMobile); command.Parameters.Add("@Signed", SqlDbType.Bit).Value = dispatchJournal.Signed; command.Parameters.Add("@StatusID", SqlDbType.Int).Value = dispatchJournal.Status.ID; command.Parameters.Add("@FujiComments", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.FujiComments); dispatchJournal.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); } return(dispatchJournal.ID); }
/// <summary> /// 新增用户 /// </summary> /// <param name="info">用户信息</param> /// <returns>用户信息</returns> public UserInfo AddUser(UserInfo info) { sqlStr = "INSERT INTO tblUser(LoginID,LoginPwd,Name,RoleID,Address, " + " Mobile,Email,IsActive,LastLoginDate,CreatedDate,VerifyStatus,Department ) " + " VALUES(@LoginID,@LoginPwd,@Name,@RoleID,@Address, " + " @Mobile,@Email,@IsActive,null,GETDATE(),@VerifyStatus,@Department );" + " SELECT @@IDENTITY"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@LoginID", SqlDbType.VarChar).Value = info.LoginID; command.Parameters.Add("@LoginPwd", SqlDbType.VarChar).Value = info.LoginPwd; command.Parameters.Add("@Name", SqlDbType.NVarChar).Value = info.Name; command.Parameters.Add("@RoleID", SqlDbType.Int).Value = info.Role.ID; command.Parameters.Add("@Address", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Address); command.Parameters.Add("@Mobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Mobile); command.Parameters.Add("@Email", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Email); command.Parameters.Add("@IsActive", SqlDbType.Bit).Value = info.IsActive; command.Parameters.Add("@VerifyStatus", SqlDbType.Int).Value = info.VerifyStatus.ID; command.Parameters.Add("@Department", SqlDbType.Int).Value = info.Department.ID; info.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); return(info); } }
/// <summary> /// 修改服务凭证信息 /// </summary> /// <param name="dispatchJournal">服务凭证信息</param> public void UpdateDispatchJournal(DispatchJournalInfo dispatchJournal) { sqlStr = "UPDATE tblDispatchJournal SET DispatchID = @DispatchID,FaultCode=@FaultCode," + " FujiComments=@FujiComments,JobContent=@JobContent,ResultStatusID=@ResultStatusID,StatusID=@StatusID,FollowProblem=@FollowProblem," + " Advice=@Advice,UserName=@UserName,UserMobile=@UserMobile, Signed=@Signed"; sqlStr += " WHERE ID = @ID"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@DispatchID", SqlDbType.VarChar).Value = dispatchJournal.Dispatch.ID; command.Parameters.Add("@FaultCode", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.FaultCode); command.Parameters.Add("@JobContent", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.JobContent); command.Parameters.Add("@ResultStatusID", SqlDbType.Int).Value = dispatchJournal.ResultStatus.ID; command.Parameters.Add("@StatusID", SqlDbType.Int).Value = dispatchJournal.Status.ID; command.Parameters.Add("@FollowProblem", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.FollowProblem); command.Parameters.Add("@Advice", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.Advice); command.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(dispatchJournal.UserName); command.Parameters.Add("@UserMobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(dispatchJournal.UserMobile); command.Parameters.Add("@Signed", SqlDbType.Bit).Value = dispatchJournal.Signed; command.Parameters.Add("@ID", SqlDbType.Int).Value = dispatchJournal.ID; command.Parameters.Add("@FujiComments", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(dispatchJournal.FujiComments); command.ExecuteNonQuery(); } }
public void ImportRequest(List <EntityInfo> infos) { sqlStr = "INSERT INTO tblRequest(Source,RequestType,IsRecall,RequestUserID,RequestUserName,RequestUserMobile," + " Subject,EquipmentStatus,FaultTypeID,FaultDesc,StatusID,DealTypeID,PriorityID,RequestDate,DistributeDate,ResponseDate,CloseDate,SelectiveDate,LastStatusID) " + " VALUES(@Source,@RequestType,@IsRecall,@RequestUserID,@RequestUserName,@RequestUserMobile," + " @Subject,@EquipmentStatus,@FaultTypeID,@FaultDesc,@StatusID,@DealTypeID,@PriorityID,@RequestDate,@DistributeDate,@ResponseDate,@CloseDate, @SelectiveDate,1)"; using (SqlCommand command = DatabaseConnection.GetCommand(sqlStr)) { command.Parameters.Add("@Source", SqlDbType.Int); command.Parameters.Add("@RequestType", SqlDbType.Int); command.Parameters.Add("@IsRecall", SqlDbType.Bit); command.Parameters.Add("@RequestUserID", SqlDbType.Int); command.Parameters.Add("@RequestUserName", SqlDbType.NVarChar); command.Parameters.Add("@RequestUserMobile", SqlDbType.VarChar); command.Parameters.Add("@Subject", SqlDbType.NVarChar); command.Parameters.Add("@EquipmentStatus", SqlDbType.Int); command.Parameters.Add("@FaultTypeID", SqlDbType.Int); command.Parameters.Add("@FaultDesc", SqlDbType.NVarChar); command.Parameters.Add("@StatusID", SqlDbType.Int); command.Parameters.Add("@DealTypeID", SqlDbType.Int); command.Parameters.Add("@PriorityID", SqlDbType.Int); command.Parameters.Add("@RequestDate", SqlDbType.DateTime); command.Parameters.Add("@DistributeDate", SqlDbType.DateTime); command.Parameters.Add("@ResponseDate", SqlDbType.DateTime); command.Parameters.Add("@CloseDate", SqlDbType.DateTime); command.Parameters.Add("@SelectiveDate", SqlDbType.DateTime); foreach (RequestInfo info in infos) { if (info.Source.ID == 0) { return; } command.Parameters["@Source"].Value = info.Source.ID; command.Parameters["@RequestType"].Value = info.RequestType.ID; command.Parameters["@IsRecall"].Value = info.IsRecall; command.Parameters["@RequestUserID"].Value = SQLUtil.ZeroToNull(info.RequestUser.ID); command.Parameters["@RequestUserName"].Value = SQLUtil.EmptyStringToNull(info.RequestUser.Name); command.Parameters["@RequestUserMobile"].Value = SQLUtil.EmptyStringToNull(info.RequestUser.Mobile); command.Parameters["@Subject"].Value = SQLUtil.TrimNull(info.Subject); command.Parameters["@EquipmentStatus"].Value = info.MachineStatus.ID; command.Parameters["@FaultTypeID"].Value = SQLUtil.ZeroToNull(info.FaultType.ID); command.Parameters["@FaultDesc"].Value = SQLUtil.TrimNull(info.FaultDesc); command.Parameters["@StatusID"].Value = info.Status.ID; command.Parameters["@DealTypeID"].Value = info.DealType.ID; command.Parameters["@PriorityID"].Value = info.Priority.ID; command.Parameters["@RequestDate"].Value = info.RequestDate == DateTime.MinValue ? DateTime.Now : info.RequestDate; command.Parameters["@DistributeDate"].Value = SQLUtil.MinDateToNull(info.DistributeDate); command.Parameters["@ResponseDate"].Value = SQLUtil.MinDateToNull(info.ResponseDate); command.Parameters["@CloseDate"].Value = SQLUtil.MinDateToNull(info.CloseDate); command.Parameters["@SelectiveDate"].Value = SQLUtil.MinDateToNull(info.SelectiveDate); command.ExecuteNonQuery(); } } }
/// <summary> /// 更新报错信息 /// </summary> /// <param name="info">报错信息</param> public void UpdateErrorMessageInfo(SettingInfo info) { sqlStr = "UPDATE tblControl SET ErrorMessage = @ErrorMessage"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@ErrorMessage", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.ErrorMessage); command.ExecuteNonQuery(); } }
/// <summary> /// 手机用户登录更新用户信息 /// </summary> /// <param name="info">用户信息</param> public void Login4App(UserInfo info) { sqlStr = "UPDATE tblUser SET LastLoginDate = GETDATE(), RegistrationID = @RegistrationID, OSName = @OSName ,SessionID = @SessionID" + " WHERE ID = @ID"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@RegistrationID", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.RegistrationID); command.Parameters.Add("@OSName", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.OSName); command.Parameters.Add("@SessionID", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.SessionID); command.Parameters.Add("@ID", SqlDbType.Int).Value = info.ID; command.ExecuteNonQuery(); } }
/// <summary> /// 更新广播信息 /// </summary> /// <param name="info">广播信息</param> public void UpdateNotice(NoticeInfo info) { sqlStr = "UPDATE tblNotice Set Name = @Name,Content = @Content,Comments = @Comments,IsLoop=@IsLoop " + " WHERE ID = @ID"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@Name", SqlDbType.VarChar).Value = info.Name; command.Parameters.Add("@Content", SqlDbType.NVarChar).Value = info.Content; command.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Comments); command.Parameters.Add("@IsLoop", SqlDbType.Bit).Value = info.IsLoop; command.Parameters.Add("@ID", SqlDbType.Int).Value = info.ID; command.ExecuteNonQuery(); } }
/// <summary> /// 新增广播信息 /// </summary> /// <param name="info">广播信息</param> /// <returns>广播信息</returns> public NoticeInfo AddNotice(NoticeInfo info) { sqlStr += "INSERT INTO tblNotice(Name,Content,Comments,IsLoop,CreatedDate)" + "VALUES(@Name,@Content,@Comments,@IsLoop,GETDATE());" + "SELECT @@IDENTITY"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@Name", SqlDbType.VarChar).Value = info.Name; command.Parameters.Add("@Content", SqlDbType.NVarChar).Value = info.Content; command.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Comments); command.Parameters.Add("@IsLoop", SqlDbType.Bit).Value = info.IsLoop; info.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); return(info); } }
public void ImportDispatchJournal(List <EntityInfo> infos) { sqlStr = "INSERT INTO tblDispatchJournal(DispatchID,FaultCode,JobContent,ResultStatusID, " + " FollowProblem,Advice,UserName,UserMobile,Signed,StatusID) " + " VALUES(@DispatchID,@FaultCode,@JobContent,@ResultStatusID, " + " @FollowProblem,@Advice,@UserName,@UserMobile,1,@StatusID)"; using (SqlCommand command = DatabaseConnection.GetCommand(sqlStr)) { command.Parameters.Add("@DispatchID", SqlDbType.Int); command.Parameters.Add("@FaultCode", SqlDbType.NVarChar); command.Parameters.Add("@JobContent", SqlDbType.NVarChar); command.Parameters.Add("@ResultStatusID", SqlDbType.Int); command.Parameters.Add("@FollowProblem", SqlDbType.NVarChar); command.Parameters.Add("@Advice", SqlDbType.NVarChar); command.Parameters.Add("@UserName", SqlDbType.NVarChar); command.Parameters.Add("@UserMobile", SqlDbType.VarChar); command.Parameters.Add("@StatusID", SqlDbType.Int); foreach (DispatchJournalInfo info in infos) { if (info.DispatchID == 0) { return; } command.Parameters["@DispatchID"].Value = info.DispatchID; command.Parameters["@FaultCode"].Value = SQLUtil.TrimNull(info.FaultCode); command.Parameters["@JobContent"].Value = SQLUtil.TrimNull(info.JobContent); command.Parameters["@ResultStatusID"].Value = info.ResultStatus.ID; command.Parameters["@FollowProblem"].Value = SQLUtil.TrimNull(info.FollowProblem); command.Parameters["@Advice"].Value = SQLUtil.TrimNull(info.Advice); command.Parameters["@UserName"].Value = SQLUtil.EmptyStringToNull(info.UserName); command.Parameters["@UserMobile"].Value = SQLUtil.EmptyStringToNull(info.UserMobile); command.Parameters["@StatusID"].Value = info.Status.ID; command.ExecuteNonQuery(); } } }
public void ImportSupplier(List <EntityInfo> infos) { sqlStr = "INSERT INTO tblSupplier(TypeID,Name,Province,Mobile, Address,Contact,ContactMobile,AddDate,IsActive) " + " VALUES(@TypeID,@Name,@Province,@Mobile, @Address,@Contact,@ContactMobile,@AddDate,@IsActive);"; using (SqlCommand command = DatabaseConnection.GetCommand(sqlStr)) { command.Parameters.Add("@TypeID", SqlDbType.Int); command.Parameters.Add("@Name", SqlDbType.NVarChar); command.Parameters.Add("@Province", SqlDbType.NVarChar); command.Parameters.Add("@Mobile", SqlDbType.VarChar); command.Parameters.Add("@Address", SqlDbType.NVarChar); command.Parameters.Add("@Contact", SqlDbType.NVarChar); command.Parameters.Add("@ContactMobile", SqlDbType.VarChar); command.Parameters.Add("@AddDate", SqlDbType.DateTime); command.Parameters.Add("@IsActive", SqlDbType.Bit); foreach (SupplierInfo info in infos) { if (info.SupplierType.ID == 0) { return; } command.Parameters["@TypeID"].Value = SQLUtil.ConvertInt(info.SupplierType.ID); command.Parameters["@Name"].Value = SQLUtil.TrimNull(info.Name); command.Parameters["@Province"].Value = SQLUtil.TrimNull(info.Province); command.Parameters["@Mobile"].Value = SQLUtil.EmptyStringToNull(info.Mobile); command.Parameters["@Address"].Value = SQLUtil.EmptyStringToNull(info.Address); command.Parameters["@Contact"].Value = SQLUtil.TrimNull(info.Contact); command.Parameters["@ContactMobile"].Value = SQLUtil.EmptyStringToNull(info.ContactMobile); command.Parameters["@AddDate"].Value = info.AddDate == DateTime.MinValue ? DateTime.Now : info.AddDate; command.Parameters["@IsActive"].Value = info.IsActive; command.ExecuteNonQuery(); } } }
/// <summary> /// 更新供应商信息 /// </summary> /// <param name="info">供应商信息</param> public void UpdateSupplier(SupplierInfo info) { sqlStr = "UPDATE tblSupplier SET TypeID = @TypeID, Name = @Name, Province = @Province, " + " Mobile = @Mobile, Address = @Address,Contact = @Contact, ContactMobile = @ContactMobile, " + "IsActive = @IsActive "; sqlStr += "WHERE ID = @ID"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@ID", SqlDbType.Int).Value = info.ID; command.Parameters.Add("@TypeID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.SupplierType.ID); command.Parameters.Add("@Name", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Name); command.Parameters.Add("@Province", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Province); command.Parameters.Add("@Mobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Mobile); command.Parameters.Add("@Address", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Address); command.Parameters.Add("@Contact ", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Contact); command.Parameters.Add("@ContactMobile ", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.ContactMobile); command.Parameters.Add("@IsActive", SqlDbType.Bit).Value = info.IsActive; command.ExecuteNonQuery(); } }
/// <summary> /// 新增供应商 /// </summary> /// <param name="info">供应商信息</param> /// <returns>供应商ID</returns> public int AddSupplier(SupplierInfo info) { sqlStr = "INSERT INTO tblSupplier(TypeID,Name,Province,Mobile, " + " Address,Contact,ContactMobile,AddDate,IsActive) " + " VALUES(@TypeID,@Name,@Province,@Mobile, " + " @Address,@Contact,@ContactMobile,GETDATE(),@IsActive);" + " SELECT @@IDENTITY"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@TypeID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.SupplierType.ID); command.Parameters.Add("@Name", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Name); command.Parameters.Add("@Province", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Province); command.Parameters.Add("@Mobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Mobile); command.Parameters.Add("@Address", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.Address); command.Parameters.Add("@Contact ", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Contact); command.Parameters.Add("@ContactMobile ", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.ContactMobile); command.Parameters.Add("@IsActive", SqlDbType.Bit).Value = info.IsActive; info.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); return(info.ID); } }
/// <summary> /// 新增请求 /// </summary> /// <param name="info">请求信息</param> /// <returns>请求ID</returns> public int AddRequest(RequestInfo info) { sqlStr = "INSERT INTO tblRequest(Source,RequestType,RequestUserID,RequestUserName,RequestUserMobile," + " Subject,EquipmentStatus,FaultTypeID,FaultDesc,StatusID,DealTypeID,PriorityID,RequestDate,LastStatusID,IsRecall) " + " VALUES(@Source,@RequestType,@RequestUserID,@RequestUserName,@RequestUserMobile," + " @Subject,@EquipmentStatus,@FaultTypeID,@FaultDesc,@StatusID,@DealTypeID,@PriorityID,@RequestDate,@LastStatusID,@IsRecall); " + " SELECT @@IDENTITY"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@Source", SqlDbType.Int).Value = info.Source.ID; command.Parameters.Add("@RequestType", SqlDbType.Int).Value = info.RequestType.ID; command.Parameters.Add("@RequestUserID", SqlDbType.Int).Value = SQLUtil.ZeroToNull(info.RequestUser.ID); command.Parameters.Add("@RequestUserName", SqlDbType.NVarChar).Value = SQLUtil.EmptyStringToNull(info.RequestUser.Name); command.Parameters.Add("@RequestUserMobile", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.RequestUser.Mobile); command.Parameters.Add("@EquipmentStatus", SqlDbType.Int).Value = info.MachineStatus.ID; command.Parameters.Add("@Subject", SqlDbType.NVarChar).Value = info.EquipmentName + '-' + info.RequestType.Name; command.Parameters.Add("@FaultTypeID", SqlDbType.Int).Value = SQLUtil.ZeroToNull(info.FaultType.ID); command.Parameters.Add("@FaultDesc", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.FaultDesc); command.Parameters.Add("@StatusID", SqlDbType.Int).Value = info.Status.ID; command.Parameters.Add("@DealTypeID", SqlDbType.Int).Value = info.DealType.ID; command.Parameters.Add("@PriorityID", SqlDbType.Int).Value = info.Priority.ID; command.Parameters.Add("@RequestDate", SqlDbType.DateTime).Value = info.RequestDate == DateTime.MinValue ? DateTime.Now : info.RequestDate; command.Parameters.Add("@LastStatusID", SqlDbType.Int).Value = info.LastStatus.ID; command.Parameters.Add("@IsRecall", SqlDbType.Bit).Value = info.IsRecall; info.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); } return(info.ID); }
/// <summary> /// 更新邮件、短信信息 /// </summary> /// <param name="info">邮件、短信信息</param> public void UpdateSmtpInfo(SmtpInfo info) { sqlStr = "UPDATE tblControl SET AdminEmail = @AdminEmail, SmtpHost = @SmtpHost, SmtpPort = @SmtpPort, SmtpUseSsl = @SmtpUseSsl," + " SmtpUserName = @SmtpUserName, SmtpPwd = @SmtpPwd, SmtpEmailFrom = @SmtpEmailFrom, MessageEnabled = @MessageEnabled, MessageKey = @MessageKey,AppValidVersion = @AppValidVersion,MobilePhone=@MobilePhone "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@AdminEmail", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.AdminEmail); command.Parameters.Add("@SmtpHost", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Host); command.Parameters.Add("@SmtpPort", SqlDbType.Int).Value = info.Port; command.Parameters.Add("@SmtpUseSsl", SqlDbType.Bit).Value = info.UseSsl; command.Parameters.Add("@SmtpUserName", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.UserName); command.Parameters.Add("@SmtpPwd", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.Pwd); command.Parameters.Add("@SmtpEmailFrom", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.EmailFrom); command.Parameters.Add("@MessageKey", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.MessageKey); command.Parameters.Add("@MessageEnabled", SqlDbType.Bit).Value = info.MessageEnabled; command.Parameters.Add("@AppValidVersion", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.AppValidVersion); command.Parameters.Add("@MobilePhone", SqlDbType.VarChar).Value = SQLUtil.EmptyStringToNull(info.MobilePhone); command.ExecuteNonQuery(); } }