//获取推荐人ID
        public string getRecommendId()
        {
            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GeRecommendIdByWeiXinId] '" + GetUData.OpenId + "'");

            return(result.Tables[0].Rows[0]["Id"].ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            int userId = context.UserId;

            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 4)
            {
                userId = BitConverter.ToInt32(cmdData.Reverse(), 0);
            }

            if (Compiled.Debug)
            {
                cmdData.Debug("=== User.QueryUserExt 上行数据===");
                userId.Debug("=== User.QueryUserExt 上行数据===");
            }

            UserCacheInfo userCache = UserBiz.ReadUserCacheInfo(userId);

            if (null != userCache)
            {
                if (userId != context.UserId)
                {
                    UserPagePvLog log = new UserPagePvLog {
                        UserId = userId, VisitorId = context.UserId, CreateDate = DateTime.Now
                    };
                    LogsBiz.CreateLogs <UserPagePvLog>(log);
                }

                context.Flush <UserExt>(userCache.ToUserExt());
            }
            else
            {
                context.Flush(RespondCode.DataInvalid);
            }
        }
        private Guid getUserIdByRecommendId(string recommendId)
        {
            UserBiz userBiz = new UserBiz();
            DataSet result  = userBiz.ExecuteSqlToDataSet("EXEC [TireTreasureDB].[dbo].[proc_GetUserIdByRecommendId] '" + recommendId + "'");

            return((Guid)result.Tables[0].Rows[0]["UserId"]);
        }
        public async Task <IActionResult> GetHealthInformationAsync(string userGuid)
        {
            if (string.IsNullOrEmpty(userGuid))
            {
                return(Failed(ErrorCode.Empty, "请指定会员"));
            }

            var userBiz = new UserBiz();
            var model   = await userBiz.GetAsync(userGuid);

            if (model is null || !model.Enable)
            {
                return(Failed(ErrorCode.Empty, "指定会员不存在"));
            }

            var informationBiz = new HealthInformationBiz();
            var informations   = await informationBiz.GetHealthInformationList(userGuid);

            GetUserHealthInformationResponseDto result = new GetUserHealthInformationResponseDto
            {
                UserName              = model.UserName,
                Birthday              = model.Birthday,
                Gender                = model.Gender,
                IdentityNumber        = model.IdentityNumber,
                HealthInformationList = informations
            };

            return(Success(result));
        }
Esempio n. 5
0
        private void InitSchedule()
        {
            ScheduleBiz sb = new ScheduleBiz();
            Schedule    s  = sb.GetScheduleByS_ID(S_ID);

            CourseLB.Text            = s.C_Name;
            TeacherNameLB.Text       = s.T_Name;
            CourseStatusLB.Text      = s.StatusStr;
            CourseStatusLB.ForeColor = s.StatusBackColor;
            StartTimeLB.Text         = s.C_StartTime.ToString("yyyy-MM-dd HH:mm");
            EndTimeLB.Text           = s.C_EndTime.ToString("yyyy-MM-dd HH:mm");
            CourseIntroLB.Text       = s.C_Des;

            TaobaoLink.InnerText = s.TaobaoLink;

            switch (s.Status)
            {
            case 1: CancelBtn.Visible = false; break;

            case 2:
                UserBiz ub = new UserBiz();

                if (ub.IsUserBooked(U_ID, S_ID))
                {
                    BookBtn.Visible = false;
                }
                else
                {
                    CancelBtn.Visible = false; BookBtn.Visible = false;
                }
                break;

            default: CancelBtn.Visible = false; BookBtn.Visible = false; break;
            }
        }
 public UserRegistrationService()
 {
     UnitOfWork    = new CoreUnitOfWork();
     UserBiz       = new UserBiz(UnitOfWork);
     MembershipBiz = new MembershipBiz(UnitOfWork);
     Logger        = new ExceptionLogBiz(UnitOfWork);
 }
Esempio n. 7
0
        public IActionResult GetDoctorDetails(string doctorGuid)
        {
            var doctorBiz = new DoctorBiz();
            var model     = doctorBiz.GetDoctor(doctorGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var userBiz        = new UserBiz();
            var dictionaryBiz  = new DictionaryBiz();
            var accessoryBiz   = new AccessoryBiz();
            var topicBiz       = new TopicBiz();
            var dto            = model.ToDto <GetDoctorDetailsResponseDto>();
            var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(model.PortraitGuid);

            dto.DoctorName = userBiz.GetUser(doctorGuid)?.UserName;
            dto.Title      = dictionaryBiz.GetModelById(model.TitleGuid)?.ConfigName;
            dto.Portrait   = $"{accessoryModel?.BasePath}{accessoryModel?.RelativePath}";
            var signature = accessoryBiz.GetAccessoryModelByGuid(model.SignatureGuid);

            dto.SignatureUrl = $"{signature?.BasePath}{signature?.RelativePath}";

            dto.CommentScore       = new CommentBiz().GetTargetAvgScoreAsync(model.DoctorGuid).Result;
            dto.FansVolume         = new CollectionBiz().GetListCountByTarget(model.DoctorGuid);
            dto.ConsultationVolume = doctorBiz.GetDocotrConsultationVolumeAsync(model.DoctorGuid).Result;

            return(Success(dto));
        }
 public ProfileGeneralSettingsPM ReadProfileGeneralSettings(int userId)
 {
     return(UserBiz.Read(user => user.Id == userId)
            .Include(user => user.ProfileKeyValues)
            .Single()
            .GetProfileGeneralSettingsPM());
 }
Esempio n. 9
0
        public IActionResult GetAskedDoctorClassicQa([FromBody] GetAskedDoctorClassicQaRequestDto requestDto)
        {
            QaBiz qaBiz    = new QaBiz();
            var   qaModels = qaBiz.GetQaModels(requestDto.PageIndex, requestDto.PageSize, "where enable=true", "last_updated_date desc");

            if (qaModels == null)
            {
                return(Failed(ErrorCode.Empty));
            }

            DoctorBiz    doctorBiz    = new DoctorBiz();
            UserBiz      userBiz      = new UserBiz();
            AccessoryBiz accessoryBiz = new AccessoryBiz();
            LikeBiz      likeBiz      = new LikeBiz();
            List <GetAskedDoctorClassicQaResponseDto> dtos = new List <GetAskedDoctorClassicQaResponseDto>();

            foreach (var model in qaModels)
            {
                var dto = model.ToDto <GetAskedDoctorClassicQaResponseDto>();
                dto.DoctorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
                dto.LikeNumber = likeBiz.GetLikeNumByTargetGuid(model.QaGuid);
                var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);
                if (doctorModel != null)
                {
                    var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                    dto.DoctorPortrait = accessoryModel?.BasePath + accessoryModel?.RelativePath;
                }
                dtos.Add(dto);
            }
            return(Success(dtos));
        }
Esempio n. 10
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TextBoxUserName.Text))
            {
                ScriptHelper.AjaxAlertFocus(this.ButtonLogin,
                                            "Please input user name.", this.TextBoxUserName);
                return;
            }
            if (string.IsNullOrEmpty(TextBoxPassword.Text))
            {
                ScriptHelper.AjaxAlertFocus(this.ButtonLogin,
                                            "Please input password.", this.TextBoxPassword);
                return;
            }


            // UserBiz biz = new UserBiz();
            SysUserInfo user = UserBiz.Login(TextBoxUserName.Text, TextBoxPassword.Text);

            if (user != null)
            {
                this.Session["user"] = user;
                Response.Redirect("~/HomePage.aspx");

                // ScriptHelper.AjaxAlert(this.ButtonLogin, "Login Ok.");
                return;
            }
            else
            {
                ScriptHelper.AjaxAlertSelect(this.ButtonLogin,
                                             "User name or password error.",
                                             this.TextBoxUserName);
                return;
            }
        }
Esempio n. 11
0
        public IActionResult GetDoctorArticleDetails(string articleGuid)
        {
            ArticleBiz articleBiz = new ArticleBiz();
            var        model      = articleBiz.GetModel(articleGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var doctorBiz    = new DoctorBiz();
            var accessoryBiz = new AccessoryBiz();
            var userBiz      = new UserBiz();
            var likeBiz      = new LikeBiz();
            var richtextBiz  = new RichtextBiz();
            var dto          = model.ToDto <GetDoctorArticleDetailsResponseDto>();

            dto.Content    = richtextBiz.GetModel(model.ContentGuid)?.Content;
            dto.DoctorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
            var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);

            if (doctorModel != null)
            {
                var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                dto.DoctorPortrait = accessoryModel?.BasePath + accessoryModel?.RelativePath;
                dto.HospitalGuid   = doctorModel.HospitalGuid;
                dto.HospitalName   = doctorModel.HospitalName;
                dto.OfficeGuid     = doctorModel.OfficeGuid;
                dto.OfficeName     = doctorModel.OfficeName;
            }
            dto.LikeNumber = likeBiz.GetLikeNumByTargetGuid(articleGuid);
            dto.Liked      = likeBiz.GetLikeState(UserID, articleGuid);
            return(Success(dto));
        }
Esempio n. 12
0
 public LikeUnlikeBiz(MenuPathMainBiz menuPathMainBiz, UserBiz userBiz, /* ProductBiz productBiz, */ AbstractControllerParameters myWorkClasses, IRepositry <LikeUnlike> entityDal, BizParameters bizParameters)
     : base(entityDal, bizParameters)
 {
     _menuPathMainBiz = menuPathMainBiz;
     //_productBiz = productBiz;
     _userBiz = userBiz;
 }
Esempio n. 13
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            ContactsQuery query = cmdData.ProtoBufDeserialize <ContactsQuery>();

            if (Compiled.Debug)
            {
                query.Debug("=== Social.QueryFans 上行数据===");
            }

            int userId = query.TargetId == 0 ? context.UserId : query.TargetId;
            PageResult <UserFollowed> pageResult = SocialBiz.GetFollowedUserPageData(userId, query.QueryIndex, query.QuerySize);
            ContactsList result = new ContactsList
            {
                RecordCount = pageResult.RecordCount,
                QueryIndex  = pageResult.PageIndex,
                QuerySize   = pageResult.PageSize,
                IndexCount  = pageResult.PageCount,
                DataList    = pageResult.Data.Select(f => UserBiz.ReadUserCacheInfo(f.UserId).ToUserBase()).ToList()
            };

            context.Flush <ContactsList>(result);
        }
Esempio n. 14
0
        public void Initialize()
        {
            var services = new ServiceCollection();

            services.AddIOC();
            _biz = services.BuildServiceProvider().GetService <UserBiz>();
        }
Esempio n. 15
0
 //readonly AddressBiz _addressBiz;
 //readonly AddressBiz _addressBiz;
 public PersonBiz(IRepositry <Person> entityDal, BizParameters bizParameters, PersonCategoryBiz personCategoryBiz, UserBiz userBiz)
     : base(entityDal, bizParameters)
 {
     _userBiz = userBiz;
     //_addressBiz = addressBiz;
     _personCategoryBiz = personCategoryBiz;
 }
Esempio n. 16
0
 public ActionResult Register(UserRegisterVM u)
 {
     try
     {
         ///creating company
         UserBiz userBiz = new UserBiz();
         /// creating user
         CRMUser user = new CRMUser();
         user.Password    = u.Password;
         user.Username    = u.EmailId;
         user.CompanyName = u.CompanyName;
         user.CompanyId   = 0;
         string guid = userBiz.RegisterUser(user);
         //string CurrentURL = Request.Url.AbsoluteUri;
         string Msg = "Dear Customer,<br/><br/> Thank you for Registring with us<br/>" +
                      "Plese Click below link for Activation<br/><br/>" +
                      "<a href='http://*****:*****@gmail.com", "Company Registration", Msg, true);
         ViewBag.Message = "Succefully Registered";
         return(View("RegisterSuccess"));
     }
     catch (Exception Ex)
     {
         ModelState.AddModelError("VE", Ex.Message);
         return(View(u));
     }
 }
Esempio n. 17
0
        private void ChangePassword(object sender, EventArgs e)
        {
            if (CustomValidate())
            {
                var biz = new UserBiz();
                var currentUser = biz.Login(textUsername.Text, textPasswordOld.Text);

                if (currentUser == null)
                {
                    labelMessage.Text = ElectronicStore.Common.Constants.Messages.CannotChangePassword;
                }
                else
                {
                    string newPass = textPasswordNew.Text;
                    newPass = Utility.EncodePassword(newPass);

                    currentUser.Password = newPass;
                    biz.UpdateItem(currentUser);

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;

                    MessageBox.Show(ElectronicStore.Common.Constants.Messages.ChangePasswordSuccessful);

                    this.Close();
                }
            }
        }
Esempio n. 18
0
        public void Vote(VoteRequest request, IVoteView view)
        {
            UserBiz userBiz = new UserBiz();

            if (userBiz.GetCurrentUser().RandomCode != request.RandomCode)
            {
                view.ShowVoteResult("验证码错误");
            }
            else if (userBiz.GetCurrentUser().HaveVoteCount > 9)
            {
                view.ShowVoteResult("投票失败,您已经投过10张票啦~~");
            }
            else
            {
                VoteBiz biz = new VoteBiz();
                if (biz.Vote(new Vote()
                {
                    ProductId = request.ProductId, IP = request.IP
                }))
                {
                    userBiz.GetCurrentUser().HaveVoteCount++;
                    view.ShowVoteResult("投票成功");
                }
                else
                {
                    view.ShowVoteResult("投票失败,您所在的IP地址已经投过10张票啦~");
                }
            }
        }
Esempio n. 19
0
        public ActionResult MyProfile()
        {
            UserProfileViewModel myProfile = new UserProfileViewModel();

            //get user profile inromation from database if user is logged in
            if (Session["UID"] != null)
            {
                var id = Session["UID"];
                //get information from db
                long    UID     = Convert.ToInt64(id);
                UserBiz getUser = new UserBiz();
                CRMUser crmUser = new CRMUser();
                crmUser = getUser.GetUserProfile(UID);
                myProfile.CompanyName = crmUser.CompanyName;
                myProfile.Password    = crmUser.Password;
                myProfile.Username    = crmUser.Username;
                myProfile.FirstName   = crmUser.FirstName;
                myProfile.LastName    = crmUser.LastName;

                return(View(myProfile));
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="context">当前请求上下文应答实例</param>
        /// <param name="acount">账号信息</param>
        /// <param name="uAccount">用户账户信息</param>
        private static void UserSignIn(DataContext context, Account acount, UserAccount uAccount)
        {
            UserVaildInfo vaildInfo = UserBiz.GetUserVaildInfo(uAccount);

            string[] errMessages = new string[] { "密码错误!", "您的账号尚未通过验证!", "您的账号已被锁定,暂时无法登录!", "试用账号已过期!请更换其它账号登录!" };
            if (vaildInfo.UserId <= 0)
            {
                context.Flush(RespondCode.ShowError, errMessages[Math.Abs(vaildInfo.UserId)]);
                return;
            }

            //更新登录信息
            UserExtInfo extInfo = new UserExtInfo
            {
                UserId                  = vaildInfo.UserId,
                LastLoginDeviceId       = context.DeviceId,
                LastLoginAPPChannel     = context.ReqChannel,
                LastLoginAccountChannel = (int)acount.AccountChannel
            };

            UserBiz.UserSignIn(extInfo);

            //创建登录日志
            CreateSignInLog(context, acount, vaildInfo);

            //返回登录结果
            FlushResult(context, vaildInfo);
        }
        public IActionResult GetUserInfo(string userId)
        {
            if (string.IsNullOrWhiteSpace(userId))
            {
                userId = UserID;
            }
            var uBiz   = new UserBiz();
            var uModel = uBiz.GetUser(userId);

            if (uModel == null || !uModel.Enable)
            {
                return(Failed(ErrorCode.DataBaseError, "用户状态不可用。"));
            }
            var accBiz   = new AccessoryBiz();
            var accModel = accBiz.GetAccessoryModelByGuid(uModel.PortraitGuid);
            var outDto   = new GetUserInfoResponseDto
            {
                Portrait       = $"{accModel?.BasePath}{accModel?.RelativePath}", // +"/" 格式确认,
                NickName       = uModel.NickName,
                Gender         = uModel.Gender,
                Birthday       = uModel.Birthday,
                UserName       = uModel.UserName,
                IdentityNumber = uModel.IdentityNumber,
                Phone          = uModel.Phone
            };

            return(Success(outDto));
        }
Esempio n. 22
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            CourseQuery query = cmdData.ProtoBufDeserialize <CourseQuery>();

            if (Compiled.Debug)
            {
                query.Debug("=== School.QueryCourses 请求数据 ===");
            }

            UserCacheInfo userCache = UserBiz.ReadUserCacheInfo(context.UserId);

            if (userCache.UserSite > 0)
            {
                PageResult <CourseBase> pageResult = SchoolBiz.GetSchoolCoursePageList(userCache.UserSite, query.QueryIndex, query.QuerySize);
                CourseList result = new CourseList
                {
                    RecordCount = pageResult.RecordCount,
                    QueryIndex  = pageResult.PageIndex,
                    QuerySize   = pageResult.PageSize,
                    IndexCount  = pageResult.PageCount,
                    DataList    = pageResult.Data.Select(c => c.ToCourseInfo()).ToList()
                };
                context.Flush <CourseList>(result);
                return;
            }

            context.Flush(RespondCode.DataInvalid);
        }
Esempio n. 23
0
        public IActionResult GetAskedDoctorClassicQaDetails(string qaGuid)
        {
            var qaBiz         = new QaBiz();
            var doctorBiz     = new DoctorBiz();
            var accessoryBiz  = new AccessoryBiz();
            var userBiz       = new UserBiz();
            var likeBiz       = new LikeBiz();
            var dictionaryBiz = new DictionaryBiz();
            var model         = qaBiz.GetModel(qaGuid);

            if (model == null)
            {
                return(Failed(ErrorCode.Empty));
            }
            var dto = model.ToDto <GetAskedDoctorClassicQaDetailsResponseDto>();

            dto.DoctorName = userBiz.GetUser(model.AuthorGuid)?.UserName;
            var doctorModel = doctorBiz.GetDoctor(model.AuthorGuid);

            if (doctorModel != null)
            {
                var accessoryModel = accessoryBiz.GetAccessoryModelByGuid(doctorModel.PortraitGuid);
                dto.DoctorPortrait = $"{accessoryModel?.BasePath}{accessoryModel?.RelativePath}";
                dto.HospitalGuid   = doctorModel.HospitalGuid;
                dto.HospitalName   = doctorModel.HospitalName;
                dto.JobTitle       = dictionaryBiz.GetModelById(doctorModel.TitleGuid)?.ConfigName;
            }
            dto.LikeNumber = likeBiz.GetLikeNumByTargetGuid(qaGuid);
            dto.Liked      = likeBiz.GetLikeState(UserID, qaGuid);
            return(Success(dto));
        }
Esempio n. 24
0
        private void ChangePassword(object sender, EventArgs e)
        {
            if (CustomValidate())
            {
                var biz         = new UserBiz();
                var currentUser = biz.Login(textUsername.Text, textPasswordOld.Text);

                if (currentUser == null)
                {
                    labelMessage.Text = ElectronicStore.Common.Constants.Messages.CannotChangePassword;
                }
                else
                {
                    string newPass = textPasswordNew.Text;
                    newPass = Utility.EncodePassword(newPass);

                    currentUser.Password = newPass;
                    biz.UpdateItem(currentUser);

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;

                    MessageBox.Show(ElectronicStore.Common.Constants.Messages.ChangePasswordSuccessful);

                    this.Close();
                }
            }
        }
Esempio n. 25
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            TopicQuery query = cmdData.ProtoBufDeserialize<TopicQuery>();
            if (Compiled.Debug)
                query.Debug("=== Bbs.QueryUserTopic 上行数据 ===");

            if (query.OwnerId == 0 || query.OwnerId == context.UserId)
            {
                context.Flush(RespondCode.DataInvalid);
                return;
            }
            query.AttachContent = string.Empty;
            query.ForumId = 0;
            query.HasBestAnswer = true;
            query.Keyword = string.Empty;
            query.OrderType = OrderType.Default;

            UserCacheInfo userCache = UserBiz.ReadUserCacheInfo(context.UserId);
            TopicQueryConditions condition = new TopicQueryConditions(userCache.UserSite, query, 1);
            PageResult<TopicInfo> pageResult = BbsBiz.GetPageTopicList(condition, query.QueryIndex, query.QuerySize);

            //TopicList topicList = pageResult.ToTopicList();
            context.Flush<TopicList>(pageResult.ToTopicList());
        }
Esempio n. 26
0
        /// <summary>
        /// 命令执行
        /// </summary>
        /// <param name="context"></param>
        public override void Execute(DataContext context)
        {
            byte[] cmdData = context.CmdData;
            if (cmdData.Length == 0)
            {
                context.Flush(RespondCode.CmdDataLack);
                return;
            }

            AppOptions options = cmdData.ProtoBufDeserialize <AppOptions>();

            if (Compiled.Debug)
            {
                options.Debug("=== User.OptionsSet 上行数据===");
            }

            UserOptions userOptions = new UserOptions
            {
                UserId = context.UserId,
                RemindPrivateMessage = options.RemindPrivateMessage,
                RemindGroupMessage   = options.RemindGroupMessage,
                RemindBeFollowed     = options.RemindBeFollowed,
                RemindTopicBeReply   = options.RemindTopicBeReply,
                LastChangeDate       = DateTime.Now
            };

            UserBiz.SetUserAppOptions(userOptions);

            context.Flush();
        }
 public UserDetailsController(PhoenixContext _context, IMapper _mapper, IFileStorageService fileStorageService)
 {
     this.context            = _context;
     this.fileStorageService = fileStorageService;
     this.mapper             = _mapper;
     UB = new UserBiz(context);
 }
Esempio n. 28
0
        public void CreateUserAccount_Return3NewGuids()
        {
            var deviceInfo1 = new DeviceInfo()
            {
                UserName = "******", UserPassword = "******", DeviceName = "PersMobil"
            };
            var deviceInfo2 = new DeviceInfo()
            {
                UserName = "******", UserPassword = "******", DeviceName = "KarisMobil"
            };
            var deviceInfo3 = new DeviceInfo()
            {
                UserName = "******", UserPassword = "******", DeviceName = "OlasMobil"
            };
            var person1 = new Person()
            {
                FirstName = "Per", LastName = "Larsen", Email = "*****@*****.**"
            };
            var person2 = new Person()
            {
                FirstName = "Kari", LastName = "Olsen", Email = "*****@*****.**"
            };
            var person3 = new Person()
            {
                FirstName = "Ola", LastName = "Normann", Email = "*****@*****.**"
            };

            var dtoCreateUser1 = new DtoCreateUser()
            {
                DeviceInfo = deviceInfo1, Person = person1
            };
            var dtoCreateUser2 = new DtoCreateUser()
            {
                DeviceInfo = deviceInfo2, Person = person2
            };
            var dtoCreateUser3 = new DtoCreateUser()
            {
                DeviceInfo = deviceInfo3, Person = person3
            };

            var newDtoCreateUser1 = new UserBiz().CreateUserAccount(dtoCreateUser1);
            var newDtoCreateUser2 = new UserBiz().CreateUserAccount(dtoCreateUser2);
            var newDtoCreateUser3 = new UserBiz().CreateUserAccount(dtoCreateUser3);

            var log = ActivityLogData.GetLog();

            Assert.IsTrue(!string.IsNullOrWhiteSpace(newDtoCreateUser1.DeviceInfo.UserGuid), "dtoCreateUser1.DeviceInfo.UserGuid is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(newDtoCreateUser1.Person.UserGuid), "dtoCreateUser1.Person.UserGuid is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(newDtoCreateUser2.DeviceInfo.UserGuid), "dtoCreateUser2.DeviceInfo.UserGuid is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(newDtoCreateUser2.Person.UserGuid), "dtoCreateUser2.Person.UserGuid is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(newDtoCreateUser3.DeviceInfo.UserGuid), "dtoCreateUser3.DeviceInfo.UserGuid is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(newDtoCreateUser3.Person.UserGuid), "dtoCreateUser3.Person.UserGuid is empty");

            Assert.IsTrue(newDtoCreateUser1.DeviceInfo.UserGuid == newDtoCreateUser1.Person.UserGuid, "Error checking guid in DtoCreateUser1");
            Assert.IsTrue(newDtoCreateUser2.DeviceInfo.UserGuid == newDtoCreateUser2.Person.UserGuid, "Error checking guid in DtoCreateUser2");
            Assert.IsTrue(newDtoCreateUser3.DeviceInfo.UserGuid == newDtoCreateUser3.Person.UserGuid, "Error checking guid in DtoCreateUser3");
            Assert.IsTrue(newDtoCreateUser1.DeviceInfo.UserGuid != newDtoCreateUser2.DeviceInfo.UserGuid, "Error checking guid for 1 & 2");
            Assert.IsTrue(newDtoCreateUser1.DeviceInfo.UserGuid != newDtoCreateUser3.DeviceInfo.UserGuid, "Error checking guid for 1 & 3");
            Assert.IsTrue(newDtoCreateUser2.DeviceInfo.UserGuid != newDtoCreateUser3.DeviceInfo.UserGuid, "Error checking guid for 2 & 3");
        }
Esempio n. 29
0
        public DCUser2 AuthenticateUser(string sessionid, string username, string pwd, string pwdattempts)
        {
            UserBiz     m_ubiz = new UserBiz();
            User2Detail dtuser = null;
            DCUser2     dcusr  = null;
            GroupBiz    m_gbiz = new GroupBiz();

            try
            {
                dtuser = m_ubiz.AuthenticateUser(CryptoUtils.DecryptTripleDES(username), CryptoUtils.DecryptTripleDES(pwd),
                                                 GMConvert.GetInt16(CryptoUtils.DecryptTripleDES(pwdattempts)));
                if (dtuser != null && dtuser.LastLogon.HasValue)
                {
                    dtuser.Permissions = new List <int>();
                    List <Int32> groups = m_ubiz.GetGroups(dtuser.ID);
                    foreach (int group in groups)
                    {
                        dtuser.Permissions.AddRange(m_gbiz.GetPermissions(group));
                    }

                    dcusr = new DCUser2();
                    GMReflectionUtils.Copy(dtuser, dcusr);
                    SetCache(sessionid, dcusr);
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            finally { m_ubiz.Dispose(); m_gbiz.Dispose(); }
            return(dcusr);
        }
Esempio n. 30
0
        public void GetUserGuid_Return3NewGuids()
        {
            var deviceInfo1 = new DeviceInfo()
            {
                UserName = "******", UserPassword = "******", DeviceName = "PersMobil"
            };
            var deviceInfo2 = new DeviceInfo()
            {
                UserName = "******", UserPassword = "******", DeviceName = "KarisMobil"
            };
            var deviceInfo3 = new DeviceInfo()
            {
                UserName = "******", UserPassword = "******", DeviceName = "OlasMobil"
            };

            var actualGuid1 = new UserBiz().GetUserGuid(deviceInfo1);
            var actualGuid2 = new UserBiz().GetUserGuid(deviceInfo2);
            var actualGuid3 = new UserBiz().GetUserGuid(deviceInfo3);

            var log = ActivityLogData.GetLog();

            Assert.IsTrue(!string.IsNullOrWhiteSpace(actualGuid1.UserGuid), "ActualGuid1 is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(actualGuid2.UserGuid), "ActualGuid2 is empty");
            Assert.IsTrue(!string.IsNullOrWhiteSpace(actualGuid3.UserGuid), "ActualGuid3 is empty");

            Assert.IsTrue(actualGuid1 != actualGuid2, "actualGuid1 and actualGuid2 are equal");
            Assert.IsTrue(actualGuid1 != actualGuid3, "actualGuid1 and actualGuid3 are equal");
            Assert.IsTrue(actualGuid2 != actualGuid3, "actualGuid2 and actualGuid3 are equal");

            //Assert.IsTrue(log.Count() == 3, $"Missing records in ActivityLog. Expected 3, found {log.Count()}");
        }
Esempio n. 31
0
        protected void LoginBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(LoginIDTxt.Text.Trim()))
            {
                ErrorTxt.Text    = "请输入用户名";
                ErrorTxt.Visible = true;
                return;
            }
            if (string.IsNullOrEmpty(PwdTxt.Text.Trim()))
            {
                ErrorTxt.Text    = "请输入密码";
                ErrorTxt.Visible = true;
                return;
            }

            UserEntity user = new UserBiz().LoginAuth(LoginIDTxt.Text.Trim(), PwdTxt.Text.Trim());

            if (user == null)
            {
                ErrorTxt.Text    = "用户不存在或是密码错误";
                ErrorTxt.Visible = true;
                return;
            }

            Session[Utils.UserSession] = user;
            Server.Transfer("Default.aspx");
        }
Esempio n. 32
0
        public UserView()
        {
            InitializeComponent();

            dataGridView.AutoGenerateColumns = false;

            var biz = new UserBiz();
            dataGridView.DataSource = biz.LoadItems();
            dataGridView.Refresh();
        }
Esempio n. 33
0
        private void DeleteItem(object sender, EventArgs e)
        {
            var items = new List<User>();

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                if (row.Cells[0].Value != null && row.Cells[0].Value == "1")
                {
                    items.Add(row.DataBoundItem as User);
                }
            }

            var biz = new UserBiz();
            biz.RemoveItem(items);

            RefreshItems(sender, e);
        }
Esempio n. 34
0
        public UserForm(int id)
        {
            InitializeComponent();
            InitForm();

            textFirstName.Focus();
            itemId = id;

            var biz = new UserBiz();
            var item = biz.LoadItem(id);

            textFirstName.Text = item.FirstName;
            textLastName.Text = item.LastName;
            textUsername.Text = item.Username;
            drlType.SelectedItem = item.Type;
            textMobile.Text = item.Mobile;
            textOtherInformation.Text = item.AdditionalInformation;
            password = item.Password;

            this.Text = "Sửa nhân viên";
        }
Esempio n. 35
0
        private void Login(object sender, EventArgs e)
        {
            if (CustomValidate())
            {
                var biz = new UserBiz();
                var currentUser = biz.Login(textUsername.Text, textPassword.Text);

                if (currentUser == null)
                {
                    labelMessage.Text = Constants.Messages.CannotLogin;
                }
                else
                {
                    DialogResult = DialogResult.OK;
                    Result = currentUser;

                    Close();

                }
            }
        }
Esempio n. 36
0
 private void RefreshItems(object sender, EventArgs e)
 {
     var biz = new UserBiz();
     dataGridView.DataSource = biz.LoadItems();
     dataGridView.Refresh();
 }
Esempio n. 37
0
        public OrderForm(int id, User user)
        {
            InitializeComponent();

            InitForm(user);

            var lockBiz = new LockingBiz();
            var lockItem = lockBiz.LoadItem(Constants.TableNameOrder, user.Id, id);
            if (lockItem == null)
            {
                lockBiz.LockItem(Constants.TableNameOrder, id, user.Id);
            }
            else
            {
                groupBox1.Enabled = false;
                groupBox2.Enabled = false;
                groupBox3.Enabled = false;
                groupBox5.Enabled = false;
                groupBox7.Enabled = false;
                buttonSave.Enabled = false;

                var userBiz = new UserBiz();
                var lockedUser = userBiz.LoadItem(lockItem.CurrentUserId);
                lockedUserName = lockedUser.FullName;
                isLocked = true;
            }

            itemId = id;

            var biz = new OrderBiz();
            var item = biz.LoadItem(id);

            created = item.Created;
            createdBy = item.CreatedByUserId;
            modified = item.Modified;
            modifiedBy = item.ModifiedByUserId;

            labelOrderNo.Text = item.OrderNo;
            labelStatus.Text = item.Status;
            dateOrderDate.Value = item.OrderDate;
            dateDeliveryDate.Value = item.DeliveryDate;
            textDeliverrAddress.Text = item.DeliveryAddress;
            txtDiscount.Text = item.Discount.ToString();
            txtDiscountLD.Text = item.DiscountLD.ToString();
            if (item.Liability.HasValue)
            {
                textDuNo.Text = item.Liability.Value.ToString(Constants.CurrencyFormat);
            }
            txtRecipient.Text = item.Recipient;
            txtRecipientPhone.Text = item.RecipientPhone;
            cboDeliveryInternal.Checked = item.DeliveryInternal;
            cboVat.Checked = item.Vat;
            cboSendWithEmail.Checked = item.SendWithEmail;

            sendEmail = item.SendEmail;
            sendSms = item.SendMessage;

            if (item.CustomerId.HasValue)
            {
                textCustomer.Text = item.CustomerName;
                currentCustomer = item.Customer;
                SelectCustomer();
            }

            LoadProducts(item);

            this.Text = "Sửa đơn hàng";
        }
Esempio n. 38
0
 public UserController()
 {
     userBiz = IocHelper.GetInstance<UserBiz>();
 }
Esempio n. 39
0
        private bool CustomValidation()
        {
            bool hasError = true;
            errorProvider.Clear();

            if (string.IsNullOrEmpty(textFirstName.Text))
            {
                errorProvider.SetError(textFirstName, Constants.Messages.RequireMessage);
                hasError = false;

                textFirstName.Focus();
            }

            if (string.IsNullOrEmpty(textLastName.Text))
            {
                errorProvider.SetError(textLastName, Constants.Messages.RequireMessage);
                hasError = false;

                textLastName.Focus();
            }

            if (string.IsNullOrEmpty(textUsername.Text))
            {
                errorProvider.SetError(textUsername, Constants.Messages.RequireMessage);
                hasError = false;

                textUsername.Focus();
            }

            if (string.IsNullOrEmpty(Convert.ToString(drlType.SelectedItem)))
            {
                errorProvider.SetError(drlType, Constants.Messages.RequireMessage);
                hasError = false;

                drlType.Focus();
            }

            if (string.IsNullOrEmpty(textMobile.Text))
            {
                errorProvider.SetError(textMobile, Constants.Messages.RequireMessage);
                hasError = false;

                textMobile.Focus();
            }

            if (itemId == 0)
            {
                var biz = new UserBiz();

                if (biz.IsAccountExist(textUsername.Text.Trim()))
                {
                    errorProvider.SetError(textUsername, Constants.Messages.AccountExist);
                    hasError = false;

                    textMobile.Focus();
                }
            }

            return hasError;
        }
Esempio n. 40
0
        private void SaveItem(object sender, EventArgs e)
        {
            if (CustomValidation())
            {
                var item = new User();
                item.FirstName = textFirstName.Text;
                item.LastName = textLastName.Text;
                item.Username = textUsername.Text.Trim();
                item.Type = Convert.ToString(drlType.SelectedItem);
                item.Mobile = textMobile.Text;
                item.AdditionalInformation = textOtherInformation.Text;
                item.FullName = string.Concat(item.FirstName, " ", item.LastName);

                if (itemId > 0)
                {
                    item.Id = itemId;
                    item.Password = password;
                    var biz = new UserBiz();
                    biz.UpdateItem(item);
                }
                else
                {
                    item.Password = Utilities.EncodePassword(Constants.DefaultPassword);
                    var biz = new UserBiz();
                    biz.SaveItem(item);
                }

                this.Close();
            }
            else
            {
                this.DialogResult = System.Windows.Forms.DialogResult.None;
            }
        }
Esempio n. 41
0
        private void LoadUser()
        {
            var biz = new UserBiz();
            var items = biz.LoadDelivery();
            items.Insert(0, new User());

            drlUser.Items.Clear();
            drlUser.DataSource = items;
            drlUser.DisplayMember = "FullName";
            drlUser.ValueMember = "Id";
        }
Esempio n. 42
0
        public DeliveryForm(int id, User user)
        {
            InitializeComponent();

            InitForm(user);

            var lockBiz = new LockingBiz();
            var lockItem = lockBiz.LoadItem(Constants.TableNameDelivery, user.Id, id);
            if (lockItem == null)
            {
                lockBiz.LockItem(Constants.TableNameDelivery, id, user.Id);
            }
            else
            {
                groupBox1.Enabled = false;
                groupBox3.Enabled = false;
                groupBox4.Enabled = false;

                buttonSave.Enabled = false;
                buttonSendEmail.Enabled = false;
                buttonSendSms.Enabled = false;

                var userBiz = new UserBiz();
                var lockedUser = userBiz.LoadItem(lockItem.CurrentUserId);
                lockedUserName = lockedUser.FullName;
                isLocked = true;
            }

            drlVehicle.Focus();
            itemId = id;

            var biz = new DeliveryBiz();
            var item = biz.LoadItem(id);

            created = item.Created;
            createdBy = item.CreatedByUserId;
            modified = item.Modified;
            modifiedBy = item.ModifiedByUserId;

            labelDeliveryNo.Text = item.DeliveryNo;
            labelStatus.Text = item.Status;
            labelSendSms.Text = item.IsSendSms;
            labelSendEmail.Text = item.IsSendEmail;

            if (item.DeliveryDate.HasValue)
            {
                dateStartDate.Value = item.DeliveryDate.Value;
            }
            if (item.StartTime.HasValue)
            {
                dateTimeStartTime.Value = DateTime.Now + item.StartTime.Value;
            }

            textOtherInformation.Text = item.OtherInformation;
            if (item.VehicleId.HasValue)
            {
                drlVehicle.SelectedValue = item.VehicleId.Value;
            }
            if (item.StaffId.HasValue)
            {
                drlUser.SelectedValue = item.StaffId.Value;
            }

            LoadOrders(item);

            this.Text = "Cập nhật thông tin giao hàng";
        }