private bool Save(Framework.Task.Task task, ref string errmsg) { bool result = true; BaseDao baseDao = new BaseDao(); XtmDepart entity = task.Entity as XtmDepart; XtmDepartService service = new XtmDepartService(); result = service.Validate("all", entity, ref errmsg); if (result == false) { return(false); } if (entity.Did != 0 && entity.ParentId != 0) { if (entity.Did == entity.ParentId) { errmsg = "自己不能为自己的隶属机构"; return(false); } } if (entity.ParentId == 0) { entity.DepartLayer = 1; } else { XtmDepart parDep = new XtmDepart(); parDep.Did = entity.ParentId; parDep = baseDao.Get(parDep); entity.DepartLayer = parDep.DepartLayer + 1; } if (entity.Did > 0) { baseDao.Update(entity); } else { XtmDepart temp = new XtmDepart(); temp.DepartCode = entity.DepartCode; int count = baseDao.Count(temp); if (count > 0) { errmsg = "该机构代码已经被使用"; return(false); } baseDao.Insert(entity); } if (result == true) { errmsg = "保存成功"; task.ParentRebind = true; task.IsClose = true; } return(result); }
private bool Delete(Framework.Task.Task task, ref string errmsg) { XtmDepart delModel = new XtmDepart(); delModel.SysKey = task.CommandArgument; BaseDao baseDao = new BaseDao(); XtmDepart temp = new XtmDepart(); temp.ParentId = delModel.Did; int count = baseDao.Count(temp); if (count > 0) { errmsg = "该部门底下挂有子部门,不允许删除"; return(false); } XtmUser userM = new XtmUser(); userM.DepartId = delModel.Did; count = baseDao.Count(userM); if (count > 0) { errmsg = "该部门底下挂有人员,不允许删除"; return(false); } try { baseDao.Delete(delModel); } catch (Exception ex) { errmsg = ex.Message; return(false); } if (errmsg != "") { return(false); } errmsg = "删除成功"; task.Rebind = true; return(true); }
public bool CheckExist(string specName) { YwSpec t1 = new YwSpec(); t1.SpecName = specName; int count = baseDao.Count(t1); if (count > 0) { return(true); } return(false); }
public bool CheckExist(string Txm) { YwTxjs t1 = new YwTxjs(); t1.Txm = Txm; int count = baseDao.Count(t1); if (count > 0) { return(true); } return(false); }
public bool CheckExist(Yw_txm entity) { Yw_txm model = new Yw_txm(); model.Txm = entity.Txm; int count = baseDao.Count(model); if (count > 0) { return(false); } return(true); }
private bool Save(Framework.Task.Task task, ref string errmsg) { bool result = true; BaseDao baseDao = new BaseDao(); XtmUser entity = task.Entity as XtmUser; XtmUserService service = new XtmUserService(); result = service.Validate("all", entity, ref errmsg); if (result == false) { return(false); } if (entity.Did > 0) { baseDao.Update(entity); } else { XtmUser temp = new XtmUser(); temp.UserCode = entity.UserCode; int count = baseDao.Count(temp); if (count > 0) { errmsg = "该人员代码已经被使用"; return(false); } entity.UserPwd = HuiYuIfo.Framework.Library.Encry.Encode(entity.UserCode + "123"); baseDao.Insert(entity); } if (result == true) { errmsg = "保存成功"; task.ParentRebind = true; task.IsClose = true; } return(result); }
private bool Save(Framework.Task.Task task, ref string errmsg) { bool result = true; YwTxjsService service = new YwTxjsService(); YwTxjs entity = task.Entity as YwTxjs; if (service.Validate("all", entity, ref errmsg) == false) { return(false); } BaseDao baseDao = new BaseDao(); if (entity.Did > 0) { baseDao.Update(entity); } else { YwTxjs temp = new YwTxjs(); temp.Txm = entity.Txm; int count = baseDao.Count(temp); if (count > 0) { errmsg = "该推修码已经被定义"; return(false); } baseDao.Insert(entity); } if (result == true) { errmsg = "保存成功"; task.ParentRebind = true; task.IsClose = true; } return(result); }
public bool CheckExist(YwCyh entity) { YwCyh temp = new YwCyh(); temp.Xz = entity.Xz; temp.Dbdsz = entity.Dbdsz; temp.Dbjq = entity.Dbjq; temp.Sxflx = entity.Sxflx; temp.Wfglcxcs = entity.Wfglcxcs; temp.Ywly = entity.Ywly; temp.Zhcxcs = entity.Zhcxcs; temp.Synx = entity.Synx; temp.Sfbcs = entity.Sfbcs; temp.Pfvsfc100 = entity.Pfvsfc100; temp.Cx3c = entity.Cx3c; int count = baseDao.Count(temp); if (count > 0) { return(true); } return(false); }
public virtual int Count(string where, object par) { return(BaseCrudDao.Count(where, par)); }