コード例 #1
0
 public static DAL.Clerk DtoToDAL(ClerkDTO clerkDTO)
 {
     DAL.Clerk clerkDAL = new DAL.Clerk();
     clerkDAL.ClerkKey      = clerkDTO.ClerkKey;
     clerkDAL.ClerkFName    = clerkDTO.ClerkFName;
     clerkDAL.ClerkLName    = clerkDTO.ClerkLName;
     clerkDAL.ClerkPassword = clerkDTO.ClerkPassword;
     clerkDAL.IfManager     = clerkDTO.IfManager;
     return(clerkDAL);
 }
コード例 #2
0
 public static ClerkDTO AddNewClerk(ClerkDTO newClerk, ref string message)
 {
     DAL.Clerk IfPasswordExists = db.Clerks.FirstOrDefault(c => c.ClerkPassword == newClerk.ClerkPassword);
     if (IfPasswordExists != null)
     {
         message = "סיסמא זו קיימת במערכת, אנא הקש סיסמא חדשה";
         return(null);
     }
     DAL.Clerk clerkDAL = DtoToDAL(newClerk);
     db.Clerks.Add(clerkDAL);
     db.SaveChanges();
     return(newClerk);
 }
コード例 #3
0
 public ClerkDTO(DAL.Clerk clerkDAL)
 {
     if (clerkDAL == null)
     {
         clerkDAL = new DAL.Clerk();
     }
     ;
     ClerkKey      = clerkDAL.ClerkKey;
     ClerkFName    = clerkDAL.ClerkFName;
     ClerkLName    = clerkDAL.ClerkLName;
     ClerkPassword = clerkDAL.ClerkPassword;
     IfManager     = clerkDAL.IfManager;
 }
コード例 #4
0
 public static ClerkDTO UpdateClerk(ClerkDTO updatedClerk, ref string message)
 {
     DAL.Clerk clerkToUpdate = db.Clerks.FirstOrDefault(c => c.ClerkKey == updatedClerk.ClerkKey);
     if (clerkToUpdate == null)
     {
         message = "לא נמצא משתמש מבוקש";
         return(null);
     }
     else
     {
         clerkToUpdate.ClerkFName    = updatedClerk.ClerkFName;
         clerkToUpdate.ClerkLName    = updatedClerk.ClerkLName;
         clerkToUpdate.ClerkPassword = updatedClerk.ClerkPassword;
         db.SaveChanges();
     }
     return(updatedClerk);
 }