public ReturnValue Update(Department model) { OleDbParameter[] parameters = { new OleDbParameter("@UPDATER_ID", OleDbType.VarWChar,12), new OleDbParameter("@TERMINAL_CD", OleDbType.LongVarWChar), new OleDbParameter("@Name", OleDbType.LongVarWChar), new OleDbParameter("@Notes", OleDbType.LongVarWChar), new OleDbParameter("@ID", OleDbType.Char,50)}; parameters[0].Value = model.UPDATER_ID; parameters[1].Value = model.TERMINAL_CD; parameters[2].Value = model.Name; parameters[3].Value = model.Notes; parameters[4].Value = model.ID; return OleDbHelper.ExecuteSql(_update_SQL, parameters); }
/// <summary> /// AddUpdateDepartment /// </summary> /// <param name="model"></param> /// <returns></returns> public ReturnValue AddUpdateDepartment(Department model) { ReturnValue resoult = dalDepartment.Search(model.ID); if (!resoult.ErrorFlag) { return resoult; } if (resoult.Count > 0) { resoult = dalDepartment.GetList(" and ID <> '" + model.ID + "' and Name = '"+model.Name+"'"); if (!resoult.ErrorFlag) { return resoult; } if (resoult.Count > 0) { resoult.ErrorFlag = false; resoult.ErrorID = "�ò��������Ѿ����ڣ�"; return resoult; } resoult = dalDepartment.Update(model); } else { resoult = dalDepartment.GetList(" and Name = '" + model.Name + "'"); if (!resoult.ErrorFlag) { return resoult; } if (resoult.Count > 0) { resoult.ErrorFlag = false; resoult.ErrorID = "�ò��������Ѿ����ڣ�"; return resoult; } resoult = dalDepartment.Add(model); } return resoult; }