Example #1
0
 /// <summary>
 /// 保存部门表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="departmentEntity">机构实体</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, DepartmentEntity departmentEntity)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         departmentEntity.Modify(keyValue);
         Base_Department depart = Base_Department.SingleOrDefault("where DepartmentId=@0", keyValue);
         depart = EntityConvertTools.CopyToModel <DepartmentEntity, Base_Department>(departmentEntity, depart);
         depart.DepartmentId = keyValue;
         depart.Update();
     }
     else
     {
         departmentEntity.Create();
         Base_Department depart = EntityConvertTools.CopyToModel <DepartmentEntity, Base_Department>(departmentEntity, null);
         depart.Insert();
     }
 }
Example #2
0
        /// <summary>
        /// 部门实体
        /// </summary>
        /// <param name="keyValue">主键值</param>
        /// <returns></returns>
        public DepartmentEntity GetEntity(string keyValue)
        {
            var model = Base_Department.SingleOrDefault("where DepartmentId=@0", keyValue);

            return(EntityConvertTools.CopyToModel <Base_Department, DepartmentEntity>(model, null));
        }