/// <summary> /// 更新合同状态 /// </summary> /// <param name="modelList"></param> /// <returns></returns> public int UpdateContactWorkFlowStatus(IList <f_SRM_Result> modelList) { try { Dictionary <string, SqlParameter[]> Dict = new Dictionary <string, SqlParameter[]>(); int keyIndex = 0; StringBuilder strSql = new StringBuilder(); foreach (f_SRM_Result item in modelList) { strSql.Append("update f_SRM_Result set "); strSql.Append("WorkFlowStatus=@WorkFlowStatus"); strSql.Append(" where id=@id;"); SqlParameter[] parameters = { new SqlParameter("@WorkFlowStatus", SqlDbType.NVarChar, 50), new SqlParameter("@id", SqlDbType.UniqueIdentifier, 16) }; parameters[0].Value = item.WorkFlowStatus; parameters[1].Value = new Guid(item.id); Dict.Add(keyIndex + "&" + strSql.ToString(), parameters); strSql = new StringBuilder(); keyIndex++; } //执行数据库操作 int result = DbHelperSQL.ExecuteSqlListTrans(Dict); return(result); } catch (Exception ex) { return(0); } }
/// <summary> /// 更新合同模板信息 /// </summary> /// <param name="modelList"></param> /// <returns></returns> public int UpdateContactTemplet(IList <ContactTemplet> modelList) { try { Dictionary <string, SqlParameter[]> Dict = new Dictionary <string, SqlParameter[]>(); int keyIndex = 0; StringBuilder strSql = new StringBuilder(); SqlParameter[] param = null; foreach (ContactTemplet item in modelList) { strSql.Append("update ContactTemplet set "); //动态添加参数 if (item != null) { if (string.IsNullOrEmpty(item.ID.ToString())) { return(0); } param = SetUpdataSqlParamenter(ref strSql, item); Dict.Add(keyIndex + "&" + strSql.ToString(), param); strSql = new StringBuilder(); param = null; keyIndex++; } } //执行数据库操作 int result = DbHelperSQL.ExecuteSqlListTrans(Dict); return(result); } catch (Exception ex) { return(0); } }
/// <summary> /// 保存合同产品 /// </summary> /// <param name="modelList"></param> /// <returns></returns> public int AddContactProduct(IList <ContactProduct> modelList) { try { Dictionary <string, SqlParameter[]> Dict = new Dictionary <string, SqlParameter[]>(); int keyIndex = 0; StringBuilder strSql = new StringBuilder(); if (modelList != null) { strSql.Append(" delete from ContactProduct where CID='" + modelList[0].CID + "';");//删除原来的数据 Dict.Add(keyIndex + "&" + strSql.ToString(), null); strSql = new StringBuilder(); keyIndex++; foreach (ContactProduct item in modelList) { strSql.Append("insert into ContactProduct("); strSql.Append("ID,UnitPrice,PromiseDate,RequireDate,CRemark,CID,CType,ItemCode,CVersion,Classificatiion,ItemName,Unit,Quantity"); strSql.Append(") values ("); strSql.Append("@ID,@UnitPrice,@PromiseDate,@RequireDate,@CRemark,@CID,@CType,@ItemCode,@CVersion,@Classificatiion,@ItemName,@Unit,@Quantity"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@UnitPrice", SqlDbType.NVarChar, 20), new SqlParameter("@PromiseDate", SqlDbType.DateTime), new SqlParameter("@RequireDate", SqlDbType.DateTime), new SqlParameter("@CRemark", SqlDbType.NVarChar, 500), new SqlParameter("@CID", SqlDbType.UniqueIdentifier, 16), new SqlParameter("@CType", SqlDbType.NVarChar, 20), new SqlParameter("@ItemCode", SqlDbType.NVarChar, 100), new SqlParameter("@CVersion", SqlDbType.NVarChar, 20), new SqlParameter("@Classificatiion", SqlDbType.NVarChar, 20), new SqlParameter("@ItemName", SqlDbType.NVarChar, 100), new SqlParameter("@Unit", SqlDbType.NVarChar, 10), new SqlParameter("@Quantity", SqlDbType.NVarChar, 50) }; parameters[0].Value = Guid.NewGuid(); parameters[1].Value = item.UnitPrice; parameters[2].Value = item.PromiseDate; parameters[3].Value = item.RequireDate; parameters[4].Value = item.CRemark; parameters[5].Value = new Guid(item.CID); parameters[6].Value = item.CType; parameters[7].Value = item.ItemCode; parameters[8].Value = item.CVersion; parameters[9].Value = item.Classificatiion; parameters[10].Value = item.ItemName; parameters[11].Value = item.Unit; parameters[12].Value = item.Quantity; Dict.Add(keyIndex + "&" + strSql.ToString(), parameters); strSql = new StringBuilder(); parameters = null; keyIndex++; } } //执行数据库操作 int result = DbHelperSQL.ExecuteSqlListTrans(Dict); return(result); } catch (Exception ex) { return(0); } }