using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading; using System.ServiceModel; using System.Data.SqlClient; using System.Data; namespace CY_DocumentSynchroWCFService { [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)] public class DocumentSynchroService : IDocumentSynchroService { Database db = null; public DocumentSynchroService() { db = new Database(); } public Document_ProjectInfo GetDocument_ProjectInfo(int projectId) { Document_ProjectInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectInfo "; string condition = " ProjectId=" + projectId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool IsExistProject(string projectName, string projectCode) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_ProjectInfo where ProjectName='{0}' and ProjectCode='{1}' "; sqlStr = string.Format(sqlStr, projectName, projectCode); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } public Document_ProjectExpand GetProjectExpand(int projectId, int unitId) { Document_ProjectExpand model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectExpand "; string condition = " ProjectId=" + projectId + " and UnitId=" + unitId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public IList GetProjectList(ref Pagination pagination, string Province, string City, string County, string ddlSignupStartTime, string ddlSignupEndTime, string ddlTenderStartTime, string ddlTenderEndTime, int ddlPurchaseMethod, int ddlNoticeType, string txtProjectName, string txtProjectCode, string txtPurchaseUnit, string txtAgencyUnit, string txtTenderPerson, string txtCompanyName, int ddlAdvise, int ddlSignUp, int ddlTenderDeposit, int ddlBidbond, int ddlDocumentStatus, int ddlTenderStatus, int ddlWinStatus, int ddlOppugnStatus, int ddlComplainStatus, int ddlReviewStatus, int ddlLitigationStatus, int unitId,string Experts) { IList list = new List(); string rowOrderStr = string.Empty; string resultOrderStr = " ProjectId desc "; string selectTarget = @" a.ProjectId, (case when a.NoticeType=1 then '' else a.SignupStartTime end) as SignupStartTime, (case when a.City='请选择' and a.County='请选择' then a.Province when a.County='请选择' or a.County='其他' then a.City else a.City+a.County ENd) as xmqy, b.Name as NoticeTypeName,c.Name as PurchaseMethodName,a.ProjectName,a.PurchaseUnit,a.AgencyUnit, (case when a.NoticeType=1 then '' else a.TenderTime end) as TenderTime, d.TenderPerson as TenderPerson, (case when d.IsSignup=1 then '√' else '报名' end) as bm, (case when d.TenderDepositStatus=0 or d.projectId is null or d.TenderDepositStatus is null then '缴费' when d.TenderDepositStatus=13 then '退款' else '√' end) as bzj, (case when d.BidbondStatus=0 or d.projectId is null or d.BidbondStatus is null then '缴费' when d.BidbondStatus=33 then '退款' else '√' end) as lybzj, (case when d.TenderStatus=1 then '√' else '投标' end) as tb, (case when n.IsWin=-1 or d.projectId is null or n.IsWin is null then '中标' when n.IsWin=2 then '×' else '√' end) as zb, (case when i.IsAdvise=1 then '√' else '' end) as Advise, (case when k.FilePath<>'' then '√' else '' end) as zy, (case when j.FilePath<>'' then '√' else '' end) as ts, (case when m.FilePath<>'' then '√' else '' end) as fy, (case when l.FilePath<>'' then '√' else '' end) as ss, '' as wj,'投标情况' as tbqk "; string fromSouce = " (((((((Document_ProjectInfo a inner join Document_Dictionary b on a.NoticeType=b.Id) left join Document_Dictionary c on a.PurchaseMethod=c.Id) left join Document_ProjectExpand d on a.projectId=d.projectId and d.unitId='" + unitId + "') left join Document_ProjectOppugnInfo e on a.projectId=e.projectId and e.unitId='" + unitId + "') left join Document_ProjectComplainInfo f on a.projectId=f.projectId and f.unitId='" + unitId + "') left join Document_ProjectReviewInfo g on a.projectId=g.projectId and g.unitId='" + unitId + "') left join Document_ProjectLitigationInfo h on a.projectId=h.projectId and h.unitId='" + unitId + "') LEFT JOIN dbo.Document_AdviseInfo AS i ON a.ProjectId = i.ProjectId and i.unitId='" + unitId + "' LEFT JOIN dbo.Document_ProjectComplainInfo AS j ON a.ProjectId = j.ProjectId and j.unitId='" + unitId + "' LEFT JOIN dbo.Document_ProjectOppugnInfo AS k ON a.ProjectId = k.ProjectId and k.unitId='" + unitId + "' LEFT JOIN dbo.Document_ProjectLitigationInfo AS l ON a.ProjectId = l.ProjectId and l.unitId='" + unitId + "' LEFT JOIN dbo.Document_ProjectReviewInfo AS m ON a.ProjectId = m.ProjectId and m.unitId='" + unitId + "' LEFT JOIN dbo.Document_WinInfo AS n ON a.ProjectId = n.ProjectId where 1=1 "; //省 if (!string.IsNullOrEmpty(Province) && Province != "请选择") fromSouce += string.Format(" and a.Province='{0}'", Province); //市 if (!string.IsNullOrEmpty(City) && City != "请选择") fromSouce += string.Format(" and a.City='{0}'", City); //区县 if (!string.IsNullOrEmpty(County) && County != "请选择") fromSouce += string.Format(" and a.County='{0}'", County); //报名时间 if (!string.IsNullOrEmpty(ddlSignupStartTime)) { string Time_String = string.IsNullOrEmpty(ddlSignupStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlSignupStartTime)).Substring(0, 10); fromSouce += string.Format(" and a.SignupStartTime >='{0}'", Time_String); } //报名时间 if (!string.IsNullOrEmpty(ddlSignupEndTime)) { string Time_String = string.IsNullOrEmpty(ddlSignupEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlSignupEndTime)).Substring(0, 10); fromSouce += string.Format(" and a.SignupEndTime <='{0}'", Time_String); } //开标时间 if (!string.IsNullOrEmpty(ddlTenderStartTime)) { string Time_String = string.IsNullOrEmpty(ddlTenderStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlTenderStartTime)).Substring(0, 10); fromSouce += string.Format(" and a.TenderTime >='{0}'", Time_String); } //开标时间 if (!string.IsNullOrEmpty(ddlTenderEndTime)) { string Time_String = string.IsNullOrEmpty(ddlTenderEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlTenderEndTime).AddDays(1)).Substring(0, 10); fromSouce += string.Format(" and a.TenderTime <='{0}'", Time_String); } //采购方式 if (ddlPurchaseMethod > 0) fromSouce += string.Format(" and a.PurchaseMethod={0}", ddlPurchaseMethod); //公告类型 if (ddlNoticeType > 0) fromSouce += string.Format(" and a.NoticeType={0}", ddlNoticeType); //项目名称 if (!string.IsNullOrEmpty(txtProjectName)) fromSouce += string.Format(" and a.ProjectName like '%{0}%'", txtProjectName); //项目编号 if (!string.IsNullOrEmpty(txtProjectCode)) fromSouce += string.Format(" and a.ProjectCode like '%{0}%'", txtProjectCode); //采购单位 if (!string.IsNullOrEmpty(txtPurchaseUnit)) fromSouce += string.Format(" and a.PurchaseUnit like '%{0}%'", txtPurchaseUnit); //代理机构 if (!string.IsNullOrEmpty(txtAgencyUnit)) fromSouce += string.Format(" and a.AgencyUnit like '%{0}%'", txtAgencyUnit); //投标人 if (!string.IsNullOrEmpty(txtTenderPerson)) fromSouce += string.Format(" and d.TenderPerson like '%{0}%'", txtTenderPerson); if(!string.IsNullOrEmpty(Experts)) fromSouce += string.Format(" and d.Experts like '%{0}%'", Experts); //建议状态 if (ddlAdvise > 0) { if (ddlAdvise == 1) fromSouce += string.Format(" and (i.IsAdvise=2 or i.projectId is null) "); else fromSouce += string.Format(" and i.IsAdvise = 1 "); } //报名状态 if (ddlSignUp > 0) { if (ddlSignUp == 1) fromSouce += string.Format(" and (d.IsSignup=0 or d.projectId is null) "); else fromSouce += string.Format(" and d.IsSignup = 1 "); } ////保证金状态 //if (ddlTenderDeposit > 0) //{ // if (ddlTenderDeposit == 12) // fromSouce += string.Format(" and (d.TenderDepositStatus is null)"); // else // fromSouce += string.Format(" and d.TenderDepositStatus={0}", ddlTenderDeposit); //} //保证金状态 if (ddlTenderDeposit > 0) { if (ddlTenderDeposit == 12) { fromSouce += string.Format(" and (d.TenderDepositStatus is null)"); } else if (ddlTenderDeposit == 36) { fromSouce += string.Format(" and (dateadd(day,15,a.TenderTime) 0) { if (ddlBidbond == 32) fromSouce += string.Format(" and (d.BidbondStatus is null)"); else fromSouce += string.Format(" and d.BidbondStatus={0}", ddlBidbond); } //标书状态 if (ddlDocumentStatus > 0) { if (ddlDocumentStatus == 15) fromSouce += string.Format(" and (d.DocumentStatus = 0 or d.projectId is null or d.DocumentStatus = 15)"); else fromSouce += string.Format(" and d.DocumentStatus={0}", ddlDocumentStatus); } //投标状态 if (ddlTenderStatus > 0) { if (ddlTenderStatus == 1) fromSouce += string.Format(" and (d.TenderStatus=0 or d.projectId is null)"); else fromSouce += string.Format(" and d.TenderStatus= 1 "); } //中标情况 if (ddlWinStatus > 0) { if (ddlWinStatus == 1) fromSouce += string.Format(" and (n.IsWin is null)"); else fromSouce += string.Format(" and n.IsWin={0}", (ddlWinStatus - 1)); } //质疑情况 if (ddlOppugnStatus > 0) { if (ddlOppugnStatus == 1) fromSouce += string.Format(" and e.projectId is null"); else fromSouce += string.Format(" and e.projectId is not null "); } //投诉情况 if (ddlComplainStatus > 0) { if (ddlComplainStatus == 1) fromSouce += string.Format(" and f.projectId is null"); else fromSouce += string.Format(" and f.projectId is not null "); } //复议情况 if (ddlReviewStatus > 0) { if (ddlReviewStatus == 1) fromSouce += string.Format(" and g.projectId is null"); else fromSouce += string.Format(" and g.projectId is not null "); } //诉讼情况 if (ddlLitigationStatus > 0) { if (ddlLitigationStatus == 1) fromSouce += string.Format(" and h.projectId is null"); else fromSouce += string.Format(" and h.projectId is not null "); } list = db.SelectModelPage(ref pagination, selectTarget, fromSouce, " a.ProjectId desc ", resultOrderStr); if (list == null) { list = new List(); } return list; } public IList GetFinancial(ref Pagination pagination, string Province, string City, string County, string ddlSignupStartTime, string ddlSignupEndTime, string ddlTenderStartTime, string ddlTenderEndTime, string txtProjectName,string txtPurchaseUnit, string txtAgencyUnit,int ddlTenderDeposit, int ddlBidbond, int unitId) { IList list = new List(); string rowOrderStr = string.Empty; string resultOrderStr = ""; string selectTarget = @" a.ProjectId, (case when a.City='请选择' and a.County='请选择' then a.Province when a.County='请选择' or a.County='其他' then a.City else a.City+a.County ENd) as xmqy,a.ProjectName,a.PurchaseUnit,a.AgencyUnit,d.TenderDepositStartTime,a.TenderDeposit,d.TenderDepositEndTime,d.BidbondStartTime,d.BidbondEndTime,a.Bidbond, (case when d.TenderDepositStatus=0 or d.projectId is null or d.TenderDepositStatus is null then '缴费' when d.TenderDepositStatus=13 then '退款' else '√' end) as bzj, (case when d.BidbondStatus=0 or d.projectId is null or d.BidbondStatus is null then '缴费' when d.BidbondStatus=33 then '退款' else '√' end) as lybzj"; string fromSouce = " (Document_ProjectInfo a left join Document_ProjectExpand d on a.projectId=d.projectId and d.unitId='" + unitId + "') where 1=1 "; //省 if (!string.IsNullOrEmpty(Province) && Province != "请选择") fromSouce += string.Format(" and a.Province='{0}'", Province); //市 if (!string.IsNullOrEmpty(City) && City != "请选择") fromSouce += string.Format(" and a.City='{0}'", City); //区县 if (!string.IsNullOrEmpty(County) && County != "请选择") fromSouce += string.Format(" and a.County='{0}'", County); //报名时间 if (!string.IsNullOrEmpty(ddlSignupStartTime)) { string Time_String = string.IsNullOrEmpty(ddlSignupStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlSignupStartTime)).Substring(0, 10); fromSouce += string.Format(" and d.TenderDepositStartTime >='{0}'", Time_String); } //报名时间 if (!string.IsNullOrEmpty(ddlSignupEndTime)) { string Time_String = string.IsNullOrEmpty(ddlSignupEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlSignupEndTime)).Substring(0, 10); fromSouce += string.Format(" and d.TenderDepositStartTime <='{0}'", Time_String); } //开标时间 if (!string.IsNullOrEmpty(ddlTenderStartTime)) { string Time_String = string.IsNullOrEmpty(ddlTenderStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlTenderStartTime)).Substring(0, 10); fromSouce += string.Format(" and d.BidbondStartTime >='{0}'", Time_String); } //开标时间 if (!string.IsNullOrEmpty(ddlTenderEndTime)) { string Time_String = string.IsNullOrEmpty(ddlTenderEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlTenderEndTime).AddDays(1)).Substring(0, 10); fromSouce += string.Format(" and d.BidbondStartTime <='{0}'", Time_String); } //项目名称 if (!string.IsNullOrEmpty(txtProjectName)) fromSouce += string.Format(" and a.ProjectName like '%{0}%'", txtProjectName); //采购单位 if (!string.IsNullOrEmpty(txtPurchaseUnit)) fromSouce += string.Format(" and a.PurchaseUnit like '%{0}%'", txtPurchaseUnit); //代理机构 if (!string.IsNullOrEmpty(txtAgencyUnit)) fromSouce += string.Format(" and a.AgencyUnit like '%{0}%'", txtAgencyUnit); //保证金状态 if (ddlTenderDeposit > 0) { if (ddlTenderDeposit == 12) { fromSouce += string.Format(" and (d.TenderDepositStatus is null)"); } else if (ddlTenderDeposit == 35) { fromSouce += string.Format(" and (dattadd(day,15,a.TenderTime) 0) { if (ddlBidbond == 32) fromSouce += string.Format(" and (d.BidbondStatus is null)"); else fromSouce += string.Format(" and d.BidbondStatus={0}", ddlBidbond); } list = db.SelectModelPage(ref pagination, selectTarget, fromSouce, " d.TenderDepositStartTime desc ", resultOrderStr); if (list == null) { list = new List(); } return list; } public bool InsertProjectInfo(Document_ProjectInfo projectInfo) { Document_ProjectInfo trueModel = projectInfo as Document_ProjectInfo; if (trueModel == null) { return false; } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_ReleaseTime = null; if (trueModel.OpinionEndTime.HasValue) { par_ReleaseTime = new SqlParameter("@ReleaseTime", trueModel.ReleaseTime.Value); } else { par_ReleaseTime = new SqlParameter("@ReleaseTime", DBNull.Value); } SqlParameter par_OpinionEndTime = null; if (trueModel.OpinionEndTime.HasValue) { par_OpinionEndTime = new SqlParameter("@OpinionEndTime", trueModel.OpinionEndTime.Value); } else { par_OpinionEndTime = new SqlParameter("@OpinionEndTime", DBNull.Value); } SqlParameter par_FeedbackUnit = null; if (!string.IsNullOrEmpty(trueModel.FeedbackUnit)) { par_FeedbackUnit = new SqlParameter("@FeedbackUnit", trueModel.FeedbackUnit); } else { par_FeedbackUnit = new SqlParameter("@FeedbackUnit", ""); } SqlParameter par_ReportUnit = null; if (!string.IsNullOrEmpty(trueModel.ReportUnit)) { par_ReportUnit = new SqlParameter("@ReportUnit", trueModel.ReportUnit); } else { par_ReportUnit = new SqlParameter("@ReportUnit", ""); } SqlParameter par_SignupStartTime = null; if (trueModel.SignupStartTime.HasValue) { par_SignupStartTime = new SqlParameter("@SignupStartTime", trueModel.SignupStartTime.Value); } else { par_SignupStartTime = new SqlParameter("@SignupStartTime", DBNull.Value); } SqlParameter par_SignupEndTime = null; if (trueModel.SignupEndTime.HasValue) { par_SignupEndTime = new SqlParameter("@SignupEndTime", trueModel.SignupEndTime.Value); } else { par_SignupEndTime = new SqlParameter("@SignupEndTime", DBNull.Value); } SqlParameter par_SignupMethod = null; if (trueModel.SignupMethod.HasValue) { par_SignupMethod = new SqlParameter("@SignupMethod", trueModel.SignupMethod.Value); } else { par_SignupMethod = new SqlParameter("@SignupMethod", DBNull.Value); } SqlParameter par_SignupFee = null; if (trueModel.SignupFee.HasValue) { par_SignupFee = new SqlParameter("@SignupFee", trueModel.SignupFee.Value); } else { par_SignupFee = new SqlParameter("@SignupFee", DBNull.Value); } SqlParameter par_TenderDeposit = null; if (trueModel.TenderDeposit.HasValue) { par_TenderDeposit = new SqlParameter("@TenderDeposit", trueModel.TenderDeposit.Value); } else { par_TenderDeposit = new SqlParameter("@TenderDeposit", DBNull.Value); } SqlParameter par_PayMethod = null; if (trueModel.PayMethod.HasValue) { par_PayMethod = new SqlParameter("@PayMethod", trueModel.PayMethod.Value); } else { par_PayMethod = new SqlParameter("@PayMethod", DBNull.Value); } SqlParameter par_TenderTime = null; if (trueModel.TenderTime.HasValue) { par_TenderTime = new SqlParameter("@TenderTime", trueModel.TenderTime.Value); } else { par_TenderTime = new SqlParameter("@TenderTime", DBNull.Value); } SqlParameter par_ProjectName = null; if (!string.IsNullOrEmpty(trueModel.ProjectName)) { par_ProjectName = new SqlParameter("@ProjectName", trueModel.ProjectName); } else { par_ProjectName = new SqlParameter("@ProjectName", ""); } SqlParameter par_AgencyUnit = null; if (!string.IsNullOrEmpty(trueModel.AgencyUnit)) { par_AgencyUnit = new SqlParameter("@AgencyUnit", trueModel.AgencyUnit); } else { par_AgencyUnit = new SqlParameter("@AgencyUnit", ""); } SqlParameter par_AgencyManager = null; if (!string.IsNullOrEmpty(trueModel.AgencyManager)) { par_AgencyManager = new SqlParameter("@AgencyManager", trueModel.AgencyManager); } else { par_AgencyManager = new SqlParameter("@AgencyManager", ""); } SqlParameter par_AgencyPhone = null; if (!string.IsNullOrEmpty(trueModel.AgencyPhone)) { par_AgencyPhone = new SqlParameter("@AgencyPhone", trueModel.AgencyPhone); } else { par_AgencyPhone = new SqlParameter("@AgencyPhone", ""); } SqlParameter par_AgencyAddress = null; if (!string.IsNullOrEmpty(trueModel.AgencyAddress)) { par_AgencyAddress = new SqlParameter("@AgencyAddress", trueModel.AgencyAddress); } else { par_AgencyAddress = new SqlParameter("@AgencyAddress", ""); } SqlParameter par_AgencyZipCode = null; if (!string.IsNullOrEmpty(trueModel.AgencyZipCode)) { par_AgencyZipCode = new SqlParameter("@AgencyZipCode", trueModel.AgencyZipCode); } else { par_AgencyZipCode = new SqlParameter("@AgencyZipCode", ""); } SqlParameter par_AgencyFax = null; if (!string.IsNullOrEmpty(trueModel.AgencyFax)) { par_AgencyFax = new SqlParameter("@AgencyFax", trueModel.AgencyFax); } else { par_AgencyFax = new SqlParameter("@AgencyFax", ""); } SqlParameter par_PurchaseUnit = null; if (!string.IsNullOrEmpty(trueModel.PurchaseUnit)) { par_PurchaseUnit = new SqlParameter("@PurchaseUnit", trueModel.PurchaseUnit); } else { par_PurchaseUnit = new SqlParameter("@PurchaseUnit", ""); } SqlParameter par_PurchaseManager = null; if (!string.IsNullOrEmpty(trueModel.PurchaseManager)) { par_PurchaseManager = new SqlParameter("@PurchaseManager", trueModel.PurchaseManager); } else { par_PurchaseManager = new SqlParameter("@PurchaseManager", ""); } SqlParameter par_PurchasePhone = null; if (!string.IsNullOrEmpty(trueModel.PurchasePhone)) { par_PurchasePhone = new SqlParameter("@PurchasePhone", trueModel.PurchasePhone); } else { par_PurchasePhone = new SqlParameter("@PurchasePhone", ""); } SqlParameter par_PurchaseAddress = null; if (!string.IsNullOrEmpty(trueModel.PurchaseAddress)) { par_PurchaseAddress = new SqlParameter("@PurchaseAddress", trueModel.PurchaseAddress); } else { par_PurchaseAddress = new SqlParameter("@PurchaseAddress", ""); } SqlParameter par_ProjectCode = null; if (!string.IsNullOrEmpty(trueModel.ProjectCode)) { par_ProjectCode = new SqlParameter("@ProjectCode", trueModel.ProjectCode); } else { par_ProjectCode = new SqlParameter("@ProjectCode", ""); } SqlParameter par_PurchaseZipCode = null; if (!string.IsNullOrEmpty(trueModel.PurchaseZipCode)) { par_PurchaseZipCode = new SqlParameter("@PurchaseZipCode", trueModel.PurchaseZipCode); } else { par_PurchaseZipCode = new SqlParameter("@PurchaseZipCode", ""); } SqlParameter par_PurchaseFax = null; if (!string.IsNullOrEmpty(trueModel.PurchaseFax)) { par_PurchaseFax = new SqlParameter("@PurchaseFax", trueModel.PurchaseFax); } else { par_PurchaseFax = new SqlParameter("@PurchaseFax", ""); } SqlParameter par_IntendanceUnit = null; if (!string.IsNullOrEmpty(trueModel.IntendanceUnit)) { par_IntendanceUnit = new SqlParameter("@IntendanceUnit", trueModel.IntendanceUnit); } else { par_IntendanceUnit = new SqlParameter("@IntendanceUnit", ""); } SqlParameter par_IntendancePerson = null; if (!string.IsNullOrEmpty(trueModel.IntendancePerson)) { par_IntendancePerson = new SqlParameter("@IntendancePerson", trueModel.IntendancePerson); } else { par_IntendancePerson = new SqlParameter("@IntendancePerson", ""); } SqlParameter par_IntendancePhone = null; if (!string.IsNullOrEmpty(trueModel.IntendancePhone)) { par_IntendancePhone = new SqlParameter("@IntendancePhone", trueModel.IntendancePhone); } else { par_IntendancePhone = new SqlParameter("@IntendancePhone", ""); } SqlParameter par_IntendanceAddress = null; if (!string.IsNullOrEmpty(trueModel.IntendanceAddress)) { par_IntendanceAddress = new SqlParameter("@IntendanceAddress", trueModel.IntendanceAddress); } else { par_IntendanceAddress = new SqlParameter("@IntendanceAddress", ""); } SqlParameter par_IntendanceZipCode = null; if (!string.IsNullOrEmpty(trueModel.IntendanceZipCode)) { par_IntendanceZipCode = new SqlParameter("@IntendanceZipCode", trueModel.IntendanceZipCode); } else { par_IntendanceZipCode = new SqlParameter("@IntendanceZipCode", ""); } SqlParameter par_IntendanceFax = null; if (!string.IsNullOrEmpty(trueModel.IntendanceFax)) { par_IntendanceFax = new SqlParameter("@IntendanceFax", trueModel.IntendanceFax); } else { par_IntendanceFax = new SqlParameter("@IntendanceFax", ""); } SqlParameter par_Bidbond = null; if (trueModel.Bidbond.HasValue) { par_Bidbond = new SqlParameter("@Bidbond", trueModel.Bidbond.Value); } else { par_Bidbond = new SqlParameter("@Bidbond", DBNull.Value); } SqlParameter par_IsTenderDepositRemind = null; if (trueModel.IsTenderDepositRemind.HasValue) { par_IsTenderDepositRemind = new SqlParameter("@IsTenderDepositRemind", trueModel.IsTenderDepositRemind.Value); } else { par_IsTenderDepositRemind = new SqlParameter("@IsTenderDepositRemind", DBNull.Value); } SqlParameter par_ProjectStatus = null; if (trueModel.ProjectStatus.HasValue) { par_ProjectStatus = new SqlParameter("@ProjectStatus", trueModel.ProjectStatus.Value); } else { par_ProjectStatus = new SqlParameter("@ProjectStatus", DBNull.Value); } SqlParameter par_Province = null; if (!string.IsNullOrEmpty(trueModel.Province)) { par_Province = new SqlParameter("@Province", trueModel.Province); } else { par_Province = new SqlParameter("@Province", ""); } SqlParameter par_City = null; if (!string.IsNullOrEmpty(trueModel.City)) { par_City = new SqlParameter("@City", trueModel.City); } else { par_City = new SqlParameter("@City", ""); } SqlParameter par_County = null; if (!string.IsNullOrEmpty(trueModel.County)) { par_County = new SqlParameter("@County", trueModel.County); } else { par_County = new SqlParameter("@County", ""); } SqlParameter par_NoticeType = null; if (trueModel.NoticeType.HasValue) { par_NoticeType = new SqlParameter("@NoticeType", trueModel.NoticeType.Value); } else { par_NoticeType = new SqlParameter("@NoticeType", DBNull.Value); } SqlParameter par_PurchaseMethod = null; if (trueModel.PurchaseMethod.HasValue) { par_PurchaseMethod = new SqlParameter("@PurchaseMethod", trueModel.PurchaseMethod.Value); } else { par_PurchaseMethod = new SqlParameter("@PurchaseMethod", DBNull.Value); } SqlParameter par_CgwjTime = null; if (trueModel.CgwjTime.HasValue) { par_CgwjTime = new SqlParameter("@CgwjTime", trueModel.CgwjTime.Value); } else { par_CgwjTime = new SqlParameter("@CgwjTime", DBNull.Value); } SqlParameter par_PackageNum = null; if (!string.IsNullOrEmpty(trueModel.PackageNum)) { par_PackageNum = new SqlParameter("@PackageNum", trueModel.PackageNum); } else { par_PackageNum = new SqlParameter("@PackageNum", ""); } IList sqlParms = new List() { par_ProjectId, par_ReleaseTime, par_OpinionEndTime , par_FeedbackUnit , par_ReportUnit , par_SignupStartTime , par_SignupEndTime , par_SignupMethod , par_SignupFee , par_TenderDeposit , par_PayMethod , par_TenderTime , par_ProjectName , par_AgencyUnit , par_AgencyManager , par_AgencyPhone , par_AgencyAddress , par_AgencyZipCode , par_AgencyFax , par_PurchaseUnit , par_PurchaseManager , par_PurchasePhone , par_PurchaseAddress , par_ProjectCode , par_PurchaseZipCode , par_PurchaseFax , par_IntendanceUnit , par_IntendancePerson , par_IntendancePhone , par_IntendanceAddress , par_IntendanceZipCode , par_IntendanceFax , par_Bidbond , par_IsTenderDepositRemind , par_ProjectStatus , par_Province , par_City , par_County , par_NoticeType , par_PurchaseMethod , par_PackageNum, par_CgwjTime }; try { db.Query("Document_ProjectInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public bool UpdateProjectInfo(Document_ProjectInfo projectInfo) { Document_ProjectInfo trueModel = projectInfo as Document_ProjectInfo; if (trueModel == null) { return false; } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_ReleaseTime = null; if (trueModel.OpinionEndTime.HasValue) { par_ReleaseTime = new SqlParameter("@ReleaseTime", trueModel.ReleaseTime.Value); } else { par_ReleaseTime = new SqlParameter("@ReleaseTime", DBNull.Value); } SqlParameter par_OpinionEndTime = null; if (trueModel.OpinionEndTime.HasValue) { par_OpinionEndTime = new SqlParameter("@OpinionEndTime", trueModel.OpinionEndTime.Value); } else { par_OpinionEndTime = new SqlParameter("@OpinionEndTime", DBNull.Value); } SqlParameter par_FeedbackUnit = null; if (!string.IsNullOrEmpty(trueModel.FeedbackUnit)) { par_FeedbackUnit = new SqlParameter("@FeedbackUnit", trueModel.FeedbackUnit); } else { par_FeedbackUnit = new SqlParameter("@FeedbackUnit", ""); } SqlParameter par_ReportUnit = null; if (!string.IsNullOrEmpty(trueModel.ReportUnit)) { par_ReportUnit = new SqlParameter("@ReportUnit", trueModel.ReportUnit); } else { par_ReportUnit = new SqlParameter("@ReportUnit", ""); } SqlParameter par_SignupStartTime = null; if (trueModel.SignupStartTime.HasValue) { par_SignupStartTime = new SqlParameter("@SignupStartTime", trueModel.SignupStartTime.Value); } else { par_SignupStartTime = new SqlParameter("@SignupStartTime", DBNull.Value); } SqlParameter par_SignupEndTime = null; if (trueModel.SignupEndTime.HasValue) { par_SignupEndTime = new SqlParameter("@SignupEndTime", trueModel.SignupEndTime.Value); } else { par_SignupEndTime = new SqlParameter("@SignupEndTime", DBNull.Value); } SqlParameter par_SignupMethod = null; if (trueModel.SignupMethod.HasValue) { par_SignupMethod = new SqlParameter("@SignupMethod", trueModel.SignupMethod.Value); } else { par_SignupMethod = new SqlParameter("@SignupMethod", DBNull.Value); } SqlParameter par_SignupFee = null; if (trueModel.SignupFee.HasValue) { par_SignupFee = new SqlParameter("@SignupFee", trueModel.SignupFee.Value); } else { par_SignupFee = new SqlParameter("@SignupFee", DBNull.Value); } SqlParameter par_TenderDeposit = null; if (trueModel.TenderDeposit.HasValue) { par_TenderDeposit = new SqlParameter("@TenderDeposit", trueModel.TenderDeposit.Value); } else { par_TenderDeposit = new SqlParameter("@TenderDeposit", DBNull.Value); } SqlParameter par_PayMethod = null; if (trueModel.PayMethod.HasValue) { par_PayMethod = new SqlParameter("@PayMethod", trueModel.PayMethod.Value); } else { par_PayMethod = new SqlParameter("@PayMethod", DBNull.Value); } SqlParameter par_TenderTime = null; if (trueModel.TenderTime.HasValue) { par_TenderTime = new SqlParameter("@TenderTime", trueModel.TenderTime.Value); } else { par_TenderTime = new SqlParameter("@TenderTime", DBNull.Value); } SqlParameter par_ProjectName = null; if (!string.IsNullOrEmpty(trueModel.ProjectName)) { par_ProjectName = new SqlParameter("@ProjectName", trueModel.ProjectName); } else { par_ProjectName = new SqlParameter("@ProjectName", ""); } SqlParameter par_AgencyUnit = null; if (!string.IsNullOrEmpty(trueModel.AgencyUnit)) { par_AgencyUnit = new SqlParameter("@AgencyUnit", trueModel.AgencyUnit); } else { par_AgencyUnit = new SqlParameter("@AgencyUnit", ""); } SqlParameter par_AgencyManager = null; if (!string.IsNullOrEmpty(trueModel.AgencyManager)) { par_AgencyManager = new SqlParameter("@AgencyManager", trueModel.AgencyManager); } else { par_AgencyManager = new SqlParameter("@AgencyManager", ""); } SqlParameter par_AgencyPhone = null; if (!string.IsNullOrEmpty(trueModel.AgencyPhone)) { par_AgencyPhone = new SqlParameter("@AgencyPhone", trueModel.AgencyPhone); } else { par_AgencyPhone = new SqlParameter("@AgencyPhone", ""); } SqlParameter par_AgencyAddress = null; if (!string.IsNullOrEmpty(trueModel.AgencyAddress)) { par_AgencyAddress = new SqlParameter("@AgencyAddress", trueModel.AgencyAddress); } else { par_AgencyAddress = new SqlParameter("@AgencyAddress", ""); } SqlParameter par_AgencyZipCode = null; if (!string.IsNullOrEmpty(trueModel.AgencyZipCode)) { par_AgencyZipCode = new SqlParameter("@AgencyZipCode", trueModel.AgencyZipCode); } else { par_AgencyZipCode = new SqlParameter("@AgencyZipCode", ""); } SqlParameter par_AgencyFax = null; if (!string.IsNullOrEmpty(trueModel.AgencyFax)) { par_AgencyFax = new SqlParameter("@AgencyFax", trueModel.AgencyFax); } else { par_AgencyFax = new SqlParameter("@AgencyFax", ""); } SqlParameter par_PurchaseUnit = null; if (!string.IsNullOrEmpty(trueModel.PurchaseUnit)) { par_PurchaseUnit = new SqlParameter("@PurchaseUnit", trueModel.PurchaseUnit); } else { par_PurchaseUnit = new SqlParameter("@PurchaseUnit", ""); } SqlParameter par_PurchaseManager = null; if (!string.IsNullOrEmpty(trueModel.PurchaseManager)) { par_PurchaseManager = new SqlParameter("@PurchaseManager", trueModel.PurchaseManager); } else { par_PurchaseManager = new SqlParameter("@PurchaseManager", ""); } SqlParameter par_PurchasePhone = null; if (!string.IsNullOrEmpty(trueModel.PurchasePhone)) { par_PurchasePhone = new SqlParameter("@PurchasePhone", trueModel.PurchasePhone); } else { par_PurchasePhone = new SqlParameter("@PurchasePhone", ""); } SqlParameter par_PurchaseAddress = null; if (!string.IsNullOrEmpty(trueModel.PurchaseAddress)) { par_PurchaseAddress = new SqlParameter("@PurchaseAddress", trueModel.PurchaseAddress); } else { par_PurchaseAddress = new SqlParameter("@PurchaseAddress", ""); } SqlParameter par_ProjectCode = null; if (!string.IsNullOrEmpty(trueModel.ProjectCode)) { par_ProjectCode = new SqlParameter("@ProjectCode", trueModel.ProjectCode); } else { par_ProjectCode = new SqlParameter("@ProjectCode", ""); } SqlParameter par_PurchaseZipCode = null; if (!string.IsNullOrEmpty(trueModel.PurchaseZipCode)) { par_PurchaseZipCode = new SqlParameter("@PurchaseZipCode", trueModel.PurchaseZipCode); } else { par_PurchaseZipCode = new SqlParameter("@PurchaseZipCode", ""); } SqlParameter par_PurchaseFax = null; if (!string.IsNullOrEmpty(trueModel.PurchaseFax)) { par_PurchaseFax = new SqlParameter("@PurchaseFax", trueModel.PurchaseFax); } else { par_PurchaseFax = new SqlParameter("@PurchaseFax", ""); } SqlParameter par_IntendanceUnit = null; if (!string.IsNullOrEmpty(trueModel.IntendanceUnit)) { par_IntendanceUnit = new SqlParameter("@IntendanceUnit", trueModel.IntendanceUnit); } else { par_IntendanceUnit = new SqlParameter("@IntendanceUnit", ""); } SqlParameter par_IntendancePerson = null; if (!string.IsNullOrEmpty(trueModel.IntendancePerson)) { par_IntendancePerson = new SqlParameter("@IntendancePerson", trueModel.IntendancePerson); } else { par_IntendancePerson = new SqlParameter("@IntendancePerson", ""); } SqlParameter par_IntendancePhone = null; if (!string.IsNullOrEmpty(trueModel.IntendancePhone)) { par_IntendancePhone = new SqlParameter("@IntendancePhone", trueModel.IntendancePhone); } else { par_IntendancePhone = new SqlParameter("@IntendancePhone", ""); } SqlParameter par_IntendanceAddress = null; if (!string.IsNullOrEmpty(trueModel.IntendanceAddress)) { par_IntendanceAddress = new SqlParameter("@IntendanceAddress", trueModel.IntendanceAddress); } else { par_IntendanceAddress = new SqlParameter("@IntendanceAddress", ""); } SqlParameter par_IntendanceZipCode = null; if (!string.IsNullOrEmpty(trueModel.IntendanceZipCode)) { par_IntendanceZipCode = new SqlParameter("@IntendanceZipCode", trueModel.IntendanceZipCode); } else { par_IntendanceZipCode = new SqlParameter("@IntendanceZipCode", ""); } SqlParameter par_IntendanceFax = null; if (!string.IsNullOrEmpty(trueModel.IntendanceFax)) { par_IntendanceFax = new SqlParameter("@IntendanceFax", trueModel.IntendanceFax); } else { par_IntendanceFax = new SqlParameter("@IntendanceFax", ""); } SqlParameter par_Bidbond = null; if (trueModel.Bidbond.HasValue) { par_Bidbond = new SqlParameter("@Bidbond", trueModel.Bidbond.Value); } else { par_Bidbond = new SqlParameter("@Bidbond", DBNull.Value); } SqlParameter par_IsTenderDepositRemind = null; if (trueModel.IsTenderDepositRemind.HasValue) { par_IsTenderDepositRemind = new SqlParameter("@IsTenderDepositRemind", trueModel.IsTenderDepositRemind.Value); } else { par_IsTenderDepositRemind = new SqlParameter("@IsTenderDepositRemind", DBNull.Value); } SqlParameter par_ProjectStatus = null; if (trueModel.ProjectStatus.HasValue) { par_ProjectStatus = new SqlParameter("@ProjectStatus", trueModel.ProjectStatus.Value); } else { par_ProjectStatus = new SqlParameter("@ProjectStatus", DBNull.Value); } SqlParameter par_Province = null; if (!string.IsNullOrEmpty(trueModel.Province)) { par_Province = new SqlParameter("@Province", trueModel.Province); } else { par_Province = new SqlParameter("@Province", ""); } SqlParameter par_City = null; if (!string.IsNullOrEmpty(trueModel.City)) { par_City = new SqlParameter("@City", trueModel.City); } else { par_City = new SqlParameter("@City", ""); } SqlParameter par_County = null; if (!string.IsNullOrEmpty(trueModel.County)) { par_County = new SqlParameter("@County", trueModel.County); } else { par_County = new SqlParameter("@County", ""); } SqlParameter par_NoticeType = null; if (trueModel.NoticeType.HasValue) { par_NoticeType = new SqlParameter("@NoticeType", trueModel.NoticeType.Value); } else { par_NoticeType = new SqlParameter("@NoticeType", DBNull.Value); } SqlParameter par_PurchaseMethod = null; if (trueModel.PurchaseMethod.HasValue) { par_PurchaseMethod = new SqlParameter("@PurchaseMethod", trueModel.PurchaseMethod.Value); } else { par_PurchaseMethod = new SqlParameter("@PurchaseMethod", DBNull.Value); } SqlParameter par_CgwjTime = null; if (trueModel.CgwjTime.HasValue) { par_CgwjTime = new SqlParameter("@CgwjTime", trueModel.CgwjTime.Value); } else { par_CgwjTime = new SqlParameter("@CgwjTime", DBNull.Value); } SqlParameter par_PackageNum = null; if (!string.IsNullOrEmpty(trueModel.PackageNum)) { par_PackageNum = new SqlParameter("@PackageNum", trueModel.PackageNum); } else { par_PackageNum = new SqlParameter("@PackageNum", ""); } IList sqlParms = new List() { par_ProjectId , par_ReleaseTime, par_OpinionEndTime , par_FeedbackUnit , par_ReportUnit , par_SignupStartTime , par_SignupEndTime , par_SignupMethod , par_SignupFee , par_TenderDeposit , par_PayMethod , par_TenderTime , par_ProjectName , par_AgencyUnit , par_AgencyManager , par_AgencyPhone , par_AgencyAddress , par_AgencyZipCode , par_AgencyFax , par_PurchaseUnit , par_PurchaseManager , par_PurchasePhone , par_PurchaseAddress , par_ProjectCode , par_PurchaseZipCode , par_PurchaseFax , par_IntendanceUnit , par_IntendancePerson , par_IntendancePhone , par_IntendanceAddress , par_IntendanceZipCode , par_IntendanceFax , par_Bidbond , par_IsTenderDepositRemind , par_ProjectStatus , par_Province , par_City , par_County , par_NoticeType , par_PurchaseMethod , par_CgwjTime, par_PackageNum }; try { db.Query("Document_ProjectInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public bool DeleteProjectInfo(int projectId) { string sqlStr = "delete from Document_ProjectInfo where ProjectId='" + projectId + "'"; string sqlStr1 = "delete from Document_ProjectDocumentInfo where ProjectId='" + projectId + "'"; string sqlStr2 = "delete from Document_ProjectExpand where ProjectId='" + projectId + "'"; string sqlStr3 = "delete from Document_ProjectLitigationInfo where ProjectId='" + projectId + "'"; string sqlStr4 = "delete from Document_ProjectOppugnInfo where ProjectId='" + projectId + "'"; string sqlStr5 = "delete from Document_ProjectReviewInfo where ProjectId='" + projectId + "'"; string sqlStr6 = "delete from Document_WinInfo where ProjectId='" + projectId + "'"; string sqlStr7 = "delete from Document_ProjectComplainInfo where ProjectId='" + projectId + "'"; string sqlStr8 = "delete from Document_ProjectDocumentInfo where ProjectId='" + projectId + "'"; try { db.ExecuteSql(sqlStr); db.ExecuteSql(sqlStr1); db.ExecuteSql(sqlStr2); db.ExecuteSql(sqlStr3); db.ExecuteSql(sqlStr4); db.ExecuteSql(sqlStr5); db.ExecuteSql(sqlStr6); db.ExecuteSql(sqlStr7); db.ExecuteSql(sqlStr8); } catch (Exception ex) { return false; } return true; } public bool DeleteProjectList(IList projectIdList) { foreach (int item in projectIdList) { DeleteProjectInfo(item); } return true; } public bool SaveProjectExpand(Document_ProjectExpand projectExpand) { if (IsExistProjectExpand(projectExpand.ProjectId.Value, projectExpand.UnitId.Value)) { return UpdateProjectExpand(projectExpand); } else { return InsertProjectExpand(projectExpand); } } public bool IsExistProjectExpand(int projectId, int unitId) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_ProjectExpand where projectId={0} and UnitId={1} "; sqlStr = string.Format(sqlStr, projectId, unitId); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } private bool InsertProjectExpand(Document_ProjectExpand projectExpand) { Document_ProjectExpand trueModel = projectExpand as Document_ProjectExpand; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_TenderStatus = null; if (trueModel.TenderStatus.HasValue) { par_TenderStatus = new SqlParameter("@TenderStatus", trueModel.TenderStatus.Value); } else { par_TenderStatus = new SqlParameter("@TenderStatus", DBNull.Value); } SqlParameter par_TenderPerson = null; if (!string.IsNullOrEmpty(trueModel.TenderPerson)) { par_TenderPerson = new SqlParameter("@TenderPerson", trueModel.TenderPerson); } else { par_TenderPerson = new SqlParameter("@TenderPerson", ""); } SqlParameter par_TenderPrice = null; if (trueModel.TenderPrice.HasValue) { par_TenderPrice = new SqlParameter("@TenderPrice", trueModel.TenderPrice.Value); } else { par_TenderPrice = new SqlParameter("@TenderPrice", DBNull.Value); } SqlParameter par_TenderDraw = null; if (trueModel.TenderDraw.HasValue) { par_TenderDraw = new SqlParameter("@TenderDraw", trueModel.TenderDraw.Value); } else { par_TenderDraw = new SqlParameter("@TenderDraw", DBNull.Value); } SqlParameter par_TenderDepositStatus = null; if (trueModel.TenderDepositStatus.HasValue) { par_TenderDepositStatus = new SqlParameter("@TenderDepositStatus", trueModel.TenderDepositStatus.Value); } else { par_TenderDepositStatus = new SqlParameter("@TenderDepositStatus", DBNull.Value); } SqlParameter par_TenderDepositStartTime = null; if (trueModel.TenderDepositStartTime.HasValue) { par_TenderDepositStartTime = new SqlParameter("@TenderDepositStartTime", trueModel.TenderDepositStartTime.Value); } else { par_TenderDepositStartTime = new SqlParameter("@TenderDepositStartTime", DBNull.Value); } SqlParameter par_TenderDepositEndTime = null; if (trueModel.TenderDepositEndTime.HasValue) { par_TenderDepositEndTime = new SqlParameter("@TenderDepositEndTime", trueModel.TenderDepositEndTime.Value); } else { par_TenderDepositEndTime = new SqlParameter("@TenderDepositEndTime", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_IntroductionPath = null; if (!string.IsNullOrEmpty(trueModel.IntroductionPath)) { par_IntroductionPath = new SqlParameter("@IntroductionPath", trueModel.IntroductionPath); } else { par_IntroductionPath = new SqlParameter("@IntroductionPath", ""); } SqlParameter par_IntroductionPathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.IntroductionPathVersionNo)) { par_IntroductionPathVersionNo = new SqlParameter("@IntroductionPathVersionNo", trueModel.IntroductionPathVersionNo); } else { par_IntroductionPathVersionNo = new SqlParameter("@IntroductionPathVersionNo", ""); } SqlParameter par_IntroductionPathSize = null; if (trueModel.IntroductionPathSize.HasValue) { par_IntroductionPathSize = new SqlParameter("@IntroductionPathSize", trueModel.IntroductionPathSize.Value); } else { par_IntroductionPathSize = new SqlParameter("@IntroductionPathSize", DBNull.Value); } SqlParameter par_FaceSlipPath = null; if (!string.IsNullOrEmpty(trueModel.FaceSlipPath)) { par_FaceSlipPath = new SqlParameter("@FaceSlipPath", trueModel.FaceSlipPath); } else { par_FaceSlipPath = new SqlParameter("@FaceSlipPath", ""); } SqlParameter par_FaceSlipPathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FaceSlipPathVersionNo)) { par_FaceSlipPathVersionNo = new SqlParameter("@FaceSlipPathVersionNo", trueModel.FaceSlipPathVersionNo); } else { par_FaceSlipPathVersionNo = new SqlParameter("@FaceSlipPathVersionNo", ""); } SqlParameter par_FaceSlipPathSize = null; if (trueModel.FaceSlipPathSize.HasValue) { par_FaceSlipPathSize = new SqlParameter("@FaceSlipPathSize", trueModel.FaceSlipPathSize.Value); } else { par_FaceSlipPathSize = new SqlParameter("@FaceSlipPathSize", DBNull.Value); } SqlParameter par_FaceSlipFlag = null; if (trueModel.FaceSlipFlag.HasValue) { par_FaceSlipFlag = new SqlParameter("@FaceSlipFlag", trueModel.FaceSlipFlag.Value); } else { par_FaceSlipFlag = new SqlParameter("@FaceSlipFlag", DBNull.Value); } SqlParameter par_IntroductionFlag = null; if (trueModel.IntroductionFlag.HasValue) { par_IntroductionFlag = new SqlParameter("@IntroductionFlag", trueModel.IntroductionFlag.Value); } else { par_IntroductionFlag = new SqlParameter("@IntroductionFlag", DBNull.Value); } SqlParameter par_IntroductionUserId = null; if (trueModel.IntroductionUserId.HasValue) { par_IntroductionUserId = new SqlParameter("@IntroductionUserId", trueModel.IntroductionUserId.Value); } else { par_IntroductionUserId = new SqlParameter("@IntroductionUserId", DBNull.Value); } SqlParameter par_FaceSlipUserId = null; if (trueModel.FaceSlipUserId.HasValue) { par_FaceSlipUserId = new SqlParameter("@FaceSlipUserId", trueModel.FaceSlipUserId.Value); } else { par_FaceSlipUserId = new SqlParameter("@FaceSlipUserId", DBNull.Value); } SqlParameter par_IsSignup = null; if (trueModel.IsSignup.HasValue) { par_IsSignup = new SqlParameter("@IsSignup", trueModel.IsSignup.Value); } else { par_IsSignup = new SqlParameter("@IsSignup", DBNull.Value); } SqlParameter par_BidbondStatus = null; if (trueModel.BidbondStatus.HasValue) { par_BidbondStatus = new SqlParameter("@BidbondStatus", trueModel.BidbondStatus.Value); } else { par_BidbondStatus = new SqlParameter("@BidbondStatus", DBNull.Value); } SqlParameter par_BidbondStartTime = null; if (trueModel.BidbondStartTime.HasValue) { par_BidbondStartTime = new SqlParameter("@BidbondStartTime", trueModel.BidbondStartTime.Value); } else { par_BidbondStartTime = new SqlParameter("@BidbondStartTime", DBNull.Value); } SqlParameter par_BidbondEndTime = null; if (trueModel.BidbondEndTime.HasValue) { par_BidbondEndTime = new SqlParameter("@BidbondEndTime", trueModel.BidbondEndTime.Value); } else { par_BidbondEndTime = new SqlParameter("@BidbondEndTime", DBNull.Value); } SqlParameter par_SignupPerson = null; if (!string.IsNullOrEmpty(trueModel.SignupPerson)) { par_SignupPerson = new SqlParameter("@SignupPerson", trueModel.SignupPerson); } else { par_SignupPerson = new SqlParameter("@SignupPerson", ""); } SqlParameter par_SignupTime = null; if (trueModel.SignupTime.HasValue) { par_SignupTime = new SqlParameter("@SignupTime", trueModel.SignupTime.Value); } else { par_SignupTime = new SqlParameter("@SignupTime", DBNull.Value); } SqlParameter par_SignupAllowance = null; if (trueModel.SignupAllowance.HasValue) { par_SignupAllowance = new SqlParameter("@SignupAllowance", trueModel.SignupAllowance.Value); } else { par_SignupAllowance = new SqlParameter("@SignupAllowance", DBNull.Value); } SqlParameter par_DocumentStatus = null; if (trueModel.DocumentStatus.HasValue) { par_DocumentStatus = new SqlParameter("@DocumentStatus", trueModel.DocumentStatus.Value); } else { par_DocumentStatus = new SqlParameter("@DocumentStatus", DBNull.Value); } SqlParameter par_DocumentPrice = null; if (trueModel.DocumentPrice.HasValue) { par_DocumentPrice = new SqlParameter("@DocumentPrice", trueModel.DocumentPrice.Value); } else { par_DocumentPrice = new SqlParameter("@DocumentPrice", DBNull.Value); } SqlParameter par_DocumentManager = null; if (!string.IsNullOrEmpty(trueModel.DocumentManager)) { par_DocumentManager = new SqlParameter("@DocumentManager", trueModel.DocumentManager); } else { par_DocumentManager = new SqlParameter("@DocumentManager", ""); } SqlParameter par_Experts = null; if (!string.IsNullOrEmpty(trueModel.Experts)) { par_Experts = new SqlParameter("@Experts", trueModel.Experts); } else { par_Experts = new SqlParameter("@Experts", ""); } IList sqlParms = new List() { par_ID, par_TenderStatus , par_TenderPerson , par_TenderPrice , par_TenderDraw , par_TenderDepositStatus , par_TenderDepositStartTime , par_TenderDepositEndTime , par_UnitId , par_LastUpdateTime , par_LastUpdateName , par_ProjectId , par_IntroductionPath , par_IntroductionPathVersionNo , par_IntroductionPathSize , par_FaceSlipPath , par_FaceSlipPathVersionNo , par_FaceSlipPathSize , par_FaceSlipFlag , par_IntroductionFlag , par_IntroductionUserId , par_FaceSlipUserId , par_IsSignup , par_BidbondStatus , par_BidbondStartTime , par_BidbondEndTime , par_SignupPerson , par_SignupTime , par_SignupAllowance , par_DocumentStatus , par_DocumentPrice , par_DocumentManager, par_Experts }; try { db.Query("Document_ProjectExpand_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectExpand(Document_ProjectExpand projectExpand) { Document_ProjectExpand trueModel = projectExpand as Document_ProjectExpand; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_TenderStatus = null; if (trueModel.TenderStatus.HasValue) { par_TenderStatus = new SqlParameter("@TenderStatus", trueModel.TenderStatus.Value); } else { par_TenderStatus = new SqlParameter("@TenderStatus", DBNull.Value); } SqlParameter par_TenderPerson = null; if (!string.IsNullOrEmpty(trueModel.TenderPerson)) { par_TenderPerson = new SqlParameter("@TenderPerson", trueModel.TenderPerson); } else { par_TenderPerson = new SqlParameter("@TenderPerson", ""); } SqlParameter par_TenderPrice = null; if (trueModel.TenderPrice.HasValue) { par_TenderPrice = new SqlParameter("@TenderPrice", trueModel.TenderPrice.Value); } else { par_TenderPrice = new SqlParameter("@TenderPrice", DBNull.Value); } SqlParameter par_TenderDraw = null; if (trueModel.TenderDraw.HasValue) { par_TenderDraw = new SqlParameter("@TenderDraw", trueModel.TenderDraw.Value); } else { par_TenderDraw = new SqlParameter("@TenderDraw", DBNull.Value); } SqlParameter par_TenderDepositStatus = null; if (trueModel.TenderDepositStatus.HasValue) { par_TenderDepositStatus = new SqlParameter("@TenderDepositStatus", trueModel.TenderDepositStatus.Value); } else { par_TenderDepositStatus = new SqlParameter("@TenderDepositStatus", DBNull.Value); } SqlParameter par_TenderDepositStartTime = null; if (trueModel.TenderDepositStartTime.HasValue) { par_TenderDepositStartTime = new SqlParameter("@TenderDepositStartTime", trueModel.TenderDepositStartTime.Value); } else { par_TenderDepositStartTime = new SqlParameter("@TenderDepositStartTime", DBNull.Value); } SqlParameter par_TenderDepositEndTime = null; if (trueModel.TenderDepositEndTime.HasValue) { par_TenderDepositEndTime = new SqlParameter("@TenderDepositEndTime", trueModel.TenderDepositEndTime.Value); } else { par_TenderDepositEndTime = new SqlParameter("@TenderDepositEndTime", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_IntroductionPath = null; if (!string.IsNullOrEmpty(trueModel.IntroductionPath)) { par_IntroductionPath = new SqlParameter("@IntroductionPath", trueModel.IntroductionPath); } else { par_IntroductionPath = new SqlParameter("@IntroductionPath", ""); } SqlParameter par_IntroductionPathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.IntroductionPathVersionNo)) { par_IntroductionPathVersionNo = new SqlParameter("@IntroductionPathVersionNo", trueModel.IntroductionPathVersionNo); } else { par_IntroductionPathVersionNo = new SqlParameter("@IntroductionPathVersionNo", ""); } SqlParameter par_IntroductionPathSize = null; if (trueModel.IntroductionPathSize.HasValue) { par_IntroductionPathSize = new SqlParameter("@IntroductionPathSize", trueModel.IntroductionPathSize.Value); } else { par_IntroductionPathSize = new SqlParameter("@IntroductionPathSize", DBNull.Value); } SqlParameter par_FaceSlipPath = null; if (!string.IsNullOrEmpty(trueModel.FaceSlipPath)) { par_FaceSlipPath = new SqlParameter("@FaceSlipPath", trueModel.FaceSlipPath); } else { par_FaceSlipPath = new SqlParameter("@FaceSlipPath", ""); } SqlParameter par_FaceSlipPathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FaceSlipPathVersionNo)) { par_FaceSlipPathVersionNo = new SqlParameter("@FaceSlipPathVersionNo", trueModel.FaceSlipPathVersionNo); } else { par_FaceSlipPathVersionNo = new SqlParameter("@FaceSlipPathVersionNo", ""); } SqlParameter par_FaceSlipPathSize = null; if (trueModel.FaceSlipPathSize.HasValue) { par_FaceSlipPathSize = new SqlParameter("@FaceSlipPathSize", trueModel.FaceSlipPathSize.Value); } else { par_FaceSlipPathSize = new SqlParameter("@FaceSlipPathSize", DBNull.Value); } SqlParameter par_FaceSlipFlag = null; if (trueModel.FaceSlipFlag.HasValue) { par_FaceSlipFlag = new SqlParameter("@FaceSlipFlag", trueModel.FaceSlipFlag.Value); } else { par_FaceSlipFlag = new SqlParameter("@FaceSlipFlag", DBNull.Value); } SqlParameter par_IntroductionFlag = null; if (trueModel.IntroductionFlag.HasValue) { par_IntroductionFlag = new SqlParameter("@IntroductionFlag", trueModel.IntroductionFlag.Value); } else { par_IntroductionFlag = new SqlParameter("@IntroductionFlag", DBNull.Value); } SqlParameter par_IntroductionUserId = null; if (trueModel.IntroductionUserId.HasValue) { par_IntroductionUserId = new SqlParameter("@IntroductionUserId", trueModel.IntroductionUserId.Value); } else { par_IntroductionUserId = new SqlParameter("@IntroductionUserId", DBNull.Value); } SqlParameter par_FaceSlipUserId = null; if (trueModel.FaceSlipUserId.HasValue) { par_FaceSlipUserId = new SqlParameter("@FaceSlipUserId", trueModel.FaceSlipUserId.Value); } else { par_FaceSlipUserId = new SqlParameter("@FaceSlipUserId", DBNull.Value); } SqlParameter par_IsSignup = null; if (trueModel.IsSignup.HasValue) { par_IsSignup = new SqlParameter("@IsSignup", trueModel.IsSignup.Value); } else { par_IsSignup = new SqlParameter("@IsSignup", DBNull.Value); } SqlParameter par_BidbondStatus = null; if (trueModel.BidbondStatus.HasValue) { par_BidbondStatus = new SqlParameter("@BidbondStatus", trueModel.BidbondStatus.Value); } else { par_BidbondStatus = new SqlParameter("@BidbondStatus", DBNull.Value); } SqlParameter par_BidbondStartTime = null; if (trueModel.BidbondStartTime.HasValue) { par_BidbondStartTime = new SqlParameter("@BidbondStartTime", trueModel.BidbondStartTime.Value); } else { par_BidbondStartTime = new SqlParameter("@BidbondStartTime", DBNull.Value); } SqlParameter par_BidbondEndTime = null; if (trueModel.BidbondEndTime.HasValue) { par_BidbondEndTime = new SqlParameter("@BidbondEndTime", trueModel.BidbondEndTime.Value); } else { par_BidbondEndTime = new SqlParameter("@BidbondEndTime", DBNull.Value); } SqlParameter par_SignupPerson = null; if (!string.IsNullOrEmpty(trueModel.SignupPerson)) { par_SignupPerson = new SqlParameter("@SignupPerson", trueModel.SignupPerson); } else { par_SignupPerson = new SqlParameter("@SignupPerson", ""); } SqlParameter par_SignupTime = null; if (trueModel.SignupTime.HasValue) { par_SignupTime = new SqlParameter("@SignupTime", trueModel.SignupTime.Value); } else { par_SignupTime = new SqlParameter("@SignupTime", DBNull.Value); } SqlParameter par_SignupAllowance = null; if (trueModel.SignupAllowance.HasValue) { par_SignupAllowance = new SqlParameter("@SignupAllowance", trueModel.SignupAllowance.Value); } else { par_SignupAllowance = new SqlParameter("@SignupAllowance", DBNull.Value); } SqlParameter par_DocumentStatus = null; if (trueModel.DocumentStatus.HasValue) { par_DocumentStatus = new SqlParameter("@DocumentStatus", trueModel.DocumentStatus.Value); } else { par_DocumentStatus = new SqlParameter("@DocumentStatus", DBNull.Value); } SqlParameter par_DocumentPrice = null; if (trueModel.DocumentPrice.HasValue) { par_DocumentPrice = new SqlParameter("@DocumentPrice", trueModel.DocumentPrice.Value); } else { par_DocumentPrice = new SqlParameter("@DocumentPrice", DBNull.Value); } SqlParameter par_DocumentManager = null; if (!string.IsNullOrEmpty(trueModel.DocumentManager)) { par_DocumentManager = new SqlParameter("@DocumentManager", trueModel.DocumentManager); } else { par_DocumentManager = new SqlParameter("@DocumentManager", ""); } SqlParameter par_Experts = null; if (!string.IsNullOrEmpty(trueModel.Experts)) { par_Experts = new SqlParameter("@Experts", trueModel.Experts); } else { par_Experts = new SqlParameter("@Experts", ""); } IList sqlParms = new List() { par_ID , par_TenderStatus , par_TenderPerson , par_TenderPrice , par_TenderDraw , par_TenderDepositStatus , par_TenderDepositStartTime , par_TenderDepositEndTime , par_UnitId , par_LastUpdateTime , par_LastUpdateName , par_ProjectId , par_IntroductionPath , par_IntroductionPathVersionNo , par_IntroductionPathSize , par_FaceSlipPath , par_FaceSlipPathVersionNo , par_FaceSlipPathSize , par_FaceSlipFlag , par_IntroductionFlag , par_IntroductionUserId , par_FaceSlipUserId , par_IsSignup , par_BidbondStatus , par_BidbondStartTime , par_BidbondEndTime , par_SignupPerson , par_SignupTime , par_SignupAllowance , par_DocumentStatus , par_DocumentPrice , par_DocumentManager, par_Experts }; try { db.Query("Document_ProjectExpand_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public IList GetDocumentList(ref Pagination pagination, string ddlTenderStartTime, string ddlTenderEndTime, string Province, string City, string County, string txtProjectName, int ddlPurchaseMethod, int unitId) { IList list = new List(); string rowOrderStr = string.Empty; string resultOrderStr = " DocumentUpdateTime desc "; string selectTarget = @" b.ID AS DocumentId,a.ProjectId,(case when a.NoticeType=1 then '' else a.TenderTime end) as TenderTime,(case when a.City='请选择' and a.County='请选择' then a.Province when a.County='请选择' or a.County='其他' then a.City else a.City+a.County ENd) as xmqy,a.ProjectName,c.Name as PurchaseMethodName,b.LastUpdateTime as DocumentUpdateTime "; string fromSouce = " (((Document_ProjectInfo a inner join Document_ProjectDocumentInfo b on a.ProjectId=b.ProjectId and b.UnitId='" + unitId + "') inner join Document_Dictionary c on a.PurchaseMethod=c.Id) left join Document_ProjectExpand d on a.projectId=d.projectId and d.UnitId='" + unitId + "') where 1=1 "; //省 if (!string.IsNullOrEmpty(Province) && Province != "请选择") fromSouce += string.Format(" and a.Province='{0}'", Province); //市 if (!string.IsNullOrEmpty(City) && City != "请选择") fromSouce += string.Format(" and a.City='{0}'", City); //区县 if (!string.IsNullOrEmpty(County) && County != "请选择") fromSouce += string.Format(" and a.County='{0}'", County); //投标时间 if (!string.IsNullOrEmpty(ddlTenderStartTime)) { string Time_String = string.IsNullOrEmpty(ddlTenderStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlTenderStartTime)).Substring(0, 10); fromSouce += string.Format(" and a.TenderTime >='{0}'", Time_String); } //投标时间 if (!string.IsNullOrEmpty(ddlTenderEndTime)) { string Time_String = string.IsNullOrEmpty(ddlTenderEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(ddlTenderEndTime).AddDays(1)).Substring(0, 10); fromSouce += string.Format(" and a.TenderTime <='{0}'", Time_String); } //采购方式 if (ddlPurchaseMethod > 0) fromSouce += string.Format(" and a.PurchaseMethod={0}", ddlPurchaseMethod); //项目名称 if (!string.IsNullOrEmpty(txtProjectName)) fromSouce += string.Format(" and a.ProjectName like '%{0}%'", txtProjectName); list = db.SelectModelPage(ref pagination, selectTarget, fromSouce, " b.LastUpdateTime desc ", resultOrderStr); return list; } public Document_ProjectDocumentInfo GetProjectDocumentInfo(int projectId, int unitId) { Document_ProjectDocumentInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectDocumentInfo "; string condition = " ProjectId=" + projectId + " and UnitId=" + unitId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveProjectDocumentInfo(Document_ProjectDocumentInfo documentInfo) { if (IsExistProjectDocumentInfo(documentInfo.ProjectId.Value, documentInfo.UnitId.Value)) { return UpdateProjectDocumentInfo(documentInfo); } else { return InsertProjectDocumentInfo(documentInfo); } } private bool IsExistProjectDocumentInfo(int projectId, int unitId) { Document_ProjectDocumentInfo model = GetProjectDocumentInfo(projectId, unitId); return model != null; } private bool InsertProjectDocumentInfo(Document_ProjectDocumentInfo documentInfo) { Document_ProjectDocumentInfo trueModel = documentInfo as Document_ProjectDocumentInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_DocumentFlag = null; if (trueModel.DocumentFlag.HasValue) { par_DocumentFlag = new SqlParameter("@DocumentFlag", trueModel.DocumentFlag.Value); } else { par_DocumentFlag = new SqlParameter("@DocumentFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_IsPrint = null; if (trueModel.IsPrint.HasValue) { par_IsPrint = new SqlParameter("@IsPrint", trueModel.IsPrint.Value); } else { par_IsPrint = new SqlParameter("@IsPrint", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } IList sqlParms = new List() { par_ID, par_DocumentFlag , par_UserId , par_ProjectId , par_FilePath , par_FilePathVersionNo , par_FilePathSize , par_IsPrint , par_UnitId , par_LastUpdateTime , par_LastUpdateName }; try { db.Query("Document_ProjectDocumentInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectDocumentInfo(Document_ProjectDocumentInfo documentInfo) { Document_ProjectDocumentInfo trueModel = documentInfo as Document_ProjectDocumentInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_DocumentFlag = null; if (trueModel.DocumentFlag.HasValue) { par_DocumentFlag = new SqlParameter("@DocumentFlag", trueModel.DocumentFlag.Value); } else { par_DocumentFlag = new SqlParameter("@DocumentFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_IsPrint = null; if (trueModel.IsPrint.HasValue) { par_IsPrint = new SqlParameter("@IsPrint", trueModel.IsPrint.Value); } else { par_IsPrint = new SqlParameter("@IsPrint", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } IList sqlParms = new List() { par_ID , par_DocumentFlag , par_UserId , par_ProjectId , par_FilePath , par_FilePathVersionNo , par_FilePathSize , par_IsPrint , par_UnitId , par_LastUpdateTime , par_LastUpdateName }; try { db.Query("Document_ProjectDocumentInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public bool DeleteDocumentModel(int projectId, int unitId) { string sqlStr = "delete from Document_ProjectDocumentInfo where projectId={0} and UnitId={1} "; sqlStr = string.Format(sqlStr, projectId, unitId); try { db.ExecuteSql(sqlStr, null); } catch (Exception ex) { return false; } return true; } public Document_DocumentTempletInfo GetTempletModel(string templetName) { Document_DocumentTempletInfo model = null; string selectTarget = " * "; string fromSouce = " Document_DocumentTempletInfo "; string condition = " TempletName='" + templetName + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public Document_DocumentTempletInfo GetTempletModel(int templetId) { Document_DocumentTempletInfo model = null; string selectTarget = " * "; string fromSouce = " Document_DocumentTempletInfo "; string condition = " TempletId='" + templetId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public Document_DocumentTempletInfo GetTempletModelByProjectId(int projectId) { Document_DocumentTempletInfo model = null; string selectTarget = " * "; string fromSouce = " Document_DocumentTempletInfo "; string condition = " ProjectId='" + projectId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public IList GetDocumentTempletList() { string selectTarget = " * "; string fromSouce = " Document_DocumentTempletInfo "; string condition = string.Empty; IList result = db.SelectModel(selectTarget, fromSouce, condition); return result; } public IList GetDocumentTempletList(ref Pagination pagination, int purchaseMethod, string templetName, int isUsed) { IList list = new List(); string rowOrderStr = " TempletId desc "; string resultOrderStr = string.Empty; string selectTarget = " TempletId,TempletName,TempleSize,TempletPath,IsUsed,(case when IsUsed=1 then '启用' else '停用' end) as isUseName ,(case when IsUsed=1 then '停用' else '启用' end) as isUseOp "; string fromSouce = " Document_DocumentTempletInfo where 1=1 "; if (!string.IsNullOrEmpty(templetName)) { fromSouce += " and TempletName like '%" + templetName + "%' "; } if (isUsed > 0) { if (isUsed == 1) { fromSouce += " and IsUsed=1 "; } else { fromSouce += " and IsUsed=2 "; } } if (purchaseMethod != 0) { fromSouce += " and PurchaseMethod=" + purchaseMethod + ""; } list = db.SelectModelPage(ref pagination, selectTarget, fromSouce, rowOrderStr, resultOrderStr); return list; } public bool SaveTempletModel(Document_DocumentTempletInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_TempletId = null; if (trueModel.TempletId.HasValue) { par_TempletId = new SqlParameter("@TempletId", trueModel.TempletId.Value); } else { par_TempletId = new SqlParameter("@TempletId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_TempletFlag = null; if (trueModel.TempletFlag.HasValue) { par_TempletFlag = new SqlParameter("@TempletFlag", trueModel.TempletFlag.Value); } else { par_TempletFlag = new SqlParameter("@TempletFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_PurchaseMethod = null; if (trueModel.PurchaseMethod.HasValue) { par_PurchaseMethod = new SqlParameter("@PurchaseMethod", trueModel.PurchaseMethod.Value); } else { par_PurchaseMethod = new SqlParameter("@PurchaseMethod", DBNull.Value); } SqlParameter par_TempletName = null; if (!string.IsNullOrEmpty(trueModel.TempletName)) { par_TempletName = new SqlParameter("@TempletName", trueModel.TempletName); } else { par_TempletName = new SqlParameter("@TempletName", ""); } SqlParameter par_TempletPath = null; if (!string.IsNullOrEmpty(trueModel.TempletPath)) { par_TempletPath = new SqlParameter("@TempletPath", trueModel.TempletPath); } else { par_TempletPath = new SqlParameter("@TempletPath", ""); } SqlParameter par_TempleVersionNo = null; if (!string.IsNullOrEmpty(trueModel.TempleVersionNo)) { par_TempleVersionNo = new SqlParameter("@TempleVersionNo", trueModel.TempleVersionNo); } else { par_TempleVersionNo = new SqlParameter("@TempleVersionNo", ""); } SqlParameter par_TempleSize = null; if (trueModel.TempleSize.HasValue) { par_TempleSize = new SqlParameter("@TempleSize", trueModel.TempleSize.Value); } else { par_TempleSize = new SqlParameter("@TempleSize", DBNull.Value); } SqlParameter par_IsUsed = null; if (trueModel.IsUsed.HasValue) { par_IsUsed = new SqlParameter("@IsUsed", trueModel.IsUsed.Value); } else { par_IsUsed = new SqlParameter("@IsUsed", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } IList sqlParms = new List() { par_TempletId , par_LastUpdateTime , par_LastUpdateName , par_TempletFlag , par_UserId , par_PurchaseMethod , par_TempletName , par_TempletPath , par_TempleVersionNo , par_TempleSize , par_IsUsed , par_ProjectId , par_UnitId }; try { if (trueModel.TempletId > 0) { db.Query("Document_DocumentTempletInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { db.Query("Document_DocumentTempletInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } public bool DeleteTempletModel(int templetId) { string sqlStr = "delete from Document_DocumentTempletInfo where templetId='" + templetId + "' "; try { db.ExecuteSql(sqlStr, null); } catch (Exception ex) { return false; } return true; } public IList GetOtherCompanyTenderInfoList(int projectId) { string selectTarget = " * "; string fromSouce = " Document_OtherCompanyTenderInfo "; string condition = " ProjectId=" + projectId; IList result = db.SelectModel(selectTarget, fromSouce, condition); return result; } public Document_OtherCompanyTenderInfo GetOtherCompanyTenderInfo(int projectId, string companyName) { Document_OtherCompanyTenderInfo model = null; string selectTarget = " * "; string fromSouce = " Document_OtherCompanyTenderInfo "; string condition = " ProjectId=" + projectId + " and CompanyName='" + companyName + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveOtherCompanyTenderInfo(Document_OtherCompanyTenderInfo model) { Document_OtherCompanyTenderInfo tempModel = GetOtherCompanyTenderInfo(model.ProjectId.Value, model.CompanyName); if (tempModel == null) { return InsertOtherCompanyTenderInfo(model); } else { return UpdateOtherCompanyTenderInfo(model); } } private bool InsertOtherCompanyTenderInfo(Document_OtherCompanyTenderInfo model) { Document_OtherCompanyTenderInfo trueModel = model as Document_OtherCompanyTenderInfo; if (trueModel == null) { return false; } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_CompanyName = null; if (!string.IsNullOrEmpty(trueModel.CompanyName)) { par_CompanyName = new SqlParameter("@CompanyName", trueModel.CompanyName); } else { par_CompanyName = new SqlParameter("@CompanyName", ""); } SqlParameter par_TenderPrice = null; if (trueModel.TenderPrice.HasValue) { par_TenderPrice = new SqlParameter("@TenderPrice", trueModel.TenderPrice.Value); } else { par_TenderPrice = new SqlParameter("@TenderPrice", DBNull.Value); } IList sqlParms = new List() { par_ProjectId , par_CompanyName , par_TenderPrice }; try { db.Query("Document_OtherCompanyTenderInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateOtherCompanyTenderInfo(Document_OtherCompanyTenderInfo model) { Document_OtherCompanyTenderInfo trueModel = model as Document_OtherCompanyTenderInfo; if (trueModel == null) { return false; } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_CompanyName = null; if (!string.IsNullOrEmpty(trueModel.CompanyName)) { par_CompanyName = new SqlParameter("@CompanyName", trueModel.CompanyName); } else { par_CompanyName = new SqlParameter("@CompanyName", ""); } SqlParameter par_TenderPrice = null; if (trueModel.TenderPrice.HasValue) { par_TenderPrice = new SqlParameter("@TenderPrice", trueModel.TenderPrice.Value); } else { par_TenderPrice = new SqlParameter("@TenderPrice", DBNull.Value); } IList sqlParms = new List() { par_ProjectId , par_CompanyName , par_TenderPrice }; try { db.Query("Document_OtherCompanyTenderInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public bool DeleteOtherCompanyTenderInfo(Document_OtherCompanyTenderInfo model) { string sqlStr = "delete from Document_OtherCompanyTenderInfo where ProjectId={0} and CompanyName='{1}'"; sqlStr = string.Format(sqlStr, model.ProjectId, model.CompanyName); try { db.ExecuteSql(sqlStr, null); } catch (Exception ex) { return false; } return true; } public Document_ProjectOppugnInfo GetProjectOppugnInfo(int projectId, int unitId) { Document_ProjectOppugnInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectOppugnInfo "; string condition = " ProjectId=" + projectId + " and UnitId='" + unitId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveProjectOppugnInfo(Document_ProjectOppugnInfo oppugnInfo) { Document_ProjectOppugnInfo model = GetProjectOppugnInfo(oppugnInfo.ProjectId.Value, oppugnInfo.UnitId.Value); if (model == null) { return InsertProjectOppugnInfo(oppugnInfo); } else { return UpdateProjectOppugnInfo(oppugnInfo); } } private bool InsertProjectOppugnInfo(Document_ProjectOppugnInfo oppugnInfo) { Document_ProjectOppugnInfo trueModel = oppugnInfo as Document_ProjectOppugnInfo; if (trueModel == null) { return false; } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_OppugnFlag = null; if (trueModel.OppugnFlag.HasValue) { par_OppugnFlag = new SqlParameter("@OppugnFlag", trueModel.OppugnFlag.Value); } else { par_OppugnFlag = new SqlParameter("@OppugnFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_OppugnUnit = null; if (!string.IsNullOrEmpty(trueModel.OppugnUnit)) { par_OppugnUnit = new SqlParameter("@OppugnUnit", trueModel.OppugnUnit); } else { par_OppugnUnit = new SqlParameter("@OppugnUnit", ""); } SqlParameter par_OppugnContent = null; if (!string.IsNullOrEmpty(trueModel.OppugnContent)) { par_OppugnContent = new SqlParameter("@OppugnContent", trueModel.OppugnContent); } else { par_OppugnContent = new SqlParameter("@OppugnContent", ""); } SqlParameter par_CopyCount = null; if (trueModel.CopyCount.HasValue) { par_CopyCount = new SqlParameter("@CopyCount", trueModel.CopyCount.Value); } else { par_CopyCount = new SqlParameter("@CopyCount", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } IList sqlParms = new List() { par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_OppugnFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_OppugnUnit , par_OppugnContent , par_CopyCount , par_FilePath , par_FilePathVersionNo , par_FilePathSize }; try { db.Query("Document_ProjectOppugnInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectOppugnInfo(Document_ProjectOppugnInfo oppugnInfo) { Document_ProjectOppugnInfo trueModel = oppugnInfo as Document_ProjectOppugnInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_OppugnFlag = null; if (trueModel.OppugnFlag.HasValue) { par_OppugnFlag = new SqlParameter("@OppugnFlag", trueModel.OppugnFlag.Value); } else { par_OppugnFlag = new SqlParameter("@OppugnFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_OppugnUnit = null; if (!string.IsNullOrEmpty(trueModel.OppugnUnit)) { par_OppugnUnit = new SqlParameter("@OppugnUnit", trueModel.OppugnUnit); } else { par_OppugnUnit = new SqlParameter("@OppugnUnit", ""); } SqlParameter par_OppugnContent = null; if (!string.IsNullOrEmpty(trueModel.OppugnContent)) { par_OppugnContent = new SqlParameter("@OppugnContent", trueModel.OppugnContent); } else { par_OppugnContent = new SqlParameter("@OppugnContent", ""); } SqlParameter par_CopyCount = null; if (trueModel.CopyCount.HasValue) { par_CopyCount = new SqlParameter("@CopyCount", trueModel.CopyCount.Value); } else { par_CopyCount = new SqlParameter("@CopyCount", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } IList sqlParms = new List() { par_ID , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_OppugnFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_OppugnUnit , par_OppugnContent , par_CopyCount , par_FilePath , par_FilePathVersionNo , par_FilePathSize }; try { db.Query("Document_ProjectOppugnInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public Document_ProjectComplainInfo GetProjectComplainInfo(int projectId, int unitId) { Document_ProjectComplainInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectComplainInfo "; string condition = " ProjectId=" + projectId + " and UnitId='" + unitId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveProjectComplainInfo(Document_ProjectComplainInfo complainInfo) { Document_ProjectComplainInfo model = GetProjectComplainInfo(complainInfo.ProjectId.Value, complainInfo.UnitId.Value); if (model == null) { return InsertProjectComplainInfo(complainInfo); } else { return UpdateProjectComplainInfo(complainInfo); } } private bool InsertProjectComplainInfo(Document_ProjectComplainInfo complainInfo) { Document_ProjectComplainInfo trueModel = complainInfo as Document_ProjectComplainInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_ComplainFlag = null; if (trueModel.ComplainFlag.HasValue) { par_ComplainFlag = new SqlParameter("@ComplainFlag", trueModel.ComplainFlag.Value); } else { par_ComplainFlag = new SqlParameter("@ComplainFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ComplainUnit = null; if (!string.IsNullOrEmpty(trueModel.ComplainUnit)) { par_ComplainUnit = new SqlParameter("@ComplainUnit", trueModel.ComplainUnit); } else { par_ComplainUnit = new SqlParameter("@ComplainUnit", ""); } SqlParameter par_IsOppugnBack = null; if (trueModel.IsOppugnBack.HasValue) { par_IsOppugnBack = new SqlParameter("@IsOppugnBack", trueModel.IsOppugnBack.Value); } else { par_IsOppugnBack = new SqlParameter("@IsOppugnBack", DBNull.Value); } SqlParameter par_CopyCount = null; if (trueModel.CopyCount.HasValue) { par_CopyCount = new SqlParameter("@CopyCount", trueModel.CopyCount.Value); } else { par_CopyCount = new SqlParameter("@CopyCount", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } IList sqlParms = new List() { par_ID , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_ComplainFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ComplainUnit , par_IsOppugnBack , par_CopyCount , par_FilePath , par_FilePathVersionNo , par_FilePathSize }; try { db.Query("Document_ProjectComplainInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectComplainInfo(Document_ProjectComplainInfo complainInfo) { Document_ProjectComplainInfo trueModel = complainInfo as Document_ProjectComplainInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_ComplainFlag = null; if (trueModel.ComplainFlag.HasValue) { par_ComplainFlag = new SqlParameter("@ComplainFlag", trueModel.ComplainFlag.Value); } else { par_ComplainFlag = new SqlParameter("@ComplainFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ComplainUnit = null; if (!string.IsNullOrEmpty(trueModel.ComplainUnit)) { par_ComplainUnit = new SqlParameter("@ComplainUnit", trueModel.ComplainUnit); } else { par_ComplainUnit = new SqlParameter("@ComplainUnit", ""); } SqlParameter par_IsOppugnBack = null; if (trueModel.IsOppugnBack.HasValue) { par_IsOppugnBack = new SqlParameter("@IsOppugnBack", trueModel.IsOppugnBack.Value); } else { par_IsOppugnBack = new SqlParameter("@IsOppugnBack", DBNull.Value); } SqlParameter par_CopyCount = null; if (trueModel.CopyCount.HasValue) { par_CopyCount = new SqlParameter("@CopyCount", trueModel.CopyCount.Value); } else { par_CopyCount = new SqlParameter("@CopyCount", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } IList sqlParms = new List() { par_ID , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_ComplainFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ComplainUnit , par_IsOppugnBack , par_CopyCount , par_FilePath , par_FilePathVersionNo , par_FilePathSize }; try { db.Query("Document_ProjectComplainInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public Document_ProjectReviewInfo GetProjectReviewInfo(int projectId, int unitId) { Document_ProjectReviewInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectReviewInfo "; string condition = " ProjectId=" + projectId + " and UnitId='" + unitId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveProjectReviewInfo(Document_ProjectReviewInfo reviewInfo) { Document_ProjectReviewInfo model = GetProjectReviewInfo(reviewInfo.ProjectId.Value, reviewInfo.UnitId.Value); if (model == null) { return InsertProjectReviewInfo(reviewInfo); } else { return UpdateProjectReviewInfo(reviewInfo); } } private bool InsertProjectReviewInfo(Document_ProjectReviewInfo model) { Document_ProjectReviewInfo trueModel = model as Document_ProjectReviewInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_ReviewFlag = null; if (trueModel.ReviewFlag.HasValue) { par_ReviewFlag = new SqlParameter("@ReviewFlag", trueModel.ReviewFlag.Value); } else { par_ReviewFlag = new SqlParameter("@ReviewFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ApplyedPerson = null; if (!string.IsNullOrEmpty(trueModel.ApplyedPerson)) { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", trueModel.ApplyedPerson); } else { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", ""); } SqlParameter par_Manager = null; if (!string.IsNullOrEmpty(trueModel.Manager)) { par_Manager = new SqlParameter("@Manager", trueModel.Manager); } else { par_Manager = new SqlParameter("@Manager", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_ReviewUnit = null; if (!string.IsNullOrEmpty(trueModel.ReviewUnit)) { par_ReviewUnit = new SqlParameter("@ReviewUnit", trueModel.ReviewUnit); } else { par_ReviewUnit = new SqlParameter("@ReviewUnit", ""); } IList sqlParms = new List() { par_ID , par_FilePath , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_ReviewFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ApplyedPerson , par_Manager , par_Job , par_Address , par_Phone , par_ReviewUnit }; try { db.Query("Document_ProjectReviewInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectReviewInfo(Document_ProjectReviewInfo model) { Document_ProjectReviewInfo trueModel = model as Document_ProjectReviewInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_ReviewFlag = null; if (trueModel.ReviewFlag.HasValue) { par_ReviewFlag = new SqlParameter("@ReviewFlag", trueModel.ReviewFlag.Value); } else { par_ReviewFlag = new SqlParameter("@ReviewFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ApplyedPerson = null; if (!string.IsNullOrEmpty(trueModel.ApplyedPerson)) { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", trueModel.ApplyedPerson); } else { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", ""); } SqlParameter par_Manager = null; if (!string.IsNullOrEmpty(trueModel.Manager)) { par_Manager = new SqlParameter("@Manager", trueModel.Manager); } else { par_Manager = new SqlParameter("@Manager", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_ReviewUnit = null; if (!string.IsNullOrEmpty(trueModel.ReviewUnit)) { par_ReviewUnit = new SqlParameter("@ReviewUnit", trueModel.ReviewUnit); } else { par_ReviewUnit = new SqlParameter("@ReviewUnit", ""); } IList sqlParms = new List() { par_ID , par_FilePath , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_ReviewFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ApplyedPerson , par_Manager , par_Job , par_Address , par_Phone , par_ReviewUnit }; try { db.Query("Document_ProjectReviewInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public Document_ProjectLitigationInfo GetProjectLitigationInfo(int projectId, int unitId) { Document_ProjectLitigationInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectLitigationInfo "; string condition = " ProjectId=" + projectId + " and UnitId='" + unitId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveProjectLitigationInfo(Document_ProjectLitigationInfo litigationInfo) { Document_ProjectLitigationInfo model = GetProjectLitigationInfo(litigationInfo.ProjectId.Value, litigationInfo.UnitId.Value); if (model == null) { return InsertProjectLitigationInfo(litigationInfo); } else { return UpdateProjectLitigationInfo(litigationInfo); } } private bool InsertProjectLitigationInfo(Document_ProjectLitigationInfo model) { Document_ProjectLitigationInfo trueModel = model as Document_ProjectLitigationInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LitigationFlag = null; if (trueModel.LitigationFlag.HasValue) { par_LitigationFlag = new SqlParameter("@LitigationFlag", trueModel.LitigationFlag.Value); } else { par_LitigationFlag = new SqlParameter("@LitigationFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ApplyedPerson = null; if (!string.IsNullOrEmpty(trueModel.ApplyedPerson)) { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", trueModel.ApplyedPerson); } else { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", ""); } SqlParameter par_Manager = null; if (!string.IsNullOrEmpty(trueModel.Manager)) { par_Manager = new SqlParameter("@Manager", trueModel.Manager); } else { par_Manager = new SqlParameter("@Manager", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_LitigationUnit = null; if (!string.IsNullOrEmpty(trueModel.LitigationUnit)) { par_LitigationUnit = new SqlParameter("@LitigationUnit", trueModel.LitigationUnit); } else { par_LitigationUnit = new SqlParameter("@LitigationUnit", ""); } IList sqlParms = new List() { par_ID , par_FilePath , par_FilePathVersionNo , par_FilePathSize , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_LitigationFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ApplyedPerson , par_Manager , par_Job , par_Address , par_Phone , par_LitigationUnit }; try { db.Query("Document_ProjectLitigationInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectLitigationInfo(Document_ProjectLitigationInfo model) { Document_ProjectLitigationInfo trueModel = model as Document_ProjectLitigationInfo; if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LitigationFlag = null; if (trueModel.LitigationFlag.HasValue) { par_LitigationFlag = new SqlParameter("@LitigationFlag", trueModel.LitigationFlag.Value); } else { par_LitigationFlag = new SqlParameter("@LitigationFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ApplyedPerson = null; if (!string.IsNullOrEmpty(trueModel.ApplyedPerson)) { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", trueModel.ApplyedPerson); } else { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", ""); } SqlParameter par_Manager = null; if (!string.IsNullOrEmpty(trueModel.Manager)) { par_Manager = new SqlParameter("@Manager", trueModel.Manager); } else { par_Manager = new SqlParameter("@Manager", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_LitigationUnit = null; if (!string.IsNullOrEmpty(trueModel.LitigationUnit)) { par_LitigationUnit = new SqlParameter("@LitigationUnit", trueModel.LitigationUnit); } else { par_LitigationUnit = new SqlParameter("@LitigationUnit", ""); } IList sqlParms = new List() { par_ID , par_FilePath , par_FilePathVersionNo , par_FilePathSize , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_LitigationFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ApplyedPerson , par_Manager , par_Job , par_Address , par_Phone , par_LitigationUnit }; try { db.Query("Document_ProjectLitigationInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 获取建议书 /// /// /// /// public Document_AdviseInfo GetProjectAdviseInfo(int projectId, int unitId) { Document_AdviseInfo model = null; string selectTarget = " * "; string fromSouce = " Document_AdviseInfo "; string condition = " ProjectId=" + projectId + " and UnitId='" + unitId + "'"; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } /// /// 保存建议书 /// /// /// public bool SaveProjectAdviseInfo(Document_AdviseInfo adviseInfo) { Document_AdviseInfo model = GetProjectAdviseInfo(adviseInfo.ProjectId.Value, adviseInfo.UnitId.Value); if (model == null) { return InsertProjectAdviseInfo(adviseInfo); } else { return UpdateProjectAdviseInfo(adviseInfo); } } private bool InsertProjectAdviseInfo(Document_AdviseInfo adviseInfo) { Document_AdviseInfo trueModel = adviseInfo as Document_AdviseInfo; if (trueModel == null) { return false; } SqlParameter par_Id = null; if (trueModel.Id.HasValue) { par_Id = new SqlParameter("@Id", trueModel.Id.Value); } else { par_Id = new SqlParameter("@Id", DBNull.Value); } SqlParameter par_FilePathVerisonNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVerisonNo)) { par_FilePathVerisonNo = new SqlParameter("@FilePathVerisonNo", trueModel.FilePathVerisonNo); } else { par_FilePathVerisonNo = new SqlParameter("@FilePathVerisonNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_IsAdvise = null; if (trueModel.IsAdvise.HasValue) { par_IsAdvise = new SqlParameter("@IsAdvise", trueModel.IsAdvise.Value); } else { par_IsAdvise = new SqlParameter("@IsAdvise", DBNull.Value); } SqlParameter par_AdvicePerson = null; if (!string.IsNullOrEmpty(trueModel.AdvicePerson)) { par_AdvicePerson = new SqlParameter("@AdvicePerson", trueModel.AdvicePerson); } else { par_AdvicePerson = new SqlParameter("@AdvicePerson", ""); } SqlParameter par_IsAdviceBack = null; if (trueModel.IsAdviceBack.HasValue) { par_IsAdviceBack = new SqlParameter("@IsAdviceBack", trueModel.IsAdviceBack.Value); } else { par_IsAdviceBack = new SqlParameter("@IsAdviceBack", DBNull.Value); } SqlParameter par_AdviceBackMethod = null; if (!string.IsNullOrEmpty(trueModel.AdviceBackMethod)) { par_AdviceBackMethod = new SqlParameter("@AdviceBackMethod", trueModel.AdviceBackMethod); } else { par_AdviceBackMethod = new SqlParameter("@AdviceBackMethod", ""); } SqlParameter par_AdviseReceiveUnit = null; if (!string.IsNullOrEmpty(trueModel.AdviseReceiveUnit)) { par_AdviseReceiveUnit = new SqlParameter("@AdviseReceiveUnit", trueModel.AdviseReceiveUnit); } else { par_AdviseReceiveUnit = new SqlParameter("@AdviseReceiveUnit", ""); } SqlParameter par_AdviseCCUnits = null; if (!string.IsNullOrEmpty(trueModel.AdviseCCUnits)) { par_AdviseCCUnits = new SqlParameter("@AdviseCCUnits", trueModel.AdviseCCUnits); } else { par_AdviseCCUnits = new SqlParameter("@AdviseCCUnits", ""); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } IList sqlParms = new List() { par_Id , par_FilePathVerisonNo , par_FilePathSize , par_UnitId , par_LastUpdateTime , par_LastUpdateName , par_AdviseFlag , par_UserId , par_ProjectId , par_IsAdvise , par_AdvicePerson , par_IsAdviceBack , par_AdviceBackMethod , par_AdviseReceiveUnit , par_AdviseCCUnits , par_FilePath }; try { db.Query("Document_AdviseInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } private bool UpdateProjectAdviseInfo(Document_AdviseInfo adviseInfo) { Document_AdviseInfo trueModel = adviseInfo as Document_AdviseInfo; if (trueModel == null) { return false; } SqlParameter par_Id = null; if (trueModel.Id.HasValue) { par_Id = new SqlParameter("@Id", trueModel.Id.Value); } else { par_Id = new SqlParameter("@Id", DBNull.Value); } SqlParameter par_FilePathVerisonNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVerisonNo)) { par_FilePathVerisonNo = new SqlParameter("@FilePathVerisonNo", trueModel.FilePathVerisonNo); } else { par_FilePathVerisonNo = new SqlParameter("@FilePathVerisonNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_IsAdvise = null; if (trueModel.IsAdvise.HasValue) { par_IsAdvise = new SqlParameter("@IsAdvise", trueModel.IsAdvise.Value); } else { par_IsAdvise = new SqlParameter("@IsAdvise", DBNull.Value); } SqlParameter par_AdvicePerson = null; if (!string.IsNullOrEmpty(trueModel.AdvicePerson)) { par_AdvicePerson = new SqlParameter("@AdvicePerson", trueModel.AdvicePerson); } else { par_AdvicePerson = new SqlParameter("@AdvicePerson", ""); } SqlParameter par_IsAdviceBack = null; if (trueModel.IsAdviceBack.HasValue) { par_IsAdviceBack = new SqlParameter("@IsAdviceBack", trueModel.IsAdviceBack.Value); } else { par_IsAdviceBack = new SqlParameter("@IsAdviceBack", DBNull.Value); } SqlParameter par_AdviceBackMethod = null; if (!string.IsNullOrEmpty(trueModel.AdviceBackMethod)) { par_AdviceBackMethod = new SqlParameter("@AdviceBackMethod", trueModel.AdviceBackMethod); } else { par_AdviceBackMethod = new SqlParameter("@AdviceBackMethod", ""); } SqlParameter par_AdviseReceiveUnit = null; if (!string.IsNullOrEmpty(trueModel.AdviseReceiveUnit)) { par_AdviseReceiveUnit = new SqlParameter("@AdviseReceiveUnit", trueModel.AdviseReceiveUnit); } else { par_AdviseReceiveUnit = new SqlParameter("@AdviseReceiveUnit", ""); } SqlParameter par_AdviseCCUnits = null; if (!string.IsNullOrEmpty(trueModel.AdviseCCUnits)) { par_AdviseCCUnits = new SqlParameter("@AdviseCCUnits", trueModel.AdviseCCUnits); } else { par_AdviseCCUnits = new SqlParameter("@AdviseCCUnits", ""); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } IList sqlParms = new List() { par_Id , par_FilePathVerisonNo , par_FilePathSize , par_UnitId , par_LastUpdateTime , par_LastUpdateName , par_AdviseFlag , par_UserId , par_ProjectId , par_IsAdvise , par_AdvicePerson , par_IsAdviceBack , par_AdviceBackMethod , par_AdviseReceiveUnit , par_AdviseCCUnits , par_FilePath }; try { db.Query("Document_AdviseInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } public Document_ProjectOppugnInfo GetDocument_ProjectOppugnInfo(int projectId, int unitId) { Document_ProjectOppugnInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectOppugnInfo "; string condition = " ProjectId=" + projectId + " and UnitId=" + unitId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public Document_ProjectComplainInfo GetDocument_ProjectComplainInfo(int projectId, int unitId) { Document_ProjectComplainInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectComplainInfo "; string condition = " ProjectId=" + projectId + " and UnitId=" + unitId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public Document_ProjectReviewInfo GetDocument_ProjectReviewInfo(int projectId, int unitId) { Document_ProjectReviewInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectReviewInfo "; string condition = " ProjectId=" + projectId + " and UnitId=" + unitId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public Document_ProjectLitigationInfo GetDocument_ProjectLitigationInfo(int projectId, int unitId) { Document_ProjectLitigationInfo model = null; string selectTarget = " * "; string fromSouce = " Document_ProjectLitigationInfo "; string condition = " ProjectId=" + projectId + " and UnitId=" + unitId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public Document_WinInfo GetDocument_WinInfo(int projectId, int unitId) { Document_WinInfo model = null; string selectTarget = " * "; string fromSouce = " Document_WinInfo "; string condition = " ProjectId=" + projectId; IList result = db.SelectModel(selectTarget, fromSouce, condition); if (result != null && result.Count > 0) { model = result[0]; } return model; } public bool SaveDocument_ProjectOppugnInfo(Document_ProjectOppugnInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_OppugnFlag = null; if (trueModel.OppugnFlag.HasValue) { par_OppugnFlag = new SqlParameter("@OppugnFlag", trueModel.OppugnFlag.Value); } else { par_OppugnFlag = new SqlParameter("@OppugnFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_OppugnUnit = null; if (!string.IsNullOrEmpty(trueModel.OppugnUnit)) { par_OppugnUnit = new SqlParameter("@OppugnUnit", trueModel.OppugnUnit); } else { par_OppugnUnit = new SqlParameter("@OppugnUnit", ""); } SqlParameter par_OppugnContent = null; if (!string.IsNullOrEmpty(trueModel.OppugnContent)) { par_OppugnContent = new SqlParameter("@OppugnContent", trueModel.OppugnContent); } else { par_OppugnContent = new SqlParameter("@OppugnContent", ""); } SqlParameter par_CopyCount = null; if (trueModel.CopyCount.HasValue) { par_CopyCount = new SqlParameter("@CopyCount", trueModel.CopyCount.Value); } else { par_CopyCount = new SqlParameter("@CopyCount", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } IList sqlParms = new List() { par_ID , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_OppugnFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_OppugnUnit , par_OppugnContent , par_CopyCount , par_FilePath , par_FilePathVersionNo , par_FilePathSize }; try { if (IsExistDocument_ProjectOppugnInfo(trueModel.ProjectId.Value, trueModel.UnitId.Value)) { db.Query("Document_ProjectOppugnInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_ProjectOppugnInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } public bool SaveDocument_ProjectComplainInfo(Document_ProjectComplainInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_ComplainFlag = null; if (trueModel.ComplainFlag.HasValue) { par_ComplainFlag = new SqlParameter("@ComplainFlag", trueModel.ComplainFlag.Value); } else { par_ComplainFlag = new SqlParameter("@ComplainFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ComplainUnit = null; if (!string.IsNullOrEmpty(trueModel.ComplainUnit)) { par_ComplainUnit = new SqlParameter("@ComplainUnit", trueModel.ComplainUnit); } else { par_ComplainUnit = new SqlParameter("@ComplainUnit", ""); } SqlParameter par_IsOppugnBack = null; if (trueModel.IsOppugnBack.HasValue) { par_IsOppugnBack = new SqlParameter("@IsOppugnBack", trueModel.IsOppugnBack.Value); } else { par_IsOppugnBack = new SqlParameter("@IsOppugnBack", DBNull.Value); } SqlParameter par_CopyCount = null; if (trueModel.CopyCount.HasValue) { par_CopyCount = new SqlParameter("@CopyCount", trueModel.CopyCount.Value); } else { par_CopyCount = new SqlParameter("@CopyCount", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } IList sqlParms = new List() { par_ID , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_ComplainFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ComplainUnit , par_IsOppugnBack , par_CopyCount , par_FilePath , par_FilePathVersionNo , par_FilePathSize }; try { if (IsExistDocument_ProjectComplainInfo(trueModel.ProjectId.Value, trueModel.UnitId.Value)) { db.Query("Document_ProjectComplainInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_ProjectComplainInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } public bool SaveDocument_ProjectReviewInfo(Document_ProjectReviewInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_ReviewFlag = null; if (trueModel.ReviewFlag.HasValue) { par_ReviewFlag = new SqlParameter("@ReviewFlag", trueModel.ReviewFlag.Value); } else { par_ReviewFlag = new SqlParameter("@ReviewFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ApplyedPerson = null; if (!string.IsNullOrEmpty(trueModel.ApplyedPerson)) { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", trueModel.ApplyedPerson); } else { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", ""); } SqlParameter par_Manager = null; if (!string.IsNullOrEmpty(trueModel.Manager)) { par_Manager = new SqlParameter("@Manager", trueModel.Manager); } else { par_Manager = new SqlParameter("@Manager", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_ReviewUnit = null; if (!string.IsNullOrEmpty(trueModel.ReviewUnit)) { par_ReviewUnit = new SqlParameter("@ReviewUnit", trueModel.ReviewUnit); } else { par_ReviewUnit = new SqlParameter("@ReviewUnit", ""); } IList sqlParms = new List() { par_ID , par_FilePath , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_ReviewFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ApplyedPerson , par_Manager , par_Job , par_Address , par_Phone , par_ReviewUnit }; try { if (IsExistDocument_ProjectReviewInfo(trueModel.ProjectId.Value, trueModel.UnitId.Value)) { db.Query("Document_ProjectReviewInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_ProjectReviewInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } public bool SaveDocument_ProjectLitigationInfo(Document_ProjectLitigationInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_ID = null; if (trueModel.ID.HasValue) { par_ID = new SqlParameter("@ID", trueModel.ID.Value); } else { par_ID = new SqlParameter("@ID", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FilePathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FilePathVersionNo)) { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", trueModel.FilePathVersionNo); } else { par_FilePathVersionNo = new SqlParameter("@FilePathVersionNo", ""); } SqlParameter par_FilePathSize = null; if (trueModel.FilePathSize.HasValue) { par_FilePathSize = new SqlParameter("@FilePathSize", trueModel.FilePathSize.Value); } else { par_FilePathSize = new SqlParameter("@FilePathSize", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LitigationFlag = null; if (trueModel.LitigationFlag.HasValue) { par_LitigationFlag = new SqlParameter("@LitigationFlag", trueModel.LitigationFlag.Value); } else { par_LitigationFlag = new SqlParameter("@LitigationFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_DelegatePerson = null; if (!string.IsNullOrEmpty(trueModel.DelegatePerson)) { par_DelegatePerson = new SqlParameter("@DelegatePerson", trueModel.DelegatePerson); } else { par_DelegatePerson = new SqlParameter("@DelegatePerson", ""); } SqlParameter par_ApplyedPerson = null; if (!string.IsNullOrEmpty(trueModel.ApplyedPerson)) { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", trueModel.ApplyedPerson); } else { par_ApplyedPerson = new SqlParameter("@ApplyedPerson", ""); } SqlParameter par_Manager = null; if (!string.IsNullOrEmpty(trueModel.Manager)) { par_Manager = new SqlParameter("@Manager", trueModel.Manager); } else { par_Manager = new SqlParameter("@Manager", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_LitigationUnit = null; if (!string.IsNullOrEmpty(trueModel.LitigationUnit)) { par_LitigationUnit = new SqlParameter("@LitigationUnit", trueModel.LitigationUnit); } else { par_LitigationUnit = new SqlParameter("@LitigationUnit", ""); } IList sqlParms = new List() { par_ID , par_FilePath , par_FilePathVersionNo , par_FilePathSize , par_LastUpdateTime , par_LastUpdateName , par_UnitId , par_LitigationFlag , par_UserId , par_ProjectId , par_DelegatePerson , par_ApplyedPerson , par_Manager , par_Job , par_Address , par_Phone , par_LitigationUnit }; try { if (IsExistDocument_ProjectLitigationInfo(trueModel.ProjectId.Value, trueModel.UnitId.Value)) { db.Query("Document_ProjectLitigationInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_ProjectLitigationInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } public bool SaveDocument_WinInfo(Document_WinInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_IsWin = null; if (trueModel.IsWin.HasValue) { par_IsWin = new SqlParameter("@IsWin", trueModel.IsWin.Value); } else { par_IsWin = new SqlParameter("@IsWin", DBNull.Value); } SqlParameter par_WinPrice = null; if (trueModel.WinPrice.HasValue) { par_WinPrice = new SqlParameter("@WinPrice", trueModel.WinPrice.Value); } else { par_WinPrice = new SqlParameter("@WinPrice", DBNull.Value); } SqlParameter par_FirstWinCompany = null; if (!string.IsNullOrEmpty(trueModel.FirstWinCompany)) { par_FirstWinCompany = new SqlParameter("@FirstWinCompany", trueModel.FirstWinCompany); } else { par_FirstWinCompany = new SqlParameter("@FirstWinCompany", ""); } SqlParameter par_FirstPrice = null; if (trueModel.FirstPrice.HasValue) { par_FirstPrice = new SqlParameter("@FirstPrice", trueModel.FirstPrice.Value); } else { par_FirstPrice = new SqlParameter("@FirstPrice", DBNull.Value); } SqlParameter par_SecondWinCompany = null; if (!string.IsNullOrEmpty(trueModel.SecondWinCompany)) { par_SecondWinCompany = new SqlParameter("@SecondWinCompany", trueModel.SecondWinCompany); } else { par_SecondWinCompany = new SqlParameter("@SecondWinCompany", ""); } SqlParameter par_SecondPrice = null; if (trueModel.SecondPrice.HasValue) { par_SecondPrice = new SqlParameter("@SecondPrice", trueModel.SecondPrice.Value); } else { par_SecondPrice = new SqlParameter("@SecondPrice", DBNull.Value); } SqlParameter par_ThirdCompany = null; if (!string.IsNullOrEmpty(trueModel.ThirdCompany)) { par_ThirdCompany = new SqlParameter("@ThirdCompany", trueModel.ThirdCompany); } else { par_ThirdCompany = new SqlParameter("@ThirdCompany", ""); } SqlParameter par_ThirdPrice = null; if (trueModel.ThirdPrice.HasValue) { par_ThirdPrice = new SqlParameter("@ThirdPrice", trueModel.ThirdPrice.Value); } else { par_ThirdPrice = new SqlParameter("@ThirdPrice", DBNull.Value); } IList sqlParms = new List() { par_ProjectId , par_IsWin , par_WinPrice , par_FirstWinCompany , par_FirstPrice , par_SecondWinCompany , par_SecondPrice , par_ThirdCompany , par_ThirdPrice }; try { if (IsExistDocument_WinInfo(trueModel.ProjectId.Value)) { db.Query("Document_WinInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_WinInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } public bool IsExistDocument_ProjectOppugnInfo(int projectId, int unitId) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_ProjectOppugnInfo where projectId={0} and UnitId={1} "; sqlStr = string.Format(sqlStr, projectId, unitId); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } public bool IsExistDocument_ProjectComplainInfo(int projectId, int unitId) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_ProjectComplainInfo where projectId={0} and UnitId={1} "; sqlStr = string.Format(sqlStr, projectId, unitId); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } public bool IsExistDocument_ProjectReviewInfo(int projectId, int unitId) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_ProjectReviewInfo where projectId={0} and UnitId={1} "; sqlStr = string.Format(sqlStr, projectId, unitId); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } public bool IsExistDocument_ProjectLitigationInfo(int projectId, int unitId) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_ProjectLitigationInfo where projectId={0} and UnitId={1} "; sqlStr = string.Format(sqlStr, projectId, unitId); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } public bool IsExistDocument_WinInfo(int projectId) { bool isExist = false; DataTable dt = new DataTable(); string sqlStr = string.Empty; sqlStr = "select * from Document_WinInfo where projectId={0}"; sqlStr = string.Format(sqlStr, projectId); dt = db.QueryDataTable(sqlStr, CommandType.Text, null); if (dt != null && dt.Rows.Count > 0) { isExist = true; } return isExist; } /// /// 投标单位分页查询 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IList GetTenderUnitList(ref Pagination pagination, string _UnitName, int _IsUsed) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(_UnitName)) condition += " and UnitName like '%" + _UnitName + "%' "; if (_IsUsed > 0) condition += " and IsUsed = '" + _IsUsed + "' "; return db.SelectModelPage(ref pagination, " * ", " Document_TenderUnit ", " UnitId desc", " UnitId desc ", condition); } catch (Exception ex) { return null; } } /// /// 获取单个投标单位 /// /// /// public Document_TenderUnit GetTenderUnit(int unitId) { try { if (unitId == null || unitId < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_TenderUnit ", string.Format(" UnitId='{0}'", unitId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 修改投标单位 /// /// /// public bool SaveTenderUnit(Document_TenderUnit trueModel) { if (trueModel == null) { return false; } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_OrgStructure = null; if (!string.IsNullOrEmpty(trueModel.OrgStructure)) { par_OrgStructure = new SqlParameter("@OrgStructure", trueModel.OrgStructure); } else { par_OrgStructure = new SqlParameter("@OrgStructure", ""); } SqlParameter par_Corporater = null; if (!string.IsNullOrEmpty(trueModel.Corporater)) { par_Corporater = new SqlParameter("@Corporater", trueModel.Corporater); } else { par_Corporater = new SqlParameter("@Corporater", ""); } SqlParameter par_CorporaterPost = null; if (!string.IsNullOrEmpty(trueModel.CorporaterPost)) { par_CorporaterPost = new SqlParameter("@CorporaterPost", trueModel.CorporaterPost); } else { par_CorporaterPost = new SqlParameter("@CorporaterPost", ""); } SqlParameter par_CorporaterTechnicalPost = null; if (!string.IsNullOrEmpty(trueModel.CorporaterTechnicalPost)) { par_CorporaterTechnicalPost = new SqlParameter("@CorporaterTechnicalPost", trueModel.CorporaterTechnicalPost); } else { par_CorporaterTechnicalPost = new SqlParameter("@CorporaterTechnicalPost", ""); } SqlParameter par_CorporatePhone = null; if (!string.IsNullOrEmpty(trueModel.CorporatePhone)) { par_CorporatePhone = new SqlParameter("@CorporatePhone", trueModel.CorporatePhone); } else { par_CorporatePhone = new SqlParameter("@CorporatePhone", ""); } SqlParameter par_TechnicalLeader = null; if (!string.IsNullOrEmpty(trueModel.TechnicalLeader)) { par_TechnicalLeader = new SqlParameter("@TechnicalLeader", trueModel.TechnicalLeader); } else { par_TechnicalLeader = new SqlParameter("@TechnicalLeader", ""); } SqlParameter par_TechnicalPost = null; if (!string.IsNullOrEmpty(trueModel.TechnicalPost)) { par_TechnicalPost = new SqlParameter("@TechnicalPost", trueModel.TechnicalPost); } else { par_TechnicalPost = new SqlParameter("@TechnicalPost", ""); } SqlParameter par_TechnicalPhone = null; if (!string.IsNullOrEmpty(trueModel.TechnicalPhone)) { par_TechnicalPhone = new SqlParameter("@TechnicalPhone", trueModel.TechnicalPhone); } else { par_TechnicalPhone = new SqlParameter("@TechnicalPhone", ""); } SqlParameter par_CreatTime = null; if (!string.IsNullOrEmpty(trueModel.CreatTime)) { par_CreatTime = new SqlParameter("@CreatTime", trueModel.CreatTime); } else { par_CreatTime = new SqlParameter("@CreatTime", ""); } SqlParameter par_StaffCount = null; if (!string.IsNullOrEmpty(trueModel.StaffCount)) { par_StaffCount = new SqlParameter("@StaffCount", trueModel.StaffCount); } else { par_StaffCount = new SqlParameter("@StaffCount", ""); } SqlParameter par_UnitName = null; if (!string.IsNullOrEmpty(trueModel.UnitName)) { par_UnitName = new SqlParameter("@UnitName", trueModel.UnitName); } else { par_UnitName = new SqlParameter("@UnitName", ""); } SqlParameter par_FirmQualificationLevel = null; if (!string.IsNullOrEmpty(trueModel.FirmQualificationLevel)) { par_FirmQualificationLevel = new SqlParameter("@FirmQualificationLevel", trueModel.FirmQualificationLevel); } else { par_FirmQualificationLevel = new SqlParameter("@FirmQualificationLevel", ""); } SqlParameter par_BusinessLicense = null; if (!string.IsNullOrEmpty(trueModel.BusinessLicense)) { par_BusinessLicense = new SqlParameter("@BusinessLicense", trueModel.BusinessLicense); } else { par_BusinessLicense = new SqlParameter("@BusinessLicense", ""); } SqlParameter par_RegMoney = null; if (!string.IsNullOrEmpty(trueModel.RegMoney)) { par_RegMoney = new SqlParameter("@RegMoney", trueModel.RegMoney); } else { par_RegMoney = new SqlParameter("@RegMoney", ""); } SqlParameter par_OpenBank = null; if (!string.IsNullOrEmpty(trueModel.OpenBank)) { par_OpenBank = new SqlParameter("@OpenBank", trueModel.OpenBank); } else { par_OpenBank = new SqlParameter("@OpenBank", ""); } SqlParameter par_BankNum = null; if (!string.IsNullOrEmpty(trueModel.BankNum)) { par_BankNum = new SqlParameter("@BankNum", trueModel.BankNum); } else { par_BankNum = new SqlParameter("@BankNum", ""); } SqlParameter par_ProjectManager = null; if (!string.IsNullOrEmpty(trueModel.ProjectManager)) { par_ProjectManager = new SqlParameter("@ProjectManager", trueModel.ProjectManager); } else { par_ProjectManager = new SqlParameter("@ProjectManager", ""); } SqlParameter par_SeniorStaff = null; if (!string.IsNullOrEmpty(trueModel.SeniorStaff)) { par_SeniorStaff = new SqlParameter("@SeniorStaff", trueModel.SeniorStaff); } else { par_SeniorStaff = new SqlParameter("@SeniorStaff", ""); } SqlParameter par_MiddleStaff = null; if (!string.IsNullOrEmpty(trueModel.MiddleStaff)) { par_MiddleStaff = new SqlParameter("@MiddleStaff", trueModel.MiddleStaff); } else { par_MiddleStaff = new SqlParameter("@MiddleStaff", ""); } SqlParameter par_PrimaryStaff = null; if (!string.IsNullOrEmpty(trueModel.PrimaryStaff)) { par_PrimaryStaff = new SqlParameter("@PrimaryStaff", trueModel.PrimaryStaff); } else { par_PrimaryStaff = new SqlParameter("@PrimaryStaff", ""); } SqlParameter par_Mechanicer = null; if (!string.IsNullOrEmpty(trueModel.Mechanicer)) { par_Mechanicer = new SqlParameter("@Mechanicer", trueModel.Mechanicer); } else { par_Mechanicer = new SqlParameter("@Mechanicer", ""); } SqlParameter par_UnitType = null; if (!string.IsNullOrEmpty(trueModel.UnitType)) { par_UnitType = new SqlParameter("@UnitType", trueModel.UnitType); } else { par_UnitType = new SqlParameter("@UnitType", ""); } SqlParameter par_BusinessContent = null; if (!string.IsNullOrEmpty(trueModel.BusinessContent)) { par_BusinessContent = new SqlParameter("@BusinessContent", trueModel.BusinessContent); } else { par_BusinessContent = new SqlParameter("@BusinessContent", ""); } SqlParameter par_Remark = null; if (!string.IsNullOrEmpty(trueModel.Remark)) { par_Remark = new SqlParameter("@Remark", trueModel.Remark); } else { par_Remark = new SqlParameter("@Remark", ""); } SqlParameter par_UnitLogo = null; if (!string.IsNullOrEmpty(trueModel.UnitLogo)) { par_UnitLogo = new SqlParameter("@UnitLogo", trueModel.UnitLogo); } else { par_UnitLogo = new SqlParameter("@UnitLogo", ""); } SqlParameter par_UnitLogoVersionNo = null; if (!string.IsNullOrEmpty(trueModel.UnitLogoVersionNo)) { par_UnitLogoVersionNo = new SqlParameter("@UnitLogoVersionNo", trueModel.UnitLogoVersionNo); } else { par_UnitLogoVersionNo = new SqlParameter("@UnitLogoVersionNo", ""); } SqlParameter par_UnitLogoSize = null; if (trueModel.UnitLogoSize.HasValue) { par_UnitLogoSize = new SqlParameter("@UnitLogoSize", trueModel.UnitLogoSize.Value); } else { par_UnitLogoSize = new SqlParameter("@UnitLogoSize", DBNull.Value); } SqlParameter par_CardPositive = null; if (!string.IsNullOrEmpty(trueModel.CardPositive)) { par_CardPositive = new SqlParameter("@CardPositive", trueModel.CardPositive); } else { par_CardPositive = new SqlParameter("@CardPositive", ""); } SqlParameter par_CardPositiveVersionNo = null; if (!string.IsNullOrEmpty(trueModel.CardPositiveVersionNo)) { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", trueModel.CardPositiveVersionNo); } else { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", ""); } SqlParameter par_CardPositiveSize = null; if (trueModel.CardPositiveSize.HasValue) { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", trueModel.CardPositiveSize.Value); } else { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", DBNull.Value); } SqlParameter par_IsUsed = null; if (trueModel.IsUsed.HasValue) { par_IsUsed = new SqlParameter("@IsUsed", trueModel.IsUsed.Value); } else { par_IsUsed = new SqlParameter("@IsUsed", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_Address = null; if (!string.IsNullOrEmpty(trueModel.Address)) { par_Address = new SqlParameter("@Address", trueModel.Address); } else { par_Address = new SqlParameter("@Address", ""); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_ZipCode = null; if (!string.IsNullOrEmpty(trueModel.ZipCode)) { par_ZipCode = new SqlParameter("@ZipCode", trueModel.ZipCode); } else { par_ZipCode = new SqlParameter("@ZipCode", ""); } SqlParameter par_ContactPerson = null; if (!string.IsNullOrEmpty(trueModel.ContactPerson)) { par_ContactPerson = new SqlParameter("@ContactPerson", trueModel.ContactPerson); } else { par_ContactPerson = new SqlParameter("@ContactPerson", ""); } SqlParameter par_ContactPhone = null; if (!string.IsNullOrEmpty(trueModel.ContactPhone)) { par_ContactPhone = new SqlParameter("@ContactPhone", trueModel.ContactPhone); } else { par_ContactPhone = new SqlParameter("@ContactPhone", ""); } SqlParameter par_Fax = null; if (!string.IsNullOrEmpty(trueModel.Fax)) { par_Fax = new SqlParameter("@Fax", trueModel.Fax); } else { par_Fax = new SqlParameter("@Fax", ""); } SqlParameter par_WebUrl = null; if (!string.IsNullOrEmpty(trueModel.WebUrl)) { par_WebUrl = new SqlParameter("@WebUrl", trueModel.WebUrl); } else { par_WebUrl = new SqlParameter("@WebUrl", ""); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { par_UnitId , par_OrgStructure , par_Corporater , par_CorporaterPost , par_CorporaterTechnicalPost , par_CorporatePhone , par_TechnicalLeader , par_TechnicalPost , par_TechnicalPhone , par_CreatTime , par_StaffCount , par_UnitName , par_FirmQualificationLevel , par_BusinessLicense , par_RegMoney , par_OpenBank , par_BankNum , par_ProjectManager , par_SeniorStaff , par_MiddleStaff , par_PrimaryStaff , par_Mechanicer , par_UnitType , par_BusinessContent , par_Remark , par_UnitLogo , par_UnitLogoVersionNo , par_UnitLogoSize , par_CardPositive , par_CardPositiveVersionNo , par_CardPositiveSize , par_IsUsed , par_LastUpdateTime , par_Address , par_LastUpdateName , par_ZipCode , par_ContactPerson , par_ContactPhone , par_Fax , par_WebUrl , par_AdviseFlag, par_UserId }; try { if (trueModel.UnitId > 0) { db.Query("Document_TenderUnit_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_TenderUnit_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 修改资质 /// /// /// public bool SaveAptitudeInfo(Document_AptitudeInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_AptitudeId = null; if (trueModel.AptitudeId.HasValue) { par_AptitudeId = new SqlParameter("@AptitudeId", trueModel.AptitudeId.Value); } else { par_AptitudeId = new SqlParameter("@AptitudeId", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_AptitudeName = null; if (!string.IsNullOrEmpty(trueModel.AptitudeName)) { par_AptitudeName = new SqlParameter("@AptitudeName", trueModel.AptitudeName); } else { par_AptitudeName = new SqlParameter("@AptitudeName", ""); } SqlParameter par_AptitudeType = null; if (trueModel.AptitudeType.HasValue) { par_AptitudeType = new SqlParameter("@AptitudeType", trueModel.AptitudeType.Value); } else { par_AptitudeType = new SqlParameter("@AptitudeType", DBNull.Value); } SqlParameter par_IsUsed = null; if (trueModel.IsUsed.HasValue) { par_IsUsed = new SqlParameter("@IsUsed", trueModel.IsUsed.Value); } else { par_IsUsed = new SqlParameter("@IsUsed", DBNull.Value); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FileName = null; if (!string.IsNullOrEmpty(trueModel.FileName)) { par_FileName = new SqlParameter("@FileName", trueModel.FileName); } else { par_FileName = new SqlParameter("@FileName", ""); } SqlParameter par_FileVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FileVersionNo)) { par_FileVersionNo = new SqlParameter("@FileVersionNo", trueModel.FileVersionNo); } else { par_FileVersionNo = new SqlParameter("@FileVersionNo", ""); } SqlParameter par_FileSize = null; if (trueModel.FileSize.HasValue) { par_FileSize = new SqlParameter("@FileSize", trueModel.FileSize.Value); } else { par_FileSize = new SqlParameter("@FileSize", DBNull.Value); } SqlParameter par_SendTime = null; if (!string.IsNullOrEmpty(trueModel.SendTime)) { par_SendTime = new SqlParameter("@SendTime", trueModel.SendTime); } else { par_SendTime = new SqlParameter("@SendTime", ""); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { par_AptitudeId , par_UnitId , par_LastUpdateTime , par_LastUpdateName , par_AptitudeName , par_AptitudeType , par_IsUsed , par_FilePath , par_FileName , par_FileVersionNo , par_FileSize , par_SendTime , par_AdviseFlag, par_UserId }; try { if (trueModel.AptitudeId > 0) { db.Query("Document_AptitudeInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_AptitudeInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 删除资质 /// /// /// public bool DelAptitudeInfo(int AptitudeId) { IList sqlParms = new List() { new SqlParameter("@AptitudeId",AptitudeId) }; try { //List m_Document_AptitudeIMGList = GetFileInfoByAptitudeId(AptitudeId).ToList(); //if (m_Document_AptitudeIMGList != null && m_Document_AptitudeIMGList.Count > 0) //{ // foreach (var m_Document_AptitudeIMG in m_Document_AptitudeIMGList) // { // IList sqlParms_IMG = new List() { new SqlParameter("@ID", m_Document_AptitudeIMG.ID) }; // db.Query("Document_AptitudeIMG_Delete", CommandType.StoredProcedure, sqlParms_IMG.ToArray()); // CommonHelper.DeleteFile(m_Document_AptitudeIMG.FilePath); // } //} db.Query("Document_AptitudeInfo_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 资质分页列表 /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// public IList GetAptitudeInfoList(ref Pagination pagination, string txtAptitudeName, int txtAptitudeType, int txtIsUse, int _UnitId) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(txtAptitudeName)) condition += " and a.AptitudeName = '" + txtAptitudeName + "' "; if (txtAptitudeType > 0) condition += " and a.AptitudeType = '" + txtAptitudeType + "' "; if (txtIsUse > 0) condition += " and a.IsUsed = '" + txtIsUse + "' "; if (_UnitId > 0) condition += " and a.UnitId = '" + _UnitId + "' "; return db.SelectModelPage(ref pagination, " a.AptitudeId,b.Name as AptitudeTypeName,a.AptitudeName,(case when a.IsUsed=1 then '启用' else '停用' end) as IsUse,a.SendTime ", " Document_AptitudeInfo as a left join Document_AptitudeType as b on a.AptitudeType=b.Id ", " a.AptitudeId desc", " AptitudeId desc ", condition); } catch (Exception ex) { return null; } } /// /// 获取单个资质,根据aptitudeId /// /// /// public Document_AptitudeInfo GetAptitudeInfo(int aptitudeId) { try { if (aptitudeId == null || aptitudeId < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_AptitudeInfo ", string.Format(" AptitudeId='{0}'", aptitudeId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个资质,根据aptitudeName /// /// /// public Document_AptitudeInfo GetAptitudeInfoByName(string aptitudeName, string _UnitId) { try { if (string.IsNullOrEmpty(aptitudeName)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_AptitudeInfo ", string.Format(" AptitudeName='{0}' and UnitId='{1}'", aptitudeName, _UnitId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个资质,根据名称和类型 /// /// /// /// public Document_AptitudeInfo GetAptitudeInfoByName(string aptitudeName, int aptitudeTypeId) { try { if (aptitudeTypeId == null || aptitudeTypeId < 0 || string.IsNullOrEmpty(aptitudeName)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_AptitudeInfo ", string.Format(" AptitudeName='{0}' and AptitudeType ='{1}' ", aptitudeName, aptitudeTypeId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取资质列表,根据aptitudeType /// /// /// public IList GetAptitudeListByType(int aptitudeType, int _UnitId) { try { if (aptitudeType <= 0) return null;//错误数据返会空 string condition = " 1=1 "; if (aptitudeType > 0) condition += " and AptitudeType = '" + aptitudeType + "' "; if (_UnitId > 0) condition += " and UnitId = '" + _UnitId + "' "; IList result = db.SelectModel(" * ", " Document_AptitudeInfo ", condition) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取最新的ID /// /// public int GetDocument_AptitudeTypeNewId() { try { int newId = 1; List m_Document_AptitudeInfoList = db.SelectModel(" Max(Id) as Id ", " Document_AptitudeType ", "").ToList();//执行查询 if (m_Document_AptitudeInfoList != null && m_Document_AptitudeInfoList.Count > 0) { newId = m_Document_AptitudeInfoList[0].Id ?? 1; newId = newId + 1; } return newId;//返回结果 } catch (Exception ex) { return 1; } } /// /// 获取最新的排序值 /// /// /// public int GetDocument_AptitudeTypeNewOrderItem(string dicType) { try { int newId = 1; List m_Document_AptitudeInfoList = db.SelectModel(" Max(OrderItem) as Id ", " Document_AptitudeType ", string.Format(" DicType ='{0}' ", dicType)).ToList();//执行查询 if (m_Document_AptitudeInfoList != null && m_Document_AptitudeInfoList.Count > 0) { newId = m_Document_AptitudeInfoList[0].Id ?? 1; } return newId;//返回结果 } catch (Exception ex) { return 1; } } /// /// 保存数据 /// /// public bool SaveDocument_AptitudeType(Document_AptitudeType trueModel) { if (trueModel == null) { return false; } SqlParameter par_Id = null; if (trueModel.Id.HasValue) { par_Id = new SqlParameter("@Id", trueModel.Id.Value); } else { par_Id = new SqlParameter("@Id", DBNull.Value); } SqlParameter par_Name = null; if (!string.IsNullOrEmpty(trueModel.Name)) { par_Name = new SqlParameter("@Name", trueModel.Name); } else { par_Name = new SqlParameter("@Name", ""); } SqlParameter par_DicType = null; if (!string.IsNullOrEmpty(trueModel.DicType)) { par_DicType = new SqlParameter("@DicType", trueModel.DicType); } else { par_DicType = new SqlParameter("@DicType", ""); } SqlParameter par_IsUse = null; if (trueModel.IsUse.HasValue) { par_IsUse = new SqlParameter("@IsUse", trueModel.IsUse.Value); } else { par_IsUse = new SqlParameter("@IsUse", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_Remarks = null; if (!string.IsNullOrEmpty(trueModel.Remarks)) { par_Remarks = new SqlParameter("@Remarks", trueModel.Remarks); } else { par_Remarks = new SqlParameter("@Remarks", ""); } SqlParameter par_OrderItem = null; if (trueModel.OrderItem.HasValue) { par_OrderItem = new SqlParameter("@OrderItem", trueModel.OrderItem.Value); } else { par_OrderItem = new SqlParameter("@OrderItem", DBNull.Value); } IList sqlParms = new List() { par_Id , par_Name , par_DicType , par_IsUse , par_LastUpdateTime , par_Remarks , par_OrderItem }; try { if (trueModel.Id > 0) { db.Query("Document_AptitudeType_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); sqlParms[0].Value = Convert.ToInt32(GetDocument_AptitudeTypeNewId()); db.Query("Document_AptitudeType_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 删除数据类别 /// /// public bool Del_Document_AptitudeType(int Id) { IList sqlParms = new List() { new SqlParameter("@Id",Id) }; try { List m_Document_AptitudeInfoList = GetAptitudeListByType(Id, 0).ToList(); if (m_Document_AptitudeInfoList != null && m_Document_AptitudeInfoList.Count > 0) { foreach (var m_Document_AptitudeInfo in m_Document_AptitudeInfoList) { DelAptitudeInfo(m_Document_AptitudeInfo.AptitudeId ?? 0); } } db.Query("Document_AptitudeType_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 获取分页列表 /// /// /// /// /// /// public List GetDocument_AptitudeTypeList(ref Pagination pagination, string _DicType, string _Name) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(_Name)) condition += " and Name = '" + _Name + "' "; if (!string.IsNullOrEmpty(_DicType)) condition += " and DicType = '" + _DicType + "' "; return db.SelectModelPage(ref pagination, " *,(case when IsUse=1 then '启用' else '禁用' end) as IsUseName ", " Document_AptitudeType ", " id desc", " id desc ", condition).ToList(); } catch (Exception ex) { return null; } } /// /// 根据名称查询数据 /// /// /// public Document_AptitudeType GetDocument_AptitudeTypeByName(string Name) { try { if (string.IsNullOrEmpty(Name)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_AptitudeType ", string.Format(" Name='{0}'", Name)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 根据ID查询数据 /// /// /// public Document_AptitudeType GetDocument_AptitudeTypeById(int? Id) { try { if (Id == null || Id <= 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_AptitudeType ", string.Format(" Id='{0}'", Id)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取资质文件列表,根据aptitudeType /// /// /// public IList GetFileInfoListByType(int aptitudeType) { try { if (aptitudeType == null || aptitudeType < 0) return null;//错误数据返会空 IList result = db.SelectModel(" b.* ", " dbo.Document_AptitudeInfo AS a LEFT JOIN dbo.Document_AptitudeIMG AS b ON a.AptitudeId=b.AptitudeId AND a.IsUsed='1' ", string.Format(" a.AptitudeType ='{0}' ", aptitudeType)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取资质文件列表,根据aptitudeId /// /// /// public IList GetFileInfoByAptitudeId(int aptitudeId) { try { if (aptitudeId == null || aptitudeId < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_AptitudeInfo ", string.Format(" IsUsed='1' AND AptitudeId='{0}' ", aptitudeId)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取身份证,根据projectId,unitid,aptitudeId /// /// /// /// -1法人,-2投标人 /// public IList GetSFZList(int projectId, int unitid, int aptitudeId = 0) { IList m_Document_AptitudeIMGList = new List(); if (aptitudeId == 0 || aptitudeId == -1) { Document_TenderUnit tenderUnit = GetTenderUnit(unitid); FileDataInfo m_FileDataInfo_1 = new FileDataInfo(); if (tenderUnit != null) { if (!string.IsNullOrEmpty(tenderUnit.CardPositive)) { m_FileDataInfo_1 = new FileDataInfo(); m_FileDataInfo_1.ImgUrl = tenderUnit.CardPositive; m_FileDataInfo_1.ImgName = "法人身份证"; m_Document_AptitudeIMGList.Add(m_FileDataInfo_1); } } } if (aptitudeId == 0 || aptitudeId == -2) { Document_ProjectExpand projectExpand = GetProjectExpand(projectId, unitid); FileDataInfo m_FileDataInfo_2 = new FileDataInfo(); if (projectExpand != null && !string.IsNullOrEmpty(projectExpand.TenderPerson)) { Document_EmployeeInfo employee = GetDocument_EmployeeInfoByName(projectExpand.TenderPerson); if (employee != null) { m_FileDataInfo_2 = new FileDataInfo(); m_FileDataInfo_2.ImgUrl = employee.CardPositive; m_FileDataInfo_2.ImgName = "投标人身份证"; m_Document_AptitudeIMGList.Add(m_FileDataInfo_2); } } } return m_Document_AptitudeIMGList; } /// /// 修改通用文件 /// /// /// public bool SaveCommonFile(Document_CommonFile trueModel) { if (trueModel == null) { return false; } SqlParameter par_Id = null; if (trueModel.Id.HasValue) { par_Id = new SqlParameter("@Id", trueModel.Id.Value); } else { par_Id = new SqlParameter("@Id", DBNull.Value); } SqlParameter par_FileName = null; if (!string.IsNullOrEmpty(trueModel.FileName)) { par_FileName = new SqlParameter("@FileName", trueModel.FileName); } else { par_FileName = new SqlParameter("@FileName", ""); } SqlParameter par_FilePath = null; if (!string.IsNullOrEmpty(trueModel.FilePath)) { par_FilePath = new SqlParameter("@FilePath", trueModel.FilePath); } else { par_FilePath = new SqlParameter("@FilePath", ""); } SqlParameter par_FileVersionNo = null; if (!string.IsNullOrEmpty(trueModel.FileVersionNo)) { par_FileVersionNo = new SqlParameter("@FileVersionNo", trueModel.FileVersionNo); } else { par_FileVersionNo = new SqlParameter("@FileVersionNo", ""); } SqlParameter par_FileSize = null; if (trueModel.FileSize.HasValue) { par_FileSize = new SqlParameter("@FileSize", trueModel.FileSize.Value); } else { par_FileSize = new SqlParameter("@FileSize", DBNull.Value); } SqlParameter par_IsUsed = null; if (trueModel.IsUsed.HasValue) { par_IsUsed = new SqlParameter("@IsUsed", trueModel.IsUsed.Value); } else { par_IsUsed = new SqlParameter("@IsUsed", DBNull.Value); } SqlParameter par_UnitId = null; if (trueModel.UnitId.HasValue) { par_UnitId = new SqlParameter("@UnitId", trueModel.UnitId.Value); } else { par_UnitId = new SqlParameter("@UnitId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { par_Id , par_FileName , par_FilePath , par_FileVersionNo , par_FileSize , par_IsUsed , par_UnitId , par_LastUpdateTime , par_LastUpdateName , par_AdviseFlag , par_UserId }; try { if (trueModel.Id > 0) { db.Query("Document_CommonFile_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_CommonFile_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 删除通用文件 /// /// /// public bool DeleteCommonFile(int Id) { IList sqlParms = new List() { new SqlParameter("@Id",Id) }; try { Document_CommonFile m_Document_CommonFile = GetCommonFileModel(Id); if (m_Document_CommonFile != null) { CommonHelper.DeleteFile(m_Document_CommonFile.FilePath); } db.Query("Document_CommonFile_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 获取通用文件列表 /// /// /// /// /// public IList GetCommonFileList(ref Pagination pagination, string fileName, int isUse) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(fileName)) condition += " and FileName = '" + fileName + "' "; if (isUse > 0) condition += " and IsUsed = '" + isUse + "' "; return db.SelectModelPage(ref pagination, " Id,FileName,FilePath,LastUpdateTime,IsUsed,(case when IsUsed=1 then '启用' else '停用' end) as isUseName,(case when IsUsed=1 then '停用' else '启用' end) as isUseOp ", " Document_CommonFile ", " Id desc", " Id desc ", condition); } catch (Exception ex) { return null; } } /// /// 获取单个通用文件 /// /// /// public Document_CommonFile GetCommonFileModel(int Id) { try { if (Id == null || Id < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_CommonFile ", string.Format(" Id='{0}'", Id)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 根据名称获取使用中的通用文件 /// /// /// public IList GetModelListByUse(string fileName = "") { try { if (string.IsNullOrEmpty(fileName)) { IList result = db.SelectModel(" * ", " Document_CommonFile ", "") as IList;//执行查询 return result;//返回结果 } else { IList result = db.SelectModel(" * ", " Document_CommonFile ", string.Format(" FileName='{0}'", fileName)) as IList;//执行查询 return result;//返回结果 } } catch (Exception ex) { return null; } } /// /// 修改员工信息 /// /// /// /// /// /// public bool SaveEmployee(Document_EmployeeInfo trueModel, bool IsBMR, bool IsBSZZR, bool IsTBR) { if (trueModel == null) { return false; } if (trueModel.EmployeeId > 0) { SqlParameter par_EmployeeId = null; if (trueModel.EmployeeId.HasValue) { par_EmployeeId = new SqlParameter("@EmployeeId", trueModel.EmployeeId.Value); } else { par_EmployeeId = new SqlParameter("@EmployeeId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UserName = null; if (!string.IsNullOrEmpty(trueModel.UserName)) { par_UserName = new SqlParameter("@UserName", trueModel.UserName); } else { par_UserName = new SqlParameter("@UserName", ""); } SqlParameter par_UserPassWord = null; if (!string.IsNullOrEmpty(trueModel.UserPassWord)) { par_UserPassWord = new SqlParameter("@UserPassWord", trueModel.UserPassWord); } else { par_UserPassWord = new SqlParameter("@UserPassWord", ""); } SqlParameter par_LoginTime = null; if (trueModel.LoginTime.HasValue) { par_LoginTime = new SqlParameter("@LoginTime", trueModel.LoginTime.Value); } else { par_LoginTime = new SqlParameter("@LoginTime", DBNull.Value); } SqlParameter par_IsLogin = null; if (trueModel.IsLogin) { par_IsLogin = new SqlParameter("@IsLogin", trueModel.IsLogin); } else { par_IsLogin = new SqlParameter("@IsLogin", false); } SqlParameter par_EmployeeName = null; if (!string.IsNullOrEmpty(trueModel.EmployeeName)) { par_EmployeeName = new SqlParameter("@EmployeeName", trueModel.EmployeeName); } else { par_EmployeeName = new SqlParameter("@EmployeeName", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_IsWork = null; if (trueModel.IsWork.HasValue) { par_IsWork = new SqlParameter("@IsWork", trueModel.IsWork.Value); } else { par_IsWork = new SqlParameter("@IsWork", DBNull.Value); } SqlParameter par_LeaveTime = null; if (trueModel.LeaveTime.HasValue) { par_LeaveTime = new SqlParameter("@LeaveTime", trueModel.LeaveTime.Value); } else { par_LeaveTime = new SqlParameter("@LeaveTime", DBNull.Value); } SqlParameter par_CardPositive = null; if (!string.IsNullOrEmpty(trueModel.CardPositive)) { par_CardPositive = new SqlParameter("@CardPositive", trueModel.CardPositive); } else { par_CardPositive = new SqlParameter("@CardPositive", ""); } SqlParameter par_CardPositiveVersionNo = null; if (!string.IsNullOrEmpty(trueModel.CardPositiveVersionNo)) { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", trueModel.CardPositiveVersionNo); } else { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", ""); } SqlParameter par_CardPositiveSize = null; if (trueModel.CardPositiveSize.HasValue) { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", trueModel.CardPositiveSize.Value); } else { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", DBNull.Value); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { par_EmployeeId , par_LastUpdateTime , par_LastUpdateName , par_UserName , par_UserPassWord , par_LoginTime , par_IsLogin , par_EmployeeName , par_Job , par_Phone , par_IsWork , par_LeaveTime , par_CardPositive , par_CardPositiveVersionNo , par_CardPositiveSize , par_AdviseFlag, par_UserId }; try { db.Query("Document_EmployeeInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } } else { //SqlParameter par_EmployeeId = null; //if (trueModel.EmployeeId.HasValue) //{ // par_EmployeeId = new SqlParameter("@EmployeeId", trueModel.EmployeeId.Value); //} //else //{ // par_EmployeeId = new SqlParameter("@EmployeeId", DBNull.Value); //} SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_UserName = null; if (!string.IsNullOrEmpty(trueModel.UserName)) { par_UserName = new SqlParameter("@UserName", trueModel.UserName); } else { par_UserName = new SqlParameter("@UserName", ""); } SqlParameter par_UserPassWord = null; if (!string.IsNullOrEmpty(trueModel.UserPassWord)) { par_UserPassWord = new SqlParameter("@UserPassWord", trueModel.UserPassWord); } else { par_UserPassWord = new SqlParameter("@UserPassWord", ""); } SqlParameter par_LoginTime = null; if (trueModel.LoginTime.HasValue) { par_LoginTime = new SqlParameter("@LoginTime", trueModel.LoginTime.Value); } else { par_LoginTime = new SqlParameter("@LoginTime", DBNull.Value); } SqlParameter par_IsLogin = null; if (trueModel.IsLogin) { par_IsLogin = new SqlParameter("@IsLogin", trueModel.IsLogin); } else { par_IsLogin = new SqlParameter("@IsLogin", false); } SqlParameter par_EmployeeName = null; if (!string.IsNullOrEmpty(trueModel.EmployeeName)) { par_EmployeeName = new SqlParameter("@EmployeeName", trueModel.EmployeeName); } else { par_EmployeeName = new SqlParameter("@EmployeeName", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_IsWork = null; if (trueModel.IsWork.HasValue) { par_IsWork = new SqlParameter("@IsWork", trueModel.IsWork.Value); } else { par_IsWork = new SqlParameter("@IsWork", DBNull.Value); } SqlParameter par_LeaveTime = null; if (trueModel.LeaveTime.HasValue) { par_LeaveTime = new SqlParameter("@LeaveTime", trueModel.LeaveTime.Value); } else { par_LeaveTime = new SqlParameter("@LeaveTime", DBNull.Value); } SqlParameter par_CardPositive = null; if (!string.IsNullOrEmpty(trueModel.CardPositive)) { par_CardPositive = new SqlParameter("@CardPositive", trueModel.CardPositive); } else { par_CardPositive = new SqlParameter("@CardPositive", ""); } SqlParameter par_CardPositiveVersionNo = null; if (!string.IsNullOrEmpty(trueModel.CardPositiveVersionNo)) { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", trueModel.CardPositiveVersionNo); } else { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", ""); } SqlParameter par_CardPositiveSize = null; if (trueModel.CardPositiveSize.HasValue) { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", trueModel.CardPositiveSize.Value); } else { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", DBNull.Value); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { new SqlParameter(){ ParameterName ="@EmployeeId", SqlDbType=System.Data.SqlDbType.Int, DbType=System.Data.DbType.Int32, Direction=ParameterDirection.Output}, par_LastUpdateTime , par_LastUpdateName , par_EmployeeName , par_Job , par_Phone , par_IsWork , par_LeaveTime , par_CardPositive , par_CardPositiveVersionNo , par_CardPositiveSize , par_UserName , par_UserPassWord , par_LoginTime , par_IsLogin , par_AdviseFlag, par_UserId }; try { db.Query("Document_EmployeeInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); trueModel.EmployeeId = MyConvert.ConvertToInt32(sqlParms[0].Value); } catch (Exception ex) { return false; } } string sqlStr_Del = @"Delete from Document_EmployeeRole where EmployeeId={0} "; sqlStr_Del = string.Format(sqlStr_Del, trueModel.EmployeeId); db.ExecuteSql(sqlStr_Del); if (IsBMR) { string sqlStr_BMR = @"INSERT INTO Document_EmployeeRole ([EmployeeId] ,[RoleType] ) VALUES('{0}','{1}')"; sqlStr_BMR = string.Format(sqlStr_BMR, trueModel.EmployeeId, 1); db.ExecuteSql(sqlStr_BMR); } if (IsBSZZR) { string sqlStr_BSZZR = @"INSERT INTO Document_EmployeeRole ([EmployeeId] ,[RoleType] ) VALUES('{0}','{1}')"; sqlStr_BSZZR = string.Format(sqlStr_BSZZR, trueModel.EmployeeId, 2); db.ExecuteSql(sqlStr_BSZZR); } if (IsTBR) { string sqlStr_TBR = @"INSERT INTO Document_EmployeeRole ([EmployeeId] ,[RoleType] ) VALUES('{0}','{1}')"; sqlStr_TBR = string.Format(sqlStr_TBR, trueModel.EmployeeId, 3); db.ExecuteSql(sqlStr_TBR); } return true; } /// /// 删除员工信息 /// /// /// public bool DeleteEmployee(int employeeId) { IList sqlParms = new List() { new SqlParameter("@EmployeeId",employeeId) }; try { Document_EmployeeInfo m_Document_EmployeeInfo = GetDocument_EmployeeInfoInfo(employeeId); if (m_Document_EmployeeInfo != null) { CommonHelper.DeleteFile(m_Document_EmployeeInfo.CardPositive); } db.Query("Document_EmployeeInfo_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 获取员工列表 /// /// /// /// /// /// /// public IList GetEmployeeList(ref Pagination pagination, string txtName,int type=0) { try { string condition; if (type == 0) { condition = " IsWork>0 "; } else { condition = " 1=1 "; } if (!string.IsNullOrEmpty(txtName)) condition += " and EmployeeName = '" + txtName + "' "; return db.SelectModelPage(ref pagination, " a.EmployeeId,a.EmployeeName,a.Job,a.Phone,(CASE WHEN a.IsWork>0 THEN '在职' ELSE '离职' END) as IsWorkName,(CASE WHEN a.IsWork=1 THEN '' ELSE CONVERT(NVARCHAR(30), a.LeaveTime,23) END) as LeaveTimeName,(CASE WHEN b.ID>0 THEN '是' ELSE'否'END ) as BMRID,(CASE WHEN c.ID>0 THEN '是'ELSE '否'END ) as BSZZRID,(CASE WHEN d.ID>0 THEN '是'ELSE '否'END ) as TBRID ", " Document_EmployeeInfo as a left join Document_EmployeeRole as b on a.EmployeeId = b.EmployeeId and b.RoleType=1 left join Document_EmployeeRole as c on a.EmployeeId = c.EmployeeId and c.RoleType=2 left join Document_EmployeeRole as d on a.EmployeeId = d.EmployeeId and d.RoleType=3 ", " a.EmployeeId desc", " EmployeeId desc ", condition); } catch (Exception ex) { return null; } } /// /// 获取员工列表,根据txtName /// /// /// public IList GetEmployeeListByName(string txtName) { try { IList result = db.SelectModel(" * ", " Document_EmployeeInfo ", string.Format(" EmployeeName like '%{0}%' ", txtName)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取员工列表,根据isWork,Role /// /// /// /// public IList GetEmployeeListByStatus(int isWork, int Role) { try { string whereString = " 1=1 "; if (isWork >= 0) whereString += string.Format(" and a.IsWork ={0} ", isWork); if (Role > 0) whereString += string.Format(" and b.RoleType ={0} ", Role); IList result = db.SelectModel(" distinct a.EmployeeId,a.EmployeeName ", " Document_EmployeeInfo a left join Document_EmployeeRole b on (a.EmployeeId = b.EmployeeId) ", whereString) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个员工,根据employeeId /// /// /// public Document_EmployeeInfo GetDocument_EmployeeInfoInfo(int employeeId) { try { if (employeeId == null || employeeId < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_EmployeeInfo ", string.Format(" EmployeeId='{0}'", employeeId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个员工,根据employeeId /// /// /// public Document_EmployeeInfo GetDocument_EmployeeInfoByName(string EmployeeName) { try { if (string.IsNullOrEmpty(EmployeeName)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_EmployeeInfo ", string.Format(" EmployeeName='{0}'", EmployeeName)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取登录帐号获取员工 /// /// /// public Document_EmployeeInfo GetDocument_EmployeeInfoByLoginName(string UserName) { try { if (string.IsNullOrEmpty(UserName)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_EmployeeInfo ", string.Format(" UserName='{0}' ", UserName)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取登录帐号和密码获取员工 /// /// /// public Document_EmployeeInfo GetDocument_EmployeeInfoByLogin(string UserName, string UserPassWord) { try { if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(UserPassWord)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_EmployeeInfo ", string.Format(" UserName='{0}' and UserPassWord='{1}'", UserName, UserPassWord)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个员工角色,根据employeeId,RoleType /// /// /// /// public Document_EmployeeRole GetDocument_EmployeeRole(int employeeId, int RoleType) { try { if (!(employeeId > 0)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_EmployeeRole ", string.Format(" EmployeeId='{0}' and RoleType='{1}'", employeeId, RoleType)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取新增员工 /// /// /// public Document_EmployeeInfo GetMaxIdDocument_EmployeeInfoInfo() { try { IList result = db.SelectModel(" top 1 ", " Document_EmployeeInfo ", " 1=1 Order By EmployeeId DESC ") as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 是否存在相同的委托代理人 /// /// /// public bool ExistsDelegateName(string delegateName) { try { IList result = db.SelectModel(" * ", " Document_DelegatePersonInfo ", string.Format(" DelegateName = '{0}' ", delegateName)) as IList;//执行查询 if (result != null && result.Count > 0) { return true; } else { return false; } } catch (Exception ex) { return true; } } /// /// 获取所有委托代理人 /// /// public IList GetAllDelegatePerson() { try { IList result = db.SelectModel(" * ", " Document_DelegatePersonInfo ", " IsUse=1 ") as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个委托代理人,根据delegateId /// /// /// public Document_DelegatePersonInfo GetDocument_DelegatePersonInfo(int delegateId) { try { if (delegateId == null || delegateId < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_DelegatePersonInfo ", string.Format(" DelegateId='{0}'", delegateId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取委托代理人分页列表 /// /// /// /// /// /// /// /// public IList GetDelegatePersonList(ref Pagination pagination, string delegateName, int isUse) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(delegateName)) condition += " and DelegateName = '" + delegateName + "' "; if (isUse > 0) condition += " and IsUse = '" + isUse + "' "; return db.SelectModelPage(ref pagination, " DelegateId,DelegateName,WorkUnit,Job,Phone,(case when IsUse=1 then '是' else '否' end) as IsUseName ", " Document_DelegatePersonInfo ", " DelegateId desc", " DelegateId desc ", condition) ?? new List(); } catch (Exception ex) { return null; } } /// /// 修改委托代理人 /// /// /// public bool SaveDelegatePerson(Document_DelegatePersonInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_DelegateId = null; if (trueModel.DelegateId.HasValue) { par_DelegateId = new SqlParameter("@DelegateId", trueModel.DelegateId.Value); } else { par_DelegateId = new SqlParameter("@DelegateId", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_DelegateName = null; if (!string.IsNullOrEmpty(trueModel.DelegateName)) { par_DelegateName = new SqlParameter("@DelegateName", trueModel.DelegateName); } else { par_DelegateName = new SqlParameter("@DelegateName", ""); } SqlParameter par_WorkUnit = null; if (!string.IsNullOrEmpty(trueModel.WorkUnit)) { par_WorkUnit = new SqlParameter("@WorkUnit", trueModel.WorkUnit); } else { par_WorkUnit = new SqlParameter("@WorkUnit", ""); } SqlParameter par_Job = null; if (!string.IsNullOrEmpty(trueModel.Job)) { par_Job = new SqlParameter("@Job", trueModel.Job); } else { par_Job = new SqlParameter("@Job", ""); } SqlParameter par_Phone = null; if (!string.IsNullOrEmpty(trueModel.Phone)) { par_Phone = new SqlParameter("@Phone", trueModel.Phone); } else { par_Phone = new SqlParameter("@Phone", ""); } SqlParameter par_IsUse = null; if (trueModel.IsUse.HasValue) { par_IsUse = new SqlParameter("@IsUse", trueModel.IsUse.Value); } else { par_IsUse = new SqlParameter("@IsUse", DBNull.Value); } SqlParameter par_CardPositive = null; if (!string.IsNullOrEmpty(trueModel.CardPositive)) { par_CardPositive = new SqlParameter("@CardPositive", trueModel.CardPositive); } else { par_CardPositive = new SqlParameter("@CardPositive", ""); } SqlParameter par_CardPositiveVersionNo = null; if (!string.IsNullOrEmpty(trueModel.CardPositiveVersionNo)) { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", trueModel.CardPositiveVersionNo); } else { par_CardPositiveVersionNo = new SqlParameter("@CardPositiveVersionNo", ""); } SqlParameter par_CardPositiveSize = null; if (trueModel.CardPositiveSize.HasValue) { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", trueModel.CardPositiveSize.Value); } else { par_CardPositiveSize = new SqlParameter("@CardPositiveSize", DBNull.Value); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { par_DelegateId , par_LastUpdateTime , par_LastUpdateName , par_DelegateName , par_WorkUnit , par_Job , par_Phone , par_IsUse , par_CardPositive , par_CardPositiveVersionNo , par_CardPositiveSize , par_AdviseFlag, par_UserId }; try { if (trueModel.DelegateId > 0) { db.Query("Document_DelegatePersonInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_DelegatePersonInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 删除委托代理人 /// /// /// public bool DelDelegatePerson(int delegateId) { IList sqlParms = new List() { new SqlParameter("@DelegateId",delegateId) }; try { Document_DelegatePersonInfo m_Document_DelegatePersonInfo = GetDocument_DelegatePersonInfo(delegateId); if (m_Document_DelegatePersonInfo != null) { CommonHelper.DeleteFile(m_Document_DelegatePersonInfo.CardPositive); } db.Query("Document_DelegatePersonInfo_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 获取法律信息列表 /// /// /// /// /// /// /// /// /// public IList GetLayInfoList(ref Pagination pagination, string txtLayType, string txtLayProvince, string txtLayName) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(txtLayType) && txtLayType != "请选择") condition += " and LayType = '" + txtLayType + "' "; if (!string.IsNullOrEmpty(txtLayName)) condition += " and LayName = '" + txtLayName + "' "; if (!string.IsNullOrEmpty(txtLayProvince)) condition += " and LayProvince = '" + txtLayProvince + "' "; return db.SelectModelPage(ref pagination, " * ", " Document_LayInfo ", " LayId desc", " LayId desc ", condition); } catch (Exception ex) { return null; } } /// /// 获取单个法律信息,根据layId /// /// /// public Document_LayInfo GetLayInfo(int layId) { try { if (layId == null || layId < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_LayInfo ", string.Format(" LayId='{0}'", layId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 修改法律信息 /// /// /// public bool SaveLayInfo(Document_LayInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_LayId = null; if (trueModel.LayId.HasValue) { par_LayId = new SqlParameter("@LayId", trueModel.LayId.Value); } else { par_LayId = new SqlParameter("@LayId", DBNull.Value); } SqlParameter par_IsSys = null; if (trueModel.IsSys.HasValue) { par_IsSys = new SqlParameter("@IsSys", trueModel.IsSys.Value); } else { par_IsSys = new SqlParameter("@IsSys", DBNull.Value); } SqlParameter par_LastUpdateTime = null; if (trueModel.LastUpdateTime.HasValue) { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", trueModel.LastUpdateTime.Value); } else { par_LastUpdateTime = new SqlParameter("@LastUpdateTime", DBNull.Value); } SqlParameter par_LastUpdateName = null; if (!string.IsNullOrEmpty(trueModel.LastUpdateName)) { par_LastUpdateName = new SqlParameter("@LastUpdateName", trueModel.LastUpdateName); } else { par_LastUpdateName = new SqlParameter("@LastUpdateName", ""); } SqlParameter par_LayType = null; if (!string.IsNullOrEmpty(trueModel.LayType)) { par_LayType = new SqlParameter("@LayType", trueModel.LayType); } else { par_LayType = new SqlParameter("@LayType", ""); } SqlParameter par_LayName = null; if (!string.IsNullOrEmpty(trueModel.LayName)) { par_LayName = new SqlParameter("@LayName", trueModel.LayName); } else { par_LayName = new SqlParameter("@LayName", ""); } SqlParameter par_LayProvince = null; if (!string.IsNullOrEmpty(trueModel.LayProvince)) { par_LayProvince = new SqlParameter("@LayProvince", trueModel.LayProvince); } else { par_LayProvince = new SqlParameter("@LayProvince", ""); } SqlParameter par_StartTime = null; if (trueModel.StartTime.HasValue) { par_StartTime = new SqlParameter("@StartTime", trueModel.StartTime.Value); } else { par_StartTime = new SqlParameter("@StartTime", DBNull.Value); } SqlParameter par_EndTime = null; if (trueModel.EndTime.HasValue) { par_EndTime = new SqlParameter("@EndTime", trueModel.EndTime.Value); } else { par_EndTime = new SqlParameter("@EndTime", DBNull.Value); } SqlParameter par_LayPath = null; if (!string.IsNullOrEmpty(trueModel.LayPath)) { par_LayPath = new SqlParameter("@LayPath", trueModel.LayPath); } else { par_LayPath = new SqlParameter("@LayPath", ""); } SqlParameter par_LayPathVersionNo = null; if (!string.IsNullOrEmpty(trueModel.LayPathVersionNo)) { par_LayPathVersionNo = new SqlParameter("@LayPathVersionNo", trueModel.LayPathVersionNo); } else { par_LayPathVersionNo = new SqlParameter("@LayPathVersionNo", ""); } SqlParameter par_LayPathSize = null; if (trueModel.LayPathSize.HasValue) { par_LayPathSize = new SqlParameter("@LayPathSize", trueModel.LayPathSize.Value); } else { par_LayPathSize = new SqlParameter("@LayPathSize", DBNull.Value); } SqlParameter par_AdviseFlag = null; if (trueModel.AdviseFlag.HasValue) { par_AdviseFlag = new SqlParameter("@AdviseFlag", trueModel.AdviseFlag.Value); } else { par_AdviseFlag = new SqlParameter("@AdviseFlag", DBNull.Value); } SqlParameter par_UserId = null; if (trueModel.UserId.HasValue) { par_UserId = new SqlParameter("@UserId", trueModel.UserId.Value); } else { par_UserId = new SqlParameter("@UserId", DBNull.Value); } IList sqlParms = new List() { par_LayId , par_IsSys , par_LastUpdateTime , par_LastUpdateName , par_LayType , par_LayName , par_LayProvince , par_StartTime , par_EndTime , par_LayPath , par_LayPathVersionNo , par_LayPathSize, par_AdviseFlag, par_UserId }; try { if (trueModel.LayId > 0) { db.Query("Document_LayInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_LayInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 删除法律信息 /// /// /// public bool DelLayInfo(int id) { IList sqlParms = new List() { new SqlParameter("@LayId",id) }; try { Document_LayInfo m_Document_LayInfo = GetLayInfo(id); if (m_Document_LayInfo != null) { CommonHelper.DeleteFile(m_Document_LayInfo.LayPath); } db.Query("Document_LayInfo_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 根据名称查询数据 /// /// /// public Document_LayInfo GetDocument_LayInfoByName(string LayName) { try { if (string.IsNullOrEmpty(LayName)) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_LayInfo ", string.Format(" LayName='{0}' ", LayName)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取字典表列表,根据dicType /// /// /// public IList GetDictionaryList(string dicType) { try { IList result = db.SelectModel(" * ", " Document_Dictionary ", string.Format(" DicType = '{0}' order by orderItem ", dicType)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取单个字典表信息,根据id /// /// /// public Document_Dictionary GetDictionaryById(int id) { try { if (id == null || id < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_Dictionary ", string.Format(" Id='{0}'", id)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 获取所有的区域-省 /// /// public IList GetProvinceList() { try { IList result = db.SelectModel(" * ", " Sys_CitySite ", " CityLevel=1 AND IsDisplay=1 ORDER BY OrderNum ") as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取所有的区域-市 /// /// /// public IList GetCityList(int provinceId) { try { IList result = db.SelectModel(" * ", " Sys_CitySite ", string.Format(" CityLevel=2 AND IsDisplay=1 AND ProvinceId={0} ORDER BY OrderNum ", provinceId)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取所有的区域-县 /// /// /// public IList GetCountryList(int cityId) { try { IList result = db.SelectModel(" * ", " Sys_CitySite ", string.Format(" CityLevel=3 AND IsDisplay=1 AND CityId={0} ORDER BY OrderNum ", cityId)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } /// /// 获取省市区对应的编号 /// /// /// /// /// public int GetKeyid(string name, int provinceId, int cityId) { try { IList result = db.SelectModel(" * ", " Sys_CitySite ", string.Format(" name='{0}' and provinceId={1} and cityId={2} ", name, provinceId, cityId)) as IList;//执行查询 return (null == result || result.Count == 0) ? 0 : (result[0].Keyid ?? 0);//返回结果 } catch (Exception ex) { return 0; } } /// /// 获取上一级单位,根据childName /// /// /// public string GetPreUnit(string childName) { try { string preUnit = string.Empty; Sys_CitySite m_Sys_CitySite = null; Sys_CitySite preModel = null; IList result = db.SelectModel(" * ", " Sys_CitySite ", string.Format(" name='{0}' ", childName)) as IList;//执行查询 if (null != result && result.Count > 0) { m_Sys_CitySite = result[0]; } if (m_Sys_CitySite != null) { if (m_Sys_CitySite.CityLevel == 3) { preModel = GetModelById(m_Sys_CitySite.CityId ?? 0); } else if (m_Sys_CitySite.CityLevel == 2) { preModel = GetModelById(m_Sys_CitySite.ProvinceId ?? 0); } else { preModel = m_Sys_CitySite; } } if (preModel != null) { preUnit = preModel.Name; } return preUnit; } catch (Exception ex) { return ""; } } /// /// 获取单个城市信息,根据 /// /// /// public Sys_CitySite GetModelById(int keyId) { try { IList result = db.SelectModel(" * ", " Sys_CitySite ", string.Format(" Keyid='{0}' ", keyId)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 根据城市全称获取简称 /// /// /// public string GetProNameByFullName(string FullName) { try { IList result = db.SelectModel(" * ", " Sys_CitySite ", string.Format(" AllName='{0}' ", FullName)) as IList;//执行查询 return (null == result || result.Count == 0) ? "" : result[0].Name;//返回结果 } catch (Exception ex) { return null; } } /// /// /// /// /// /// public bool RegisteUser(string userName, ref Document_UserInfo userInfo) { throw new NotImplementedException(); } /// /// 根据现在版本获取新版本号 /// /// /// public string GetNewVersionNo(string oldVersionNo) { string newVersionNo = string.Empty; if (string.IsNullOrEmpty(oldVersionNo)) { newVersionNo = "1"; } else { newVersionNo = Convert.ToString(int.Parse(oldVersionNo) + 1); } return newVersionNo; } /// /// 保存文件版本 /// /// /// public bool SaveSynchroInfo(string typeName) { try { if (string.IsNullOrEmpty(typeName)) return false;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_SynchroInfo ", string.Format(" TypeName='{0}'", typeName)) as IList;//执行查询 bool isSuccess = false; Document_SynchroInfo synInfo = null; if (null == result || result.Count == 0) { synInfo = new Document_SynchroInfo(); synInfo.TypeName = typeName; synInfo.VersionNo = "1"; IList sqlParms = new List() { new SqlParameter("@TypeName", typeName) , new SqlParameter("@VersionNo", "1") }; db.Query("Document_SynchroInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } else { synInfo = result[0]; synInfo.TypeName = typeName; synInfo.VersionNo = GetNewVersionNo(synInfo.VersionNo); IList sqlParms = new List() { new SqlParameter("@Id", synInfo.Id) , new SqlParameter("@TypeName", synInfo.TypeName) , new SqlParameter("@VersionNo", synInfo.VersionNo) }; db.Query("Document_SynchroInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } return isSuccess; } catch (Exception ex) { return false; } } /// /// 根据Id获取其工作提醒信息 /// /// /// public Document_WorkRemind GetDocument_WorkRemindById(int id) { try { if (id == null || id < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_WorkRemind ", string.Format(" WorkRemindId='{0}'", id)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 保存数据 /// /// public bool SaveDocument_WorkRemind(Document_WorkRemind trueModel) { if (trueModel == null) { return false; } SqlParameter par_WorkRemindId = null; if (trueModel.WorkRemindId.HasValue) { par_WorkRemindId = new SqlParameter("@WorkRemindId", trueModel.WorkRemindId.Value); } else { par_WorkRemindId = new SqlParameter("@WorkRemindId", DBNull.Value); } SqlParameter par_ProjectName = null; if (!string.IsNullOrEmpty(trueModel.ProjectName)) { par_ProjectName = new SqlParameter("@ProjectName", trueModel.ProjectName); } else { par_ProjectName = new SqlParameter("@ProjectName", ""); } SqlParameter par_ProjectId = null; if (trueModel.ProjectId.HasValue) { par_ProjectId = new SqlParameter("@ProjectId", trueModel.ProjectId.Value); } else { par_ProjectId = new SqlParameter("@ProjectId", DBNull.Value); } SqlParameter par_WorkRemindContent = null; if (!string.IsNullOrEmpty(trueModel.WorkRemindContent)) { par_WorkRemindContent = new SqlParameter("@WorkRemindContent", trueModel.WorkRemindContent); } else { par_WorkRemindContent = new SqlParameter("@WorkRemindContent", ""); } SqlParameter par_WorkRemindTime = null; if (trueModel.WorkRemindTime.HasValue) { par_WorkRemindTime = new SqlParameter("@WorkRemindTime", trueModel.WorkRemindTime.Value); } else { par_WorkRemindTime = new SqlParameter("@WorkRemindTime", DBNull.Value); } SqlParameter par_LastUpTime = null; if (trueModel.LastUpTime.HasValue) { par_LastUpTime = new SqlParameter("@LastUpTime", trueModel.LastUpTime.Value); } else { par_LastUpTime = new SqlParameter("@LastUpTime", DBNull.Value); } IList sqlParms = new List() { par_WorkRemindId , par_ProjectName , par_ProjectId , par_WorkRemindContent , par_WorkRemindTime , par_LastUpTime }; try { if (trueModel.WorkRemindId > 0) { db.Query("Document_WorkRemind_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_WorkRemind_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 删除数据类别 /// /// public bool Del_Document_WorkRemind(int WorkRemindId) { List sqlParms = new List() { new SqlParameter("@WorkRemindId",WorkRemindId) }; try { Document_WorkRemind m_Document_WorkRemind = GetDocument_WorkRemindById(WorkRemindId); db.Query("Document_WorkRemind_Delete", CommandType.StoredProcedure, sqlParms.ToArray()); } catch (Exception ex) { return false; } return true; } /// /// 获取分页列表 /// /// /// /// /// /// /// public List GetDocument_WorkRemindList(ref Pagination pagination, DateTime? _BeginWorkRemindTime, DateTime? _EndWorkRemindTime, string _ProjectName, string _WorkRemindContent) { try { string condition = " 1=1 "; if (!string.IsNullOrEmpty(_ProjectName)) condition += " and ProjectName = '" + _ProjectName + "' "; if (!string.IsNullOrEmpty(_WorkRemindContent)) condition += " and WorkRemindContent = '" + _WorkRemindContent + "' "; if (_BeginWorkRemindTime.HasValue) condition += string.Format(" and CAST(WorkRemindTime AS DATE) >='{0}' ", _BeginWorkRemindTime); if (_EndWorkRemindTime.HasValue) condition += string.Format(" and CAST(WorkRemindTime AS DATE) <='{0}' ", _EndWorkRemindTime); return db.SelectModelPage(ref pagination, " * ", " Document_WorkRemind ", " WorkRemindId desc ", " WorkRemindId desc ", condition).ToList(); } catch (Exception ex) { return null; } } /// /// 根据Id获取其法律法规信息 /// /// /// public Document_PerformanceInfo GetDocument_PerformanceInfoById(int id) { try { if (id == null || id < 0) return null;//错误数据返会空 IList result = db.SelectModel(" * ", " Document_PerformanceInfo ", string.Format(" Id='{0}'", id)) as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 保存数据 /// /// public bool SaveDocument_PerformanceInfo(Document_PerformanceInfo trueModel) { if (trueModel == null) { return false; } SqlParameter par_Id = null; if (trueModel.Id.HasValue) { par_Id = new SqlParameter("@Id", trueModel.Id.Value); } else { par_Id = new SqlParameter("@Id", DBNull.Value); } SqlParameter par_EmployeeId = null; if (trueModel.EmployeeId.HasValue) { par_EmployeeId = new SqlParameter("@EmployeeId", trueModel.EmployeeId.Value); } else { par_EmployeeId = new SqlParameter("@EmployeeId", DBNull.Value); } SqlParameter par_ProjectName = null; if (!string.IsNullOrEmpty(trueModel.ProjectName)) { par_ProjectName = new SqlParameter("@ProjectName", trueModel.ProjectName); } else { par_ProjectName = new SqlParameter("@ProjectName", ""); } SqlParameter par_WorkItem = null; if (!string.IsNullOrEmpty(trueModel.WorkItem)) { par_WorkItem = new SqlParameter("@WorkItem", trueModel.WorkItem); } else { par_WorkItem = new SqlParameter("@WorkItem", ""); } SqlParameter par_Price = null; if (trueModel.Price.HasValue) { par_Price = new SqlParameter("@Price", trueModel.Price.Value); } else { par_Price = new SqlParameter("@Price", DBNull.Value); } SqlParameter par_WorkTime = null; if (trueModel.WorkTime.HasValue) { par_WorkTime = new SqlParameter("@WorkTime", trueModel.WorkTime.Value); } else { par_WorkTime = new SqlParameter("@WorkTime", DBNull.Value); } SqlParameter par_EmployeeName = null; if (!string.IsNullOrEmpty(trueModel.EmployeeName)) { par_EmployeeName = new SqlParameter("@EmployeeName", trueModel.EmployeeName); } else { par_EmployeeName = new SqlParameter("@EmployeeName", ""); } IList sqlParms = new List() { par_Id , par_EmployeeId , par_ProjectName , par_WorkItem , par_Price , par_WorkTime , par_EmployeeName }; try { if (trueModel.Id > 0) { db.Query("Document_PerformanceInfo_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Document_PerformanceInfo_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 获取分页列表 /// /// /// /// /// /// /// /// /// public IList GetDocument_PerformanceInfoList(string txtWorkStartTime, string txtWorkEndTime, string txtEmployeeId, string projectName, string txtWorkItem, out decimal AllPageMoney) { AllPageMoney = 0; IList m_Document_PerformanceInfoList = new List(); string queryString_Signup = @"select a.SignupTime as WorkTime,a.SignupPerson as EmployeeName,a.SignupAllowance as Price,b.ProjectName,'报名' as WorkItem from ( Document_ProjectExpand a left join Document_ProjectInfo b on a.ProjectId = b.ProjectId )where a.IsSignup = 1 "; if (!string.IsNullOrEmpty(txtWorkStartTime)) { string Time_String = string.IsNullOrEmpty(txtWorkStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(txtWorkStartTime)).Substring(0, 10); queryString_Signup += string.Format(" and a.SignupTime >='{0}'", Time_String); } if (!string.IsNullOrEmpty(txtWorkEndTime)) { string Time_String = string.IsNullOrEmpty(txtWorkEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(txtWorkEndTime)).Substring(0, 10); queryString_Signup += string.Format(" and a.SignupTime <='{0}'", Time_String); } if (!string.IsNullOrEmpty(txtEmployeeId) && txtEmployeeId != "请选择") queryString_Signup += string.Format(" and a.SignupPerson ='{0}'", txtEmployeeId); if (!string.IsNullOrEmpty(projectName)) queryString_Signup += string.Format(" and b.ProjectName like '%{0}%'", projectName); if (!string.IsNullOrEmpty(txtWorkItem)) queryString_Signup += string.Format(" and '报名'='{0}'", txtWorkItem); DataTable dt_Signup = db.QueryDataTable(queryString_Signup, CommandType.Text, null); string queryString_Document = @"select c.DocumentTime as WorkTime,a.DocumentManager as EmployeeName,a.DocumentPrice as Price,b.ProjectName,'标书制作' as WorkItem from (( Document_ProjectExpand a left join Document_ProjectInfo b on a.ProjectId = b.ProjectId ) left join Document_ProjectDocumentInfo c on a.ProjectId = c.ProjectId ) where a.DocumentStatus = 17 "; if (!string.IsNullOrEmpty(txtWorkStartTime)) { string Time_String = string.IsNullOrEmpty(txtWorkStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(txtWorkStartTime)).Substring(0, 10); queryString_Document += string.Format(" and c.DocumentTime >='{0}'", Time_String); } if (!string.IsNullOrEmpty(txtWorkEndTime)) { string Time_String = string.IsNullOrEmpty(txtWorkEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(txtWorkEndTime)).Substring(0, 10); queryString_Document += string.Format(" and c.DocumentTime <='{0}'", Time_String); } if (!string.IsNullOrEmpty(txtEmployeeId) && txtEmployeeId != "请选择") queryString_Document += string.Format(" and a.DocumentManager ='{0}'", txtEmployeeId); if (!string.IsNullOrEmpty(projectName)) queryString_Document += string.Format(" and b.ProjectName like '%{0}%'", projectName); if (!string.IsNullOrEmpty(txtWorkItem)) queryString_Document += string.Format(" and '标书制作'='{0}'", txtWorkItem); DataTable dt_Document = db.QueryDataTable(queryString_Document, CommandType.Text, null); string queryString_Tender = @"select a.TenderTime as WorkTime,a.TenderPerson as EmployeeName,a.TenderDraw as Price,b.ProjectName,'投标' as WorkItem from ( Document_ProjectExpand a left join Document_ProjectInfo b on a.ProjectId = b.ProjectId )where a.TenderStatus = 1 "; if (!string.IsNullOrEmpty(txtWorkStartTime)) { string Time_String = string.IsNullOrEmpty(txtWorkStartTime) ? "" : string.Format("{0:u}", DateTime.Parse(txtWorkStartTime)).Substring(0, 10); queryString_Tender += string.Format(" and a.TenderTime >='{0}'", Time_String); } if (!string.IsNullOrEmpty(txtWorkEndTime)) { string Time_String = string.IsNullOrEmpty(txtWorkEndTime) ? "" : string.Format("{0:u}", DateTime.Parse(txtWorkEndTime)).Substring(0, 10); queryString_Tender += string.Format(" and a.TenderTime <='{0}'", Time_String); } if (!string.IsNullOrEmpty(txtEmployeeId) && txtEmployeeId != "请选择") queryString_Tender += string.Format(" and a.TenderPerson ='{0}'", txtEmployeeId); if (!string.IsNullOrEmpty(projectName)) queryString_Tender += string.Format(" and b.ProjectName like '%{0}%'", projectName); if (!string.IsNullOrEmpty(txtWorkItem)) queryString_Tender += string.Format(" and '投标'='{0}'", txtWorkItem); DataTable dt_Tender = db.QueryDataTable(queryString_Tender, CommandType.Text, null); DataTable newDataTable = dt_Signup.Clone(); object[] obj = new object[newDataTable.Columns.Count]; for (int i = 0; i < dt_Signup.Rows.Count; i++) { dt_Signup.Rows[i].ItemArray.CopyTo(obj, 0); newDataTable.Rows.Add(obj); } for (int i = 0; i < dt_Document.Rows.Count; i++) { dt_Document.Rows[i].ItemArray.CopyTo(obj, 0); newDataTable.Rows.Add(obj); } for (int i = 0; i < dt_Tender.Rows.Count; i++) { dt_Tender.Rows[i].ItemArray.CopyTo(obj, 0); newDataTable.Rows.Add(obj); } for (int i = 0; i < newDataTable.Rows.Count; i++) { Document_PerformanceInfo m_Document_PerformanceInfo = new Document_PerformanceInfo(); m_Document_PerformanceInfo.EmployeeId = 0; m_Document_PerformanceInfo.Id = 0; m_Document_PerformanceInfo.ProjectName = newDataTable.Rows[i]["ProjectName"].ToString(); m_Document_PerformanceInfo.WorkItem = newDataTable.Rows[i]["WorkItem"].ToString(); if (newDataTable.Rows[i]["Price"].ToString() != "") { m_Document_PerformanceInfo.Price = decimal.Parse(newDataTable.Rows[i]["Price"].ToString()); } else { m_Document_PerformanceInfo.Price = 0; } m_Document_PerformanceInfo.EmployeeName = newDataTable.Rows[i]["EmployeeName"].ToString(); DateTime dtime; var bk = DateTime.TryParse(newDataTable.Rows[i]["WorkTime"].ToString(), out dtime); if (bk) m_Document_PerformanceInfo.WorkTime = dtime; if (m_Document_PerformanceInfo.Price.ToString() != "0" && m_Document_PerformanceInfo.Price.ToString() != "0.0000") { m_Document_PerformanceInfoList.Add(m_Document_PerformanceInfo); } AllPageMoney += m_Document_PerformanceInfo.Price.Value; } return m_Document_PerformanceInfoList; } /// /// 获取分页列表 /// /// /// /// /// /// /// /// /// public IList GetDocument_PerformanceInfoListByPaper(ref Pagination pagination, string txtWorkStartTime, string txtWorkEndTime, string txtEmployeeId, string projectName, string txtWorkItem, out decimal NowPageMoney, out decimal AllPageMoney) { IList listAll = GetDocument_PerformanceInfoList(txtWorkStartTime, txtWorkEndTime, txtEmployeeId, projectName, txtWorkItem, out AllPageMoney); IList pagerList = new List(); NowPageMoney = 0; pagination.RecordCount = listAll.Count; if ((pagination.RecordCount % pagination.PageSize) > 0) pagination.PageCount = pagination.RecordCount / pagination.PageSize + 1; else pagination.PageCount = pagination.RecordCount / pagination.PageSize; pagerList = listAll.Skip((pagination.PageIndex - 1) * pagination.PageSize).Take(pagination.PageSize).ToList(); foreach (var item in pagerList) { NowPageMoney += item.Price.Value; } return pagerList; } /// /// 获取服务端版本 /// /// /// public Sys_Update GetSys_Update() { try { IList result = db.SelectModel(" top 1 * ", " Sys_Update ", "") as IList;//执行查询 return (null == result || result.Count == 0) ? null : result[0];//返回结果 } catch (Exception ex) { return null; } } /// /// 修改服务端版本 /// /// /// public bool SaveSys_Update(Sys_Update trueModel) { if (trueModel == null) { return false; } SqlParameter par_Keyid = null; if (trueModel.Keyid.HasValue) { par_Keyid = new SqlParameter("@Keyid", trueModel.Keyid.Value); } else { par_Keyid = new SqlParameter("@Keyid", DBNull.Value); } SqlParameter par_NowVersion = null; if (!string.IsNullOrEmpty(trueModel.NowVersion)) { par_NowVersion = new SqlParameter("@NowVersion", trueModel.NowVersion); } else { par_NowVersion = new SqlParameter("@NowVersion", ""); } SqlParameter par_NowName = null; if (!string.IsNullOrEmpty(trueModel.NowName)) { par_NowName = new SqlParameter("@NowName", trueModel.NowName); } else { par_NowName = new SqlParameter("@NowName", ""); } SqlParameter par_LastUpTime = null; if (!string.IsNullOrEmpty(trueModel.LastUpTime)) { par_LastUpTime = new SqlParameter("@LastUpTime", trueModel.LastUpTime); } else { par_LastUpTime = new SqlParameter("@LastUpTime", ""); } IList sqlParms = new List() { par_Keyid , par_NowVersion , par_NowName , par_LastUpTime }; try { if (trueModel.Keyid > 0) { db.Query("Sys_Update_Update", CommandType.StoredProcedure, sqlParms.ToArray()); } else { //sqlParms.RemoveAt(0); db.Query("Sys_Update_ADD", CommandType.StoredProcedure, sqlParms.ToArray()); } } catch (Exception ex) { return false; } return true; } /// /// 执行SQL /// /// public bool ExcuSQL(string SQL) { try { int result = db.ExecuteSql(SQL, null);//执行查询 return (result > 0);//返回结果 } catch (Exception ex) { return false; } } public void FrmUpdate_Load() { ServerUpdate s_ServerUpdate = new ServerUpdate(GetSys_Update(), false); s_ServerUpdate.FrmUpdate_Load(); } /// /// 获取测试记录列表,根据txtName /// /// /// public IList GetTestListByName(string txtName) { try { IList result = db.SelectModel(" * ", " t_test ", string.Format(" username like '%{0}%' ", txtName)) as IList;//执行查询 return result;//返回结果 } catch (Exception ex) { return null; } } } }