예제 #1
0
        public int RegistryMember(Entities.User e)
        {
            try
            {
                using (MyDBDataContext db = new MyDBDataContext())
                {
                    int newUserId = InsertPersonalInformation(db, e);

                    Entities.UserInRole uir = new Entities.UserInRole();
                    uir.RolesId = 8;
                    uir.UserId  = newUserId;
                    uir.State   = false;
                    int memberRoleId = InsertMemberRole(db, uir);
                    if (memberRoleId <= 0)
                    {
                        Delete(newUserId);
                        return(memberRoleId);
                    }

                    return(newUserId);
                }
            }
            catch (Exception ex)
            {
                string data = className + " " + ex.Message.ToString();
                Logs.LogWrite(string.Format(Configs.ERROR_ACTION, data));
                return((int)Enums.Errors.INSERT_ERROR);
            }
        }
예제 #2
0
 public int InsertMemberRole(MyDBDataContext db, Entities.UserInRole e)
 {
     try
     {
         DataLayer.UserInRole u = new DataLayer.UserInRole();
         u.RolesId = e.RolesId;
         u.UserId  = e.UserId;
         u.State   = e.State;
         db.UserInRoles.InsertOnSubmit(u);
         db.SubmitChanges();
         return(u.Id);
     }
     catch (Exception ex)
     {
         string data = className + " " + ex.Message.ToString();
         Logs.LogWrite(string.Format(Configs.ERROR_ACTION, data));
         return((int)Enums.Errors.INSERT_ERROR);
     }
 }