示例#1
0
        public String getEmpName(String empid)
        {
            tbEmp emp = new tbEmp();

            emp = _repository.getProfileAttributes(empid);
            String empname = emp == null ? string.Empty : emp.EmpName ?? string.Empty;

            return(empname);
        }
示例#2
0
        public ActionResult EditProfile()
        {
            String empID = HttpContext.User.Identity.Name;
            var emp = new tbEmp();
            emp.EmpID = empID;
            ProfileService profileService=new ProfileService();
            emp.EmpName = profileService.getEmpName(empID) == null ? String.Empty : profileService.getEmpName(empID);
            emp.Phone = profileService.getPhone(empID) == null ? String.Empty : profileService.getPhone(empID);
            emp.Location = profileService.getLocation(empID) == null ? String.Empty : profileService.getLocation(empID);
            emp.Email = profileService.getEmail(empID) == null ? String.Empty : profileService.getEmail(empID);

            return View(emp);
        }
示例#3
0
        public ActionResult EditProfile(tbEmp emp)
        {
            ProfileService profileService = new ProfileService();

            if (profileService.setProfileAttributes(emp))
            {
                return(View(emp));
            }
            else
            {
                return
                    (View("Error"));
            }
        }
示例#4
0
        public ActionResult EditProfile()
        {
            String empID = HttpContext.User.Identity.Name;
            var    emp   = new tbEmp();

            emp.EmpID = empID;
            ProfileService profileService = new ProfileService();

            emp.EmpName  = profileService.getEmpName(empID) == null ? String.Empty : profileService.getEmpName(empID);
            emp.Phone    = profileService.getPhone(empID) == null ? String.Empty : profileService.getPhone(empID);
            emp.Location = profileService.getLocation(empID) == null ? String.Empty : profileService.getLocation(empID);
            emp.Email    = profileService.getEmail(empID) == null ? String.Empty : profileService.getEmail(empID);

            return(View(emp));
        }
示例#5
0
        public bool setProfileAttributes(tbEmp emp)
        {
            try
            {
                CSCPortalDataContext _dataContext = new CSCPortalDataContext();
                var empchanged = (from emp1 in _dataContext.tbEmps
                                  select emp1).Where(x => x.EmpID == emp.EmpID).FirstOrDefault();
                empchanged.EmpName  = emp.EmpName;
                empchanged.Location = emp.Location;
                empchanged.Phone    = emp.Phone;
                empchanged.Email    = emp.Email;

                _dataContext.SubmitChanges();
            }
            catch (Exception e)
            {
                return(false);
            }
            return(true);
        }
示例#6
0
        public MembershipCreateStatus CreateUser(string userName, string password, string email, String empname)
        {
            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentException("Value cannot be null or empty.", "userName");
            }
            if (String.IsNullOrEmpty(password))
            {
                throw new ArgumentException("Value cannot be null or empty.", "password");
            }
            if (String.IsNullOrEmpty(email))
            {
                throw new ArgumentException("Value cannot be null or empty.", "email");
            }

            MembershipCreateStatus status = new MembershipCreateStatus();

            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    _provider.CreateUser(userName, password, email, null, null, true, null, out status);
                    var emp = new tbEmp();
                    emp.EmpID   = userName;
                    emp.Email   = email;
                    emp.EmpName = empname;
                    _dataContext.tbEmps.InsertOnSubmit(emp);
                    _dataContext.SubmitChanges();
                    scope.Complete();
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
            }
            return(status);
        }
示例#7
0
        public bool setProfileAttributes(tbEmp emp)
        {
            var status = _repository.setProfileAttributes(emp);

            return(status);
        }
示例#8
0
 public bool setProfileAttributes(tbEmp emp)
 {
     var status=_repository.setProfileAttributes(emp);
        return status;
 }
示例#9
0
 public String getEmpName(String empid)
 {
     tbEmp emp = new tbEmp();
       emp=_repository.getProfileAttributes(empid) ;
     String empname = emp==null ? string.Empty : emp.EmpName?? string.Empty;
     return empname;
 }
示例#10
0
        public bool setProfileAttributes(tbEmp emp)
        {
            try
            {
                CSCPortalDataContext _dataContext = new CSCPortalDataContext();
                var empchanged=(from emp1 in _dataContext.tbEmps
                                select emp1).Where(x=> x.EmpID==emp.EmpID).FirstOrDefault();
                empchanged.EmpName=emp.EmpName;
                empchanged.Location=emp.Location;
                empchanged.Phone=emp.Phone;
                empchanged.Email = emp.Email;

                _dataContext.SubmitChanges();
            }
            catch (Exception e)
            {
                return false;
            }
            return true;
        }
示例#11
0
        public MembershipCreateStatus CreateUser(string userName, string password, string email,String empname)
        {
            if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName");
                if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password");
                if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email");

                MembershipCreateStatus status= new MembershipCreateStatus();
                try
                {
                    using (TransactionScope scope = new TransactionScope())
                    {

                        _provider.CreateUser(userName, password, email, null, null, true, null, out status);
                        var emp = new tbEmp();
                        emp.EmpID = userName;
                        emp.Email = email;
                        emp.EmpName = empname;
                        _dataContext.tbEmps.InsertOnSubmit(emp);
                        _dataContext.SubmitChanges();
                        scope.Complete();

                    }
                }
                catch (Exception e)
                {
                }
                finally
                {
                }
                return status;
        }
示例#12
0
 public ActionResult EditProfile(tbEmp emp)
 {
     ProfileService profileService = new ProfileService();
     if (profileService.setProfileAttributes(emp))
         return View(emp);
     else
         return
             View("Error");
 }