public void CreatRole(VSEC_ROLE_MST vsec_role_mst)
        {
            try
            {
                if (vsec_role_mst != null)
                {
                    VSEC_ROLE_MST obj = new VSEC_ROLE_MST
                    {
                        RoleId      = 0,
                        RoleSName   = vsec_role_mst.RoleSName,
                        DisplayName = vsec_role_mst.DisplayName,
                        ActiveFlag  = "Y",
                        Status      = "A",
                        MC_Status   = "A",
                        CreatedBy   = vsec_role_mst.CreatedBy,
                        CreatedOn   = DateTime.Now
                    };

                    _db.VSEC_ROLE_MST.Add(obj);
                    _db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public void CreateProfile(VSEC_PROFILE_MST vsec_profile_mst)
        {
            try
            {
                if (vsec_profile_mst != null)
                {
                    VSEC_PROFILE_MST obj = new VSEC_PROFILE_MST
                    {
                        ProfileID      = 0,
                        ProfileName    = vsec_profile_mst.ProfileName,
                        PwdExpDays     = vsec_profile_mst.PwdExpDays,
                        PwdRetryCount  = vsec_profile_mst.PwdRetryCount,
                        PwdGracePeriod = vsec_profile_mst.PwdGracePeriod,
                        NoofSessions   = vsec_profile_mst.NoofSessions,
                        Status         = "A",
                        MC_Status      = "A",
                        CreatedBy      = vsec_profile_mst.CreatedBy,
                        CreatedOn      = DateTime.Now
                    };

                    _db.VSEC_PROFILE_MST.Add(obj);
                    _db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public void CreatUser(VW_UserDetail vw_userdetail)
        {
            try
            {
                if (vw_userdetail != null)
                {
                    VSEC_USER_MST vsec_user_mst = new VSEC_USER_MST
                    {
                        UserMstID  = _db.VSEC_USER_MST.Max(m => m.UserMstID) + 1,
                        FirstName  = vw_userdetail.FirstName,
                        MiddleName = vw_userdetail.MiddleName,
                        LastName   = vw_userdetail.LastName,
                        FatherName = vw_userdetail.FatherName,
                        DOB        = vw_userdetail.DOB,
                        Gender     = vw_userdetail.Gender,
                        Email      = vw_userdetail.Email,
                        Address1   = vw_userdetail.Address1,
                        Address2   = vw_userdetail.Address2,
                        Address3   = vw_userdetail.Address3,
                        ContactNo  = vw_userdetail.ContactNo,
                        Status     = vw_userdetail.Status == "true" ? "A" : "D",
                        MC_Status  = vw_userdetail.Status == "true" ? "A" : "D",
                        CreatedBy  = vw_userdetail.CreatedBy,
                        CreatedOn  = DateTime.Now,
                        P1         = vw_userdetail.P1
                    };

                    VSEC_LOGIN_MST vsec_login_mst = new VSEC_LOGIN_MST
                    {
                        LoginMId     = 0,
                        LoginID      = vw_userdetail.LoginID,
                        ProfileId    = vw_userdetail.ProfileId,
                        ActiveStatus = vw_userdetail.Status == "true" ? "Y" : "N",
                        Password     = vw_userdetail.RPassword,
                        CreatedBy    = vw_userdetail.CreatedBy,
                        CreatedOn    = DateTime.Now
                    };

                    _db.VSEC_USER_MST.Add(vsec_user_mst);

                    using (System.Data.Entity.DbContextTransaction dbTran = _db.Database.BeginTransaction())
                    {
                        try
                        {
                            _db.SaveChanges();

                            vsec_login_mst.UserMstID = _db.VSEC_USER_MST.Max(m => m.UserMstID);
                            _db.VSEC_LOGIN_MST.Add(vsec_login_mst);

                            _db.SaveChanges();

                            dbTran.Commit();
                        }
                        catch (System.Data.Entity.Validation.DbEntityValidationException e)
                        {
                            dbTran.Rollback();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
 public void Save()
 {
     context.SaveChanges();
 }