public static int Update(ProjectConstructionDetails model) { return ProjectConstructionDBHelper.Update(model); }
public static int Add(ProjectConstructionDetails model,string projectName) { StringBuilder strSql = new StringBuilder(); strSql.AppendLine("INSERT INTO officedba.ProjectConstructionDetails("); strSql.AppendLine("SummaryName,DutyPerson,CompanyCD,projectID,ProcessScale,PersonNum,Rate,ProessID,BeginDate,EndDate,ProjectMemo)"); strSql.AppendLine(" VALUES ("); strSql.AppendLine("@in_SummaryName,@in_DutyPerson,@in_CompanyCD,@in_projectID,@in_ProcessScale,@in_PersonNum,@in_Rate,@in_ProessID,@in_BeginDate,@in_EndDate,@in_ProjectMemo)"); strSql.AppendLine(";select @@IDENTITY"); SqlParameter[] cmdParms = { new SqlParameter("@in_SummaryName",SqlDbType.VarChar,200), new SqlParameter("@in_DutyPerson", SqlDbType.Int,4), new SqlParameter("@in_CompanyCD", SqlDbType.VarChar,50), new SqlParameter("@in_projectID", SqlDbType.Int, 4), new SqlParameter("@in_ProcessScale", SqlDbType.Decimal), new SqlParameter("@in_PersonNum", SqlDbType.Decimal), new SqlParameter("@in_Rate", SqlDbType.Decimal), new SqlParameter("@in_ProessID", SqlDbType.VarChar,50), new SqlParameter("@in_BeginDate", SqlDbType.DateTime), new SqlParameter("@in_EndDate", SqlDbType.DateTime), new SqlParameter("@in_ProjectMemo", SqlDbType.VarChar,50) // new SqlParameter("@msgcontent",SqlDbType.VarChar,500) }; cmdParms[0].Value = model.SummaryName; cmdParms[1].Value = model.DutyPerson; cmdParms[2].Value = model.CompanyCD; cmdParms[3].Value = model.projectID; cmdParms[4].Value = model.ProcessScale; cmdParms[5].Value = model.PersonNum; cmdParms[6].Value = model.Rate; cmdParms[7].Value = model.ProessID; cmdParms[8].Value = model.BeginDate; cmdParms[9].Value = model.EndDate; cmdParms[10].Value = model.ProjectMemo; int num = 0; try { num = int.Parse(SqlHelper.ExecuteScalar(strSql.ToString(), cmdParms).ToString()); } catch { return num; } /*设置短信提醒*/ //1、开工时间提醒 (提前一天提醒) strSql = new StringBuilder(); strSql.AppendLine("insert into officedba.MsgSendList(CompanyCD,summaryID,msgContent,Empid) values(@CompanyCD,@summaryID,@msgcontent,@DutyPerson)"); strSql.AppendLine(";select @@IDENTITY"); SqlParameter[] msgParms = { new SqlParameter("@DutyPerson", SqlDbType.Int,4), new SqlParameter("@CompanyCD", SqlDbType.VarChar,50), new SqlParameter("@summaryID", SqlDbType.VarChar,50), new SqlParameter("@msgcontent",SqlDbType.VarChar,500) }; msgParms[0].Value = model.DutyPerson; msgParms[1].Value = model.CompanyCD; msgParms[2].Value = num; msgParms[3].Value = "项目名称:"+projectName +"中的["+ model.SummaryName + "]开工时间为:" + model.BeginDate.ToShortDateString() + ",完工时间为:" + model.EndDate.ToShortDateString()+"请您关注!"; try { num = int.Parse(SqlHelper.ExecuteScalar(strSql.ToString(), msgParms).ToString()); //追加到信息发送表 string sqlstr = "insert into officedba.NoticeHistory(CompanyCD,SourceFlag,SourceID,PlanNoticeDate) values(@compCD,5,@num,@senddate)"; TransactionManager tran = new TransactionManager(); tran.BeginTransaction(); SqlParameter[] param = { new SqlParameter("@compCD",SqlDbType.VarChar,50), new SqlParameter("@num",SqlDbType.Int,4), new SqlParameter("@senddate",SqlDbType.DateTime) }; param[0].Value = model.CompanyCD; param[1].Value = num; param[2].Value = model.BeginDate.AddDays(-1).AddHours(9); try { SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr, param); tran.Commit(); } catch { tran.Rollback(); return 0; } } catch { } return num; }
public static int Add(ProjectConstructionDetails model,string projectName) { return ProjectConstructionDBHelper.Add(model,projectName); }
public static int Update(ProjectConstructionDetails model) { TransactionManager trans = new TransactionManager(); trans.BeginTransaction(); StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE officedba.ProjectConstructionDetails SET "); strSql.Append("SummaryName=@in_SummaryName,"); strSql.Append("DutyPerson=@in_DutyPerson,"); strSql.Append("CompanyCD=@in_CompanyCD,"); strSql.Append("projectID=@in_projectID,"); strSql.Append("ProcessScale=@in_ProcessScale,"); strSql.Append("PersonNum=@in_PersonNum,"); strSql.Append("Rate=@in_Rate,"); strSql.Append("ProessID=@in_ProessID,"); strSql.Append("BeginDate=@in_BeginDate,"); strSql.Append("EndDate=@in_EndDate,"); strSql.Append("ProjectMemo=@in_ProjectMemo"); strSql.Append(" WHERE ID=@in_ID"); SqlParameter[] Parms = { new SqlParameter("@in_SummaryName", SqlDbType.VarChar,200), new SqlParameter("@in_DutyPerson", SqlDbType.Int), new SqlParameter("@in_CompanyCD", SqlDbType.VarChar,50), new SqlParameter("@in_projectID", SqlDbType.Int), new SqlParameter("@in_ProcessScale", SqlDbType.Decimal), new SqlParameter("@in_PersonNum", SqlDbType.Decimal), new SqlParameter("@in_Rate", SqlDbType.Decimal), new SqlParameter("@in_ProessID", SqlDbType.VarChar), new SqlParameter("@in_BeginDate", SqlDbType.VarChar,30), new SqlParameter("@in_EndDate", SqlDbType.VarChar,30), new SqlParameter("@in_ProjectMemo", SqlDbType.VarChar,5000), new SqlParameter("@in_ID", SqlDbType.Int)}; Parms[0].Value = model.SummaryName; Parms[1].Value = model.DutyPerson; Parms[2].Value = model.CompanyCD; Parms[3].Value = model.projectID; Parms[4].Value = model.ProcessScale; Parms[5].Value = model.PersonNum; Parms[6].Value = model.Rate; Parms[7].Value = model.ProessID; Parms[8].Value = model.BeginDate.ToString(); Parms[9].Value = model.EndDate.ToString(); Parms[10].Value = model.ProjectMemo; Parms[11].Value = model.ID; int num = 0; try { num = SqlHelper.ExecuteNonQuery(trans.Trans, CommandType.Text, strSql.ToString(), Parms); trans.Commit(); } catch { trans.Rollback(); } return num; }