public InterfaceRet DelTrainman(string data) { _ret.Clear(); try { //反序列化传入的参数 Get_InDelTrainmanMgr input = Newtonsoft.Json.JsonConvert.DeserializeObject <Get_InDelTrainmanMgr>(data); DBTrainman db = new DBTrainman(); if (!db.CheckIsCanUpdata(input.TrainmanGUID)) { throw new Exception("请将该人员移除名牌后,再进行修改操作!"); } if (!db.CheckIsCanUpdataByPlan(input.TrainmanGUID)) { throw new Exception("该司机有出勤计划,不能删除!"); } if (!db.CheckIsCanDelUnRun(input.TrainmanGUID)) { throw new Exception("该司机处于请假状态,不能删除"); } //获取待删除人员的所有信息 _ret.result = 1; _ret.resultStr = "未找到要修改的人员,刷新后再试!"; DBTrainman.Tm tm = db.getTmByID(input.TrainmanGUID); if (db.DelTrainman(input.TrainmanGUID)) { _ret.result = 0; _ret.resultStr = "返回成功"; AddLog(3, "", input.TrainmanGUID, strIdentifier_user); //添加名牌变动日志 db.addLog4DelTrainMan(tm, input.DutyUserGUID, input.DutyUserNumber, input.DutyUserName); } } catch (Exception ex) { _ret.result = 1; _ret.resultStr = "提交失败:" + ex.Message; } return(_ret); }
public void UpdateTrainJiaoLu(TmOrg input, DBTrainman.Tm tm) { if (string.IsNullOrEmpty(input.TrainmanNumber)) { throw new Exception("传入人员工号为空,无法修改"); } DBTrainman db = new DBTrainman(); //判断是否在牌 如果在牌 则需要移除 if (!db.CheckIsCanUpdata(tm.strTrainmanGUID)) { throw new Exception("请将该人员移除名牌后,再进行修改操作!"); } //执行修改操作 if (!db.UpdateTrainJiaolu(tm.strTrainmanGUID, input.TrainJiaoluGUID)) { throw new Exception("未找到待修改的人员!"); } //添加名牌变动日志 db.addLog4UpdateTrainmanJiaolu(tm, input.TrainJiaoluGUID, input.DutyUserGUID, input.DutyUserNumber, input.DutyUserName); }