/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.System.sys_Process_Exec model, out string message) { message = "新增成功!"; int rowId = dal.Add(model); if (rowId < 1) { message = "新增失败!"; } return(rowId); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(SCZM.Model.System.sys_Process_Exec model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update sys_Process_Exec set "); strSql.Append("ProcessId=@ProcessId,"); strSql.Append("BillSign=@BillSign,"); strSql.Append("BillId=@BillId,"); strSql.Append("OrderId=@OrderId,"); strSql.Append("PostId=@PostId,"); strSql.Append("PostName=@PostName,"); strSql.Append("AuditorId=@AuditorId,"); strSql.Append("AuditorName=@AuditorName,"); strSql.Append("AuditorTime=@AuditorTime,"); strSql.Append("FlagAudit=@FlagAudit,"); strSql.Append("AuditorOpinion=@AuditorOpinion,"); strSql.Append("FlagDel=@FlagDel"); strSql.Append(" where FlagDel=0 and ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ProcessId", SqlDbType.Int, 4), new SqlParameter("@BillSign", SqlDbType.VarChar, 50), new SqlParameter("@BillId", SqlDbType.Int, 4), new SqlParameter("@OrderId", SqlDbType.Int, 4), new SqlParameter("@PostId", SqlDbType.Int, 4), new SqlParameter("@PostName", SqlDbType.NVarChar, 10), new SqlParameter("@AuditorId", SqlDbType.NChar, 10), new SqlParameter("@AuditorName", SqlDbType.NVarChar, 20), new SqlParameter("@AuditorTime", SqlDbType.DateTime), new SqlParameter("@FlagAudit", SqlDbType.Int, 4), new SqlParameter("@AuditorOpinion", SqlDbType.NVarChar, 100), new SqlParameter("@FlagDel", SqlDbType.Bit, 1), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.ProcessId; parameters[1].Value = model.BillSign; parameters[2].Value = model.BillId; parameters[3].Value = model.OrderId; parameters[4].Value = model.PostId; parameters[5].Value = model.PostName; parameters[6].Value = model.AuditorId; parameters[7].Value = model.AuditorName; parameters[8].Value = model.AuditorTime; parameters[9].Value = model.FlagAudit; parameters[10].Value = model.AuditorOpinion; parameters[11].Value = model.FlagDel; parameters[12].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); return(rows); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.System.sys_Process_Exec model, out string message) { message = "修改成功!"; int rows = dal.Update(model); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { return(true); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.System.sys_Process_Exec model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into sys_Process_Exec("); strSql.Append("ProcessId,BillSign,BillId,OrderId,PostId,PostName,AuditorId,AuditorName,AuditorTime,FlagAudit,AuditorOpinion,FlagDel)"); strSql.Append(" values ("); strSql.Append("@ProcessId,@BillSign,@BillId,@OrderId,@PostId,@PostName,@AuditorId,@AuditorName,@AuditorTime,@FlagAudit,@AuditorOpinion,@FlagDel)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@ProcessId", SqlDbType.Int, 4), new SqlParameter("@BillSign", SqlDbType.VarChar, 50), new SqlParameter("@BillId", SqlDbType.Int, 4), new SqlParameter("@OrderId", SqlDbType.Int, 4), new SqlParameter("@PostId", SqlDbType.Int, 4), new SqlParameter("@PostName", SqlDbType.NVarChar, 10), new SqlParameter("@AuditorId", SqlDbType.NChar, 10), new SqlParameter("@AuditorName", SqlDbType.NVarChar, 20), new SqlParameter("@AuditorTime", SqlDbType.DateTime), new SqlParameter("@FlagAudit", SqlDbType.Int, 4), new SqlParameter("@AuditorOpinion", SqlDbType.NVarChar, 100), new SqlParameter("@FlagDel", SqlDbType.Bit, 1) }; parameters[0].Value = model.ProcessId; parameters[1].Value = model.BillSign; parameters[2].Value = model.BillId; parameters[3].Value = model.OrderId; parameters[4].Value = model.PostId; parameters[5].Value = model.PostName; parameters[6].Value = model.AuditorId; parameters[7].Value = model.AuditorName; parameters[8].Value = model.AuditorTime; parameters[9].Value = model.FlagAudit; parameters[10].Value = model.AuditorOpinion; parameters[11].Value = model.FlagDel; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public SCZM.Model.System.sys_Process_Exec GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,ProcessId,BillSign,BillId,OrderId,PostId,PostName,AuditorId,AuditorName,AuditorTime,FlagAudit,AuditorOpinion,FlagDel from sys_Process_Exec "); strSql.Append(" where FlagDel=0 and ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; SCZM.Model.System.sys_Process_Exec model = new SCZM.Model.System.sys_Process_Exec(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 子方法 从DataRow中 /// </summary> public SCZM.Model.System.sys_Process_Exec DataRowToModel(DataRow row) { SCZM.Model.System.sys_Process_Exec model = new SCZM.Model.System.sys_Process_Exec(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["ProcessId"] != null && row["ProcessId"].ToString() != "") { model.ProcessId = int.Parse(row["ProcessId"].ToString()); } if (row["BillSign"] != null) { model.BillSign = row["BillSign"].ToString(); } if (row["BillId"] != null && row["BillId"].ToString() != "") { model.BillId = int.Parse(row["BillId"].ToString()); } if (row["OrderId"] != null && row["OrderId"].ToString() != "") { model.OrderId = int.Parse(row["OrderId"].ToString()); } if (row["PostId"] != null && row["PostId"].ToString() != "") { model.PostId = int.Parse(row["PostId"].ToString()); } if (row["PostName"] != null) { model.PostName = row["PostName"].ToString(); } if (row["AuditorId"] != null) { model.AuditorId = row["AuditorId"].ToString(); } if (row["AuditorName"] != null) { model.AuditorName = row["AuditorName"].ToString(); } if (row["AuditorTime"] != null && row["AuditorTime"].ToString() != "") { model.AuditorTime = DateTime.Parse(row["AuditorTime"].ToString()); } if (row["FlagAudit"] != null && row["FlagAudit"].ToString() != "") { model.FlagAudit = int.Parse(row["FlagAudit"].ToString()); } if (row["AuditorOpinion"] != null) { model.AuditorOpinion = row["AuditorOpinion"].ToString(); } if (row["FlagDel"] != null && row["FlagDel"].ToString() != "") { if ((row["FlagDel"].ToString() == "1") || (row["FlagDel"].ToString().ToLower() == "true")) { model.FlagDel = true; } else { model.FlagDel = false; } } } return(model); }