public ReturnValue Update(Proportion model) { SqlParameter[] parameters = { new SqlParameter("@UPDATER_ID", SqlDbType.NVarChar,12), new SqlParameter("@TERMINAL_CD", SqlDbType.NVarChar,255), new SqlParameter("@Type", SqlDbType.NVarChar,1), new SqlParameter("@DrugsCode", SqlDbType.NVarChar,50), new SqlParameter("@ProvinceCode", SqlDbType.NVarChar,50), new SqlParameter("@DrugsPrice", SqlDbType.Money,8), new SqlParameter("@Proportional", SqlDbType.Float,8)}; parameters[0].Value = model.UPDATER_ID; parameters[1].Value = model.TERMINAL_CD; parameters[2].Value = model.Type; parameters[3].Value = model.DrugsCode; parameters[4].Value = model.ProvinceCode; if (model.DrugsPrice == null) { parameters[5].Value = DBNull.Value; } else { parameters[5].Value = model.DrugsPrice; } if (model.Proportional == null) { parameters[6].Value = DBNull.Value; } else { parameters[6].Value = model.Proportional; } return SqlHelper.ExecuteSql(Update_SQL, parameters); }
public ReturnValue AddUpdate(Proportion model) { ReturnValue resoult = dal.GetListCount(model.Type, model.DrugsCode, model.ProvinceCode); if (!resoult.ErrorFlag) { return resoult; } if (resoult.Count > 0) { resoult = dal.Update(model); } else { resoult = dal.Insert(model); } return resoult; }