/// <summary> /// 添加零件 /// </summary> /// <param name="info">零件信息</param> /// <returns>零件id</returns> public int AddComponent(InvComponentInfo info) { sqlStr = "INSERT INTO tblInvComponent(ComponentID,EquipmentID,SerialCode,Specification,Model,SupplierID,Price,PurchaseDate,PurchaseID,Comments,StatusID,AddDate) " + " VALUES(@ComponentID,@EquipmentID,@SerialCode,@Specification,@Model,@SupplierID,@Price,@PurchaseDate,@PurchaseID,@Comments,@StatusID,GetDate()); " + " SELECT @@IDENTITY "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@ComponentID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Component.ID); command.Parameters.Add("@EquipmentID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Equipment.ID); command.Parameters.Add("@SerialCode", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.SerialCode); command.Parameters.Add("@Specification", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Specification); command.Parameters.Add("@Model", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Model); command.Parameters.Add("@SupplierID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Supplier.ID); command.Parameters.Add("@Price", SqlDbType.Decimal).Value = info.Price; command.Parameters.Add("@PurchaseDate", SqlDbType.DateTime).Value = SQLUtil.ConvertDateTime(info.PurchaseDate); command.Parameters.Add("@PurchaseID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Purchase.ID); command.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Comments); command.Parameters.Add("@StatusID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Status.ID); info.ID = SQLUtil.ConvertInt(command.ExecuteScalar()); return(info.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> /// 设备成本info /// </summary> /// <param name="dr">dr</param> public ValEqptOutputInfo(DataRow dr) : this() { if (dr.Table.Columns.Contains("UserID")) { this.User.ID = SQLUtil.ConvertInt(dr["UserID"]); } if (dr.Table.Columns.Contains("UserName")) { this.User.Name = SQLUtil.TrimNull(dr["UserName"]); } if (dr.Table.Columns.Contains("EquipmentID")) { this.Equipment.ID = SQLUtil.ConvertInt(dr["EquipmentID"]); } this.Year = SQLUtil.ConvertInt(dr["Year"]); this.Month = SQLUtil.ConvertInt(dr["Month"]); if (dr.Table.Columns.Contains("ContractAmount")) { this.ContractAmount = SQLUtil.ConvertDouble(dr["ContractAmount"]); } if (dr.Table.Columns.Contains("Repair3partyCost")) { this.Repair3partyCost = SQLUtil.ConvertDouble(dr["Repair3partyCost"]); } }
/// <summary> /// 根据请求类型获取当月校准、保养、巡检 占比 KPI /// </summary> /// <param name="requestType">请求类型</param> /// <param name="today">目标日期</param> /// <returns>当月校准、保养、巡检 占比 KPI</returns> public Tuple <int, int> GetRequestPlanActual(int requestType, DateTime today) { sqlStr = " SELECT COUNT(ID) AS Plans, SUM(CASE WHEN StatusID = @StatusClose THEN 1 ELSE 0 END) AS Actuals " + " FROM tblRequest " + " WHERE DATEPART(YEAR, RequestDate) = @Year And DATEPART(MONTH, RequestDate) = @Month " + " AND RequestType = @RequestType AND Source=@Source "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@StatusClose", SqlDbType.Int).Value = RequestInfo.Statuses.Close; command.Parameters.Add("@Year", SqlDbType.Int).Value = today.Year; command.Parameters.Add("@Month", SqlDbType.Int).Value = today.Month; command.Parameters.Add("@RequestType", SqlDbType.Int).Value = requestType; command.Parameters.Add("@Source", SqlDbType.Int).Value = RequestInfo.Sources.SysRequest; DataRow dr = GetDataRow(command); if (dr != null) { return(new Tuple <int, int>(SQLUtil.ConvertInt(dr["Plans"]), SQLUtil.ConvertInt(dr["Actuals"]))); } else { return(new Tuple <int, int>(0, 0)); } } }
/// <summary> /// 获取作业报告信息 /// </summary> /// <param name="dr">The dr.</param> public DispatchReportInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.Dispatch.ID = SQLUtil.ConvertInt(dr["DispatchID"]); this.Type.ID = SQLUtil.ConvertInt(dr["TypeID"]); this.Type = LookupManager.GetDispatchReportType(this.Type.ID); this.FaultCode = SQLUtil.TrimNull(dr["FaultCode"]); this.FaultDesc = SQLUtil.TrimNull(dr["FaultDesc"]); this.SolutionCauseAnalysis = SQLUtil.TrimNull(dr["SolutionCauseAnalysis"]); this.SolutionWay = SQLUtil.TrimNull(dr["SolutionWay"]); this.IsPrivate = SQLUtil.ConvertBoolean(dr["IsPrivate"]); this.ServiceProvider.ID = SQLUtil.ConvertInt(dr["ServiceProvider"]); this.ServiceProvider.Name = ServiceProviders.GetDescByID(this.ServiceProvider.ID); this.SolutionResultStatus.ID = SQLUtil.ConvertInt(dr["SolutionResultStatusID"]); this.SolutionResultStatus.Name = LookupManager.GetSolutionResultStatusDesc(this.SolutionResultStatus.ID); this.SolutionUnsolvedComments = SQLUtil.TrimNull(dr["SolutionUnsolvedComments"]); this.DelayReason = SQLUtil.TrimNull(dr["DelayReason"]); this.Comments = SQLUtil.TrimNull(dr["Comments"]); this.FujiComments = SQLUtil.TrimNull(dr["FujiComments"]); this.Status.ID = SQLUtil.ConvertInt(dr["StatusID"]); this.Status.Name = LookupManager.GetDispatchDocStatusDesc(this.Status.ID); this.PurchaseAmount = SQLUtil.ConvertDouble(dr["PurchaseAmount"]); this.ServiceScope = SQLUtil.ConvertBoolean(dr["ServiceScope"]); this.ServiceScope = SQLUtil.ConvertBoolean(dr["ServiceScope"]); this.Result = SQLUtil.TrimNull(dr["Result"]); this.IsRecall = SQLUtil.ConvertBoolean(dr["IsRecall"]); this.AcceptanceDate = SQLUtil.ConvertDateTime(dr["AcceptanceDate"]); this.EquipmentStatus.ID = SQLUtil.ConvertInt(dr["EquipmentStatus"]); this.EquipmentStatus.Name = MachineStatuses.GetMachineStatusesDesc(this.EquipmentStatus.ID); }
/// <summary> /// 获取自定义报表表信息 /// </summary> /// <param name="dr">The dr.</param> public CustRptTemplateTableInfo(DataRow dr) : this() { this.TypeID = SQLUtil.ConvertInt(dr["TypeID"]); this.TableName = SQLUtil.TrimNull(dr["TableName"]); this.TableDesc = SQLUtil.TrimNull(dr["TableDesc"]); }
/// <summary> /// 获取派工单报表的部分字段描述信息 /// </summary> /// <param name="dr">报表所有字段信息</param> /// <param name="fieldsInRpt">选取的报表字段</param> /// <returns>报表信息</returns> public DataRow GetDispatchDesc(DataRow dr, List <string> fieldsInRpt) { if (SQLUtil.ConvertInt(dr["DisID"]) != 0) { if (fieldsInRpt.Contains("DispatchTypeDesc")) { dr["DispatchTypeDesc"] = LookupManager.GetRequestTypeDesc(SQLUtil.ConvertInt(dr["DispatchRequestType"])); } if (fieldsInRpt.Contains("UrgencyDesc")) { dr["UrgencyDesc"] = LookupManager.GetUrgencyDesc(SQLUtil.ConvertInt(dr["UrgencyID"])); } if (fieldsInRpt.Contains("MachineStatusDesc")) { dr["MachineStatusDesc"] = MachineStatuses.GetMachineStatusesDesc(SQLUtil.ConvertInt(dr["EquipmentStatus"])); } if (fieldsInRpt.Contains("EngineerName")) { dr["EngineerName"] = (SQLUtil.ConvertInt(dr["EngineerID"]) == 0) ? "" : (this.userDao.GetUser(SQLUtil.ConvertInt(dr["EngineerID"])) == null ? "" : this.userDao.GetUser(SQLUtil.ConvertInt(dr["EngineerID"])).Name); } if (fieldsInRpt.Contains("DispatchStatusDesc")) { dr["DispatchStatusDesc"] = LookupManager.GetDispatchStatusDesc(SQLUtil.ConvertInt(dr["DispatchStatusID"])); } } return(dr); }
/// <summary> /// 获取自定义报表字段内容 /// </summary> /// <param name="dr">The dr.</param> public CustRptFieldInfo(DataRow dr) : this() { this.CustomReportID = SQLUtil.ConvertInt(dr["CustomReportID"]); this.TableName = SQLUtil.TrimNull(dr["TableName"]); this.FieldName = SQLUtil.TrimNull(dr["FieldName"]); }
/// <summary> /// 获取合同及关联的设备信息 /// </summary> /// <param name="contractIDs">合同ID</param> /// <returns>合同及关联的设备信息</returns> public List <ContractEqptInfo> GetContractEqpts(List <int> contractIDs) { List <ContractEqptInfo> infos = new List <ContractEqptInfo>(); sqlStr = "SELECT e.ID ,e.Name ,e.DepartmentID ,e.SerialCode , j.ContractID FROM jctContractEqpt j " + " INNER JOIN tblEquipment AS e ON e.ID = j.EquipmentID" + " WHERE j.ContractID in (" + (string.IsNullOrEmpty(SQLUtil.ConvertToInStr(contractIDs)) ? "null" : SQLUtil.ConvertToInStr(contractIDs)) + ") "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { using (DataTable dt = GetDataTable(command)) { ContractEqptInfo info = null; foreach (DataRow dr in dt.Rows) { info = new ContractEqptInfo(); info.ContractID = SQLUtil.ConvertInt(dr["ContractID"]); info.Equipment.ID = SQLUtil.ConvertInt(dr["ID"]); info.Equipment.Name = SQLUtil.TrimNull(dr["Name"]); info.Equipment.SerialCode = SQLUtil.TrimNull(dr["SerialCode"]); info.Equipment.Department.ID = SQLUtil.ConvertInt(dr["DepartmentID"]); info.Equipment.Department.Name = Manager.LookupManager.GetDepartmentDesc(info.Equipment.Department.ID); infos.Add(info); } } } return(infos); }
/// <summary> /// 修改零件信息 /// </summary> /// <param name="info">零件信息</param> /// <returns>零件id</returns> public int UpdateComponent(InvComponentInfo info) { sqlStr = "UPDATE tblInvComponent Set ComponentID=@ComponentID,EquipmentID=@EquipmentID,SerialCode=@SerialCode,Specification=@Specification, " + " Model=@Model,SupplierID=@SupplierID,Price=@Price,PurchaseDate=@PurchaseDate," + " PurchaseID=@PurchaseID,Comments=@Comments,StatusID=@StatusID,UpdateDate=GetDate() " + " WHERE ID = @ID"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@ID", SqlDbType.Int).Value = info.ID; command.Parameters.Add("@ComponentID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Component.ID); command.Parameters.Add("@EquipmentID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Equipment.ID); command.Parameters.Add("@SerialCode", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.SerialCode); command.Parameters.Add("@Specification", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Specification); command.Parameters.Add("@Model", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Model); command.Parameters.Add("@SupplierID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Supplier.ID); command.Parameters.Add("@Price", SqlDbType.Decimal).Value = info.Price; command.Parameters.Add("@PurchaseDate", SqlDbType.DateTime).Value = SQLUtil.ConvertDateTime(info.PurchaseDate); command.Parameters.Add("@PurchaseID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Purchase.ID); command.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = SQLUtil.TrimNull(info.Comments); command.Parameters.Add("@StatusID", SqlDbType.Int).Value = SQLUtil.ConvertInt(info.Status.ID); command.ExecuteNonQuery(); 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="dr">The dr.</param> public EquipmentClassInfo(DataRow dr) : this() { this.Level = SQLUtil.ConvertInt(dr["Level"]); this.ParentCode = SQLUtil.TrimNull(dr["ParentCode"]); this.Code = SQLUtil.TrimNull(dr["Code"]); this.Description = SQLUtil.TrimNull(dr["Description"]); }
/// <summary> /// 获取验证信息 /// </summary> /// <param name="dr">The dr.</param> public VerificationCodeInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.MobilePhone = SQLUtil.TrimNull(dr["MobilePhone"]); this.VerificationCode = SQLUtil.TrimNull(dr["VerificationCode"]); this.CreatedTime = SQLUtil.ConvertDateTime(dr["CreatedTime"]); }
/// <summary> /// 各部门设备信息(包括收入、支出、服务人次) /// </summary> /// <returns>各部门设备信息</returns> public List <DepartPerformanceModel> IncomeExpenseByDepartment(string date) { List <DepartPerformanceModel> models = new List <DepartPerformanceModel>(); DepartPerformanceModel model = null; int curYear = DateTime.Today.Year; if (!string.IsNullOrEmpty(date)) { curYear = Convert.ToDateTime(date).Year; } if (WebConfig.ISDEMO) { curYear = new DateTime(2019, 11, 12).Year; } int lastYear = curYear - 1; DataTable dtEquipmentCount = this.equipmentDao.GetEquipmentInfoCountsByDepartment(); List <ServiceHisCountInfo> serviceInfosThisYear = this.serviceHisDao.GetServiceHisCountsByDepartment(curYear); List <ServiceHisCountInfo> accessoryExpensesThisYear = this.serviceHisDao.GetAccessoryExpenseByDepartment(curYear); List <ServiceHisCountInfo> serviceInfosLastYear = this.serviceHisDao.GetServiceHisCountsByDepartment(lastYear); List <ServiceHisCountInfo> accessoryExpensesLastYear = this.serviceHisDao.GetAccessoryExpenseByDepartment(lastYear); ServiceHisCountInfo serviceInfo = null; foreach (DataRow dr in dtEquipmentCount.Rows) { model = new DepartPerformanceModel(); model.Department = LookupManager.GetDepartments(SQLUtil.ConvertInt(dr["DepartmentID"])); model.EquipmentCount = SQLUtil.ConvertInt(dr["Counts"]); model.EquipmentAmount = SQLUtil.ConvertDouble(dr["Amounts"]); serviceInfo = (from ServiceHisCountInfo temp in serviceInfosThisYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault(); if (serviceInfo != null) { model.ServiceCount = serviceInfo.ServiceCount; model.Incomes = serviceInfo.Incomes; } serviceInfo = (from ServiceHisCountInfo temp in accessoryExpensesThisYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault(); if (serviceInfo != null) { model.Expenses = serviceInfo.Expenses; } serviceInfo = (from ServiceHisCountInfo temp in serviceInfosLastYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault(); if (serviceInfo != null) { model.LastIncomes = serviceInfo.Incomes; } serviceInfo = (from ServiceHisCountInfo temp in accessoryExpensesLastYear where temp.ObjectID == model.Department.ID select temp).FirstOrDefault(); if (serviceInfo != null) { model.LastExpenses = serviceInfo.Expenses; } models.Add(model); } return(models); }
public int GetMaxDispatchReportID() { sqlStr = "SELECT Max(ID) FROM tblDispatchReport"; using (SqlCommand command = DatabaseConnection.GetCommand(sqlStr)) { return(SQLUtil.ConvertInt(command.ExecuteScalar())); } }
/// <summary> /// 故障率Info /// </summary> /// <param name="dr">dr</param> public FaultRateInfo(DataRow dr) : this() { this.ObjectTypeID = SQLUtil.ConvertEnum <ObjectType>(dr["ObjectTypeID"]); this.ObjectID = SQLUtil.ConvertInt(dr["ObjectID"]); this.Year = SQLUtil.ConvertInt(dr["Year"]); this.Month = SQLUtil.ConvertEnum <DateTimeMonth>(dr["Month"]); this.Rate = SQLUtil.ConvertDouble(dr["Rate"]); }
/// <summary> /// 获取日志信息 /// </summary> /// <param name="dr">The dr.</param> public AuditDetailInfo(DataRow dr) : this() { this.AuditID = SQLUtil.ConvertInt(dr["AuditID"]); this.FieldName = SQLUtil.TrimNull(dr["FieldName"]); this.FieldNameDesc = SQLUtil.TrimNull(dr["FieldNameDesc"]); this.OldValue = SQLUtil.TrimNull(dr["OldValue"]); this.NewValue = SQLUtil.TrimNull(dr["NewValue"]); }
/// <summary> /// 获取对象类型 /// </summary> /// <param name="dr">The dr.</param> public ObjectTypeInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.TableKey = SQLUtil.TrimNull(dr["TableKey"]); this.Prefix = SQLUtil.TrimNull(dr["Prefix"]); this.LeadingZeros = SQLUtil.ConvertInt(dr["LeadingZeros"]); this.Description = SQLUtil.TrimNull(dr["Description"]); }
public ReportServiceInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.DispatchReportID = SQLUtil.ConvertInt(dr["DispatchReportID"]); this.Service.ID = SQLUtil.ConvertInt(dr["ServiceID"]); this.Service.Name = SQLUtil.TrimNull(dr["Name"]); this.Service.Supplier.Name = SQLUtil.TrimNull(dr["SupplierName"]); this.Service.Price = SQLUtil.ConvertDouble(dr["Price"]); }
/// <summary> /// 获取广播信息 /// </summary> /// <param name="dr">The dr.</param> public NoticeInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.Name = SQLUtil.TrimNull(dr["Name"]); this.Content = SQLUtil.TrimNull(dr["Content"]); this.Comments = SQLUtil.TrimNull(dr["Comments"]); this.IsLoop = SQLUtil.ConvertBoolean(dr["IsLoop"]); this.CreatedDate = SQLUtil.ConvertDateTime(dr["CreatedDate"]); }
/// <summary> /// 获取科室信息 /// </summary> /// <param name="dr">The dr.</param> public DepartmentInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.Seq = SQLUtil.ConvertInt(dr["Seq"]); this.Description = SQLUtil.TrimNull(dr["Description"]); this.Pinyin = SQLUtil.TrimNull(dr["Pinyin"]); this.DepartmentType.ID = SQLUtil.ConvertInt(dr["TypeID"]); this.DepartmentType.Name = Manager.LookupManager.GetDepartmentTypeDesc(this.DepartmentType.ID); }
public UserInfo(DataRow dr) : this() { this.ID = SQLUtil.ConvertInt(dr["ID"]); this.IsAdmin = SQLUtil.ConvertBoolean(dr["IsAdmin"]); this.LoginID = SQLUtil.TrimNull(dr["LoginID"]); this.LoginPwd = SQLUtil.TrimNull(dr["LoginPwd"]); this.Name = SQLUtil.TrimNull(dr["Name"]); this.Email = SQLUtil.TrimNull(dr["Email"]); this.CreatedDate = SQLUtil.ConvertDateTime(dr["CreatedDate"]); }
/// <summary> /// 估价执行条件:备用机清单Info /// </summary> /// <param name="dr">数据</param> public ValSpareInfo(DataRow dr) : this() { this.User.ID = SQLUtil.ConvertInt(dr["UserID"]); this.User.Name = SQLUtil.TrimNull(dr["UserName"]); this.FujiClass2.ID = SQLUtil.ConvertInt(dr["FujiClass2ID"]); this.FujiClass2.Name = SQLUtil.TrimNull(dr["FujiClass2Name"]); this.Price = SQLUtil.ConvertDouble(dr["Price"]); this.QtyEnter = SQLUtil.ConvertInt(dr["QtyEnter"]); this.QtyEval = SQLUtil.ConvertInt(dr["QtyEval"]); }
public void SaveFujiClass2s(List <FujiClass2Info> infos, FujiClass2Info.SectionType type, UserInfo userInfo) { List <FujiClass2Info> existsInfos = this.QueryFujiClass2sByIDs(infos.Select(info => info.ID).ToList()); DataTable dt = FujiClass2Info.ConvertFujiClass2DataTable(infos); switch (type) { case FujiClass2Info.SectionType.Labour: this.fujiClassDao.UpdateFujiClass2Labour(dt); break; case FujiClass2Info.SectionType.Contract: this.fujiClassDao.UpdateFujiClass2Contract(dt); break; case FujiClass2Info.SectionType.Spare: this.fujiClassDao.UpdateFujiClass2Spare(dt); break; case FujiClass2Info.SectionType.Repair: this.fujiClassDao.UpdateFujiClass2Repair(dt); this.UpdateFaultRates(infos.SelectMany(info => info.Repairs).ToList()); break; } //转换日志信息 infos.Sort(); existsInfos.Sort(); List <AuditHdrInfo> audits = new List <AuditHdrInfo>(); int len = existsInfos.Count; for (int i = 0; i < len; i++) { AuditHdrInfo audit = existsInfos[i].ConvertAudit(infos[i], userInfo); audit.DetailInfo = audit.DetailInfo.Concat(FaultRateInfo.ConvertAuditDetail(existsInfos[i].Repairs, infos[i].Repairs)).ToList(); audits.Add(audit); } DataTable auditDT = audits.ConvertAuditDT(); DataTable auditDetailDT = null; this.auditDao.AddAuditHdr(auditDT); for (int i = 0; i < len; i++) { if (auditDetailDT == null) { auditDetailDT = audits[i].DetailInfo.ConvertAuditDetailDT(SQLUtil.ConvertInt(auditDT.Rows[i]["ID"])); } else { auditDetailDT.Merge(audits[i].DetailInfo.ConvertAuditDetailDT(SQLUtil.ConvertInt(auditDT.Rows[i]["ID"]))); } } this.auditDao.AddAuditDetail(auditDetailDT); }
/// <summary> /// 判断用户名是否存在 /// </summary> /// <param name="id">用户编号</param> /// <param name="loginId">用户名</param> /// <returns>用户名是否存在</returns> public bool CheckUserLoginID(int id, string loginId) { sqlStr = "SELECT COUNT(ID) FROM tblUser WHERE ID <> @ID AND UPPER(LoginID) = @LoginID "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@LoginID", SqlDbType.VarChar).Value = loginId.ToUpper(); command.Parameters.Add("@ID", SqlDbType.Int).Value = id; return(SQLUtil.ConvertInt(command.ExecuteScalar()) > 0); } }
public ReportAccessoryInfo(DataRow dr) : this() { this.DispatchReportID = SQLUtil.ConvertInt(dr["ServiceReportID"]); this.Name = SQLUtil.TrimNull(dr["Name"]); this.Source.ID = SQLUtil.ConvertInt(dr["Category"]); this.SupplierID = SQLUtil.ConvertInt(dr["SupplierID"]); this.NewSerialCode = SQLUtil.TrimNull(dr["New No#"]); this.OldSerialCode = SQLUtil.TrimNull(dr["Detach No#"]); this.Qty = SQLUtil.ConvertInt(dr["Quantity"]); this.Amount = SQLUtil.ConvertDouble(dr["NewPrice"]); }
/// <summary> /// 判断零件序列号是否重复 /// </summary> /// <param name="id">零件id</param> /// <param name="serialCode">零件名称</param> /// <returns>是否重复</returns> public bool CheckComponentSerialCode(int id, string serialCode) { sqlStr = "SELECT COUNT(ID) FROM tblInvComponent WHERE ID <> @ID AND UPPER(SerialCode) = UPPER(@SerialCode)"; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@ID", SqlDbType.Int).Value = id; command.Parameters.Add("@SerialCode", SqlDbType.NVarChar).Value = serialCode; return(SQLUtil.ConvertInt(command.ExecuteScalar()) > 0); } }
/// <summary> /// 检测资产编号是否已存在 /// </summary> /// <param name="id">设备</param> /// <param name="assetCode">资产编号</param> /// <returns>资产编号是否已存在</returns> public bool CheckAssetCode(int id, string assetCode) { sqlStr = "SELECT COUNT(ID) FROM tblEquipment WHERE ID <> @ID AND UPPER(AssetCode) = @AssetCode "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@AssetCode", SqlDbType.VarChar).Value = assetCode.ToUpper(); command.Parameters.Add("@ID", SqlDbType.Int).Value = id; return(SQLUtil.ConvertInt(command.ExecuteScalar()) > 0); } }
/// <summary> /// 判断科室名称是否存在 /// </summary> /// <param name="id">科室编号</param> /// <param name="departmentName">科室名称</param> /// <returns>科室名称是否存在</returns> public bool CheckDepartmentName(int id, string departmentName) { sqlStr = "SELECT COUNT(ID) FROM lkpDepartment WHERE ID <> @ID AND UPPER(Description) = @Description "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@Description", SqlDbType.VarChar).Value = departmentName.ToUpper(); command.Parameters.Add("@ID", SqlDbType.Int).Value = id; return(SQLUtil.ConvertInt(command.ExecuteScalar()) > 0); } }
/// <summary> /// 获取未报废的设备总数量、采购金额总数 /// </summary> /// <returns>设备总数量、采购金额总数</returns> public Tuple <int, double> GetEquipmentInfoCounts() { sqlStr = "SELECT Count(ID) AS Counts,SUM(PurchaseAmount) AS Amounts FROM tblEquipment WHERE EquipmentStatusID <> @EquipmentStatusID "; using (SqlCommand command = ConnectionUtil.GetCommand(sqlStr)) { command.Parameters.Add("@EquipmentStatusID", SqlDbType.NVarChar).Value = EquipmentInfo.EquipmentStatuses.Scrap; DataRow dr = GetDataRow(command); return(new Tuple <int, double>(SQLUtil.ConvertInt(dr["Counts"]), SQLUtil.ConvertDouble(dr["Amounts"]))); } }