Beispiel #1
0
        public static void CreateNewEqRequest(NewEqRequestModel model)
        {
            using (var context = new BEMSContext())
            {
                model.ID = "NEWEQ_" + DateTime.Now.ToString("yyyyMMddHHmmss");
                context.FlowNewEqRequests.Add(new EF.DBModels.FlowNewEqRequest()
                {
                    ID          = model.ID,
                    Amount      = model.Amount,
                    EModel      = model.EModel,
                    EType       = model.EType,
                    Memo        = model.Memo,
                    Requester   = model.Requester,
                    RequestTime = model.RequestTime,
                    IsComplete  = model.IsComplete
                });

                context.FlowProgress.Add(new EF.DBModels.FlowProgress
                {
                    FlowType        = "NEWEQ",
                    Assignee        = model.Assignee,
                    AssignTime      = model.RequestTime,
                    Comments        = string.Empty,
                    CurrentFlowStep = model.CurrentFlowIndex.Value,
                    TicketID        = model.ID,
                    LastUpdateBy    = model.Requester,
                    LastUpdateTime  = model.RequestTime
                });

                context.SaveChanges();
            }
        }
Beispiel #2
0
 public static UserModel CheckLogin(string accountName, string Pwd)
 {
     using (var context = new BEMSContext())
     {
         var user = context.Users.SingleOrDefault(a => a.AccountName.Equals(accountName) && a.Password.Equals(Pwd));
         if (user != null)
         {
             return(new UserModel()
             {
                 AccountName = user.AccountName,
                 Address = user.Address,
                 CreateBy = user.CreateBy,
                 CreateTime = user.CreateTime,
                 DisplayName = user.DisplayName,
                 ID = user.ID,
                 LastModifyBy = user.LastModifyBy,
                 LastModifyTime = user.LastModifyTime,
                 Memo = user.Memo,
                 Phone = user.Phone,
                 State = user.State
             });
         }
         else
         {
             throw new Exception("用户名或密码错误!");
         }
     }
 }
Beispiel #3
0
 public static void CreateUser(UserModel userData)
 {
     using (var context = new BEMSContext())
     {
         var user = context.Users.SingleOrDefault(a => a.AccountName.Equals(userData.AccountName));
         if (user != null)
         {
             throw new ArgumentException("账号已存在");
         }
         context.Users.Add(new Users()
         {
             AccountName    = userData.AccountName,
             Address        = userData.Address,
             CreateBy       = userData.CreateBy,
             CreateTime     = userData.CreateTime,
             DisplayName    = userData.DisplayName,
             LastModifyBy   = userData.LastModifyBy,
             LastModifyTime = userData.LastModifyTime,
             Memo           = userData.Memo,
             Password       = userData.Password,
             Phone          = userData.Phone,
             State          = userData.State
         });
         context.SaveChanges();
     }
 }
Beispiel #4
0
 public static List <Users> GetAllUsers()
 {
     using (var context = new BEMSContext())
     {
         var list = context.Users.ToList();
         return(list);
     }
 }
Beispiel #5
0
 public static void UpdateUser(UserModel userData)
 {
     using (var context = new BEMSContext())
     {
         var user = context.Users.SingleOrDefault(a => a.ID == userData.ID);
         if (user != null)
         {
             user.Address        = userData.Address;
             user.DisplayName    = userData.DisplayName;
             user.LastModifyBy   = userData.LastModifyBy;
             user.LastModifyTime = userData.LastModifyTime;
             user.Memo           = userData.Memo;
             user.Phone          = userData.Phone;
         }
         else
         {
             throw new NullReferenceException("用户不存在!");
         }
         context.SaveChanges();
     }
 }