예제 #1
0
 /// <summary>
 /// 编辑员工
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateYJEmployeeExt(Jinher.AMP.BTP.Deploy.YJEmployeeDTO input)
 {
     try
     {
         Guid UserId = CBCSV.GetUserIdByAccount(input.UserAccount);
         //if (UserId == Guid.Empty || UserId == null)
         //{
         //    return new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO { isSuccess = false, Message = "该用户不是易捷用户!" };
         //}
         var UserInfo = YJEmployee.ObjectSet().FirstOrDefault(p => p.Id != input.Id & p.AppId == input.AppId & p.UserAccount == input.UserAccount & p.IsDel != 1);
         if (UserInfo != null)
         {
             return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                 isSuccess = false, Message = "该用户已存在!"
             });
         }
         ContextSession contextSession = ContextFactory.CurrentThreadContext;
         var            YJEmp          = YJEmployee.ObjectSet().FirstOrDefault(_ => _.Id == input.Id);
         YJEmp.UserId      = UserId;
         YJEmp.UserCode    = input.UserCode;
         YJEmp.UserAccount = input.UserAccount;
         YJEmp.UserName    = input.UserName;
         YJEmp.IdentityNum = input.IdentityNum;
         YJEmp.Phone       = input.Phone;
         YJEmp.Area        = input.Area;
         YJEmp.StationCode = input.StationCode;
         YJEmp.StationName = input.StationName;
         YJEmp.ModifiedId  = ContextDTO.LoginUserID;
         YJEmp.ModifiedOn  = DateTime.Now;
         YJEmp.IsManager   = input.IsManager;
         if (YJEmp.IsManager == 1)
         {
             YJEmp.Department = input.Department;
             YJEmp.Station    = input.Station;
         }
         else
         {
             YJEmp.Department = "";
             YJEmp.Station    = "";
         }
         YJEmp.EntityState = EntityState.Modified;
         contextSession.SaveObject(YJEmp);
         contextSession.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.Error("YJEmployeeBP.UpdateYJEmployeeExt 异常", ex);
         return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
             isSuccess = false, Message = ex.Message
         });
     }
     LogHelper.Info("员工修改日志" + JsonHelper.JsonSerializer(input) + "修改人" + ContextDTO.LoginUserID + "修改时间" + DateTime.Now);
     return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
         isSuccess = true, Message = "修改成功"
     });
 }
예제 #2
0
 /// <summary>
 /// 新建员工
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO AddYJEmployeeExt(Jinher.AMP.BTP.Deploy.YJEmployeeDTO input)
 {
     try
     {
         Guid UserId = CBCSV.GetUserIdByAccount(input.UserAccount);
         //if (UserId == Guid.Empty || UserId == null)
         //{
         //    return new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO { isSuccess = false, Message = "该用户不是易捷用户!" };
         //}
         var UserInfo = YJEmployee.ObjectSet().FirstOrDefault(p => (p.UserAccount == input.UserAccount || p.IdentityNum == input.IdentityNum) && p.AppId == p.AppId && p.IsDel == 0);
         if (UserInfo != null)
         {
             return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
                 isSuccess = false, Message = "该用户已存在!"
             });
         }
         ContextSession contextSession = ContextFactory.CurrentThreadContext;
         YJEmployee     YJEmp          = YJEmployee.CreateYJEmployee();
         YJEmp.UserId      = UserId;
         YJEmp.UserCode    = input.UserCode;
         YJEmp.UserAccount = input.UserAccount;
         YJEmp.UserName    = input.UserName;
         YJEmp.IdentityNum = input.IdentityNum;
         YJEmp.Phone       = input.Phone;
         YJEmp.Area        = input.Area;
         YJEmp.StationCode = input.StationCode;
         YJEmp.StationName = input.StationName;
         YJEmp.IsDel       = 0;
         YJEmp.SubId       = ContextDTO.LoginUserID;
         YJEmp.SubOn       = DateTime.Now;
         YJEmp.AppId       = input.AppId;
         YJEmp.IsManager   = input.IsManager;
         if (YJEmp.IsManager == 1)
         {
             YJEmp.Department = input.Department;
             YJEmp.Station    = input.Station;
         }
         else
         {
             YJEmp.Department = "";
             YJEmp.Station    = "";
         }
         contextSession.SaveObject(YJEmp);
         contextSession.SaveChanges();
     }
     catch (Exception ex)
     {
         LogHelper.Error("YJEmployeeBP.AddYJEmployeeExt 异常", ex);
         return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
             isSuccess = false, Message = ex.Message
         });
     }
     return(new Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO {
         isSuccess = true, Message = "添加成功"
     });
 }
예제 #3
0
 /// <summary>
 /// 编辑员工
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateYJEmployee(Jinher.AMP.BTP.Deploy.YJEmployeeDTO input)
 {
     base.Do();
     return(this.Command.UpdateYJEmployee(input));
 }
예제 #4
0
 /// <summary>
 /// 编辑员工
 /// </summary>
 public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO UpdateYJEmployee(Jinher.AMP.BTP.Deploy.YJEmployeeDTO input)
 {
     base.Do(false);
     return(this.UpdateYJEmployeeExt(input));
 }