Example #1
0
 private void toolBtnRefresh_Click(object sender, EventArgs e)
 {
     textBoxError.Text = "";
     if (tabControlMain.SelectedIndex == 1)
     {
         using (HouseService objserv = new HouseService())
         {
             var resp = objserv.Reposity.GetAllList(o => o.TenantId == TenantId);
             if (resp != null)
             {
                 labelTotal.Text = "总共:" + resp.Count;
                 var lists = Mapper.Map <List <Dto.HouseDto> >(resp);
                 dgvHouse.DataSource = lists;
                 SetHeaderHs();
             }
         }
     }
     else
     {
         using (MembersService members = new MembersService())
         {
             var resp = members.Reposity.GetAllList(o => o.TenantId == TenantId && o.IsReger == false);
             if (resp != null)
             {
                 labelTotal.Text = "总共:" + resp.Count;
                 var lists = Mapper.Map <List <Dto.MemberOutDto> >(resp);
                 dgvMain.DataSource = lists;
                 SetHeader();
             }
         }
     }
 }
Example #2
0
        public ActionResult Save(int?id)
        {
            ViewBag.stores = ListToSelect(WarehouseService.GetList().Select(o => new SelectListItem()
            {
                Text = o.Title, Value = o.StoreId
            }), emptyTitle: "请选择");
            var            obj  = new Members();
            SelectListItem city = null;

            if (id.HasValue)
            {
                obj = MembersService.FindById(id.Value);
                if (obj.CurrentCityId > 0)
                {
                    var area = BaseService <Area> .FindById(obj.CurrentCityId);

                    if (area != null)
                    {
                        var parentArea = BaseService <Area> .FindById(area.AreaPID);

                        var text = area.Title;
                        if (parentArea != null && parentArea.Type != 1)
                        {
                            text = parentArea.Title + "/" + text;
                        }
                        city       = new SelectListItem();
                        city.Value = obj.CurrentCityId.ToString();
                        city.Text  = text;
                    }
                }
            }
            ViewBag.city = city;
            return(View(obj.IsNullThrow()));
        }
Example #3
0
        public List <Tree> SearchDepartmentsTree(SearchMemberDepartmentRequst condtion)
        {
            MembersService ms     = new MembersService();
            List <Tree>    result = ms.SearchDepartmentsTree(condtion);

            return(result);
        }
Example #4
0
        public ReplayBase EditDepInfo(EditDepInfoRequestModel condtion)
        {
            condtion.modifiedby = User.Identity.Name;
            MembersService ms = new MembersService();

            return(ms.EditDepBaseInfo(condtion));
        }
Example #5
0
        public async Task EditeAsyncWithDublicateNameShouldThrowArgumentException()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;
            var dbContext         = new ApplicationDbContext(options);
            var cloudinary        = new Mock <ICloudinaryService>();
            var membersRepository = new EfDeletableEntityRepository <Member>(dbContext);
            var service           = new MembersService(membersRepository, cloudinary.Object);

            var photo = new Mock <IFormFile>();

            await service.CreateAsync("Lars Ulrich", photo.Object, "description", 2);

            var id = await service.CreateAsync("Kirk Hammett", photo.Object, "description", 2);

            var model = new MemberEditInputModel
            {
                FullName    = "Lars Ulrich",
                Photo       = photo.Object,
                Description = "description",
                GroupId     = 2,
            };

            await Assert.ThrowsAsync <ArgumentException>(async() =>
            {
                await service.EditAsync(id, model);
            });
        }
Example #6
0
        public ReplayBase CreateDepartment(CreateMembersDepartmentReqeustModel condtion)
        {
            condtion.createdby = User.Identity.Name;
            ReplayBase result = MembersService.CreateDepartment(condtion);

            return(result);
        }
        public void UnSubscribeMember()
        {
            IMembersService members = new MembersService(myemma);
            var             member  = members.Unsubscribe("*****@*****.**");

            Assert.IsNotNull(member);
        }
Example #8
0
        public JsonResult GetLists(int page, int pageSize)
        {
            MembersService Member = new MembersService();
            var            result = Member.Reposity.GetPageList(page, pageSize, o => o.TenantId == TenantId);

            return(Json(result));
        }
        public void GetSomeMember()
        {
            IMembersService members = new MembersService(myemma);
            var             member  = members.Get("752395550");

            Assert.IsNotNull(member);
        }
Example #10
0
        public void GetMemberByEmail()
        {
            IMembersService members = new MembersService(myemma);
            var             member  = members.GetByEmail("*****@*****.**");

            Assert.IsNotNull(member);
        }
Example #11
0
        public void GetAllMembers()
        {
            IMembersService members = new MembersService(myemma);
            var             list    = members.Get();

            Assert.IsNotNull(list);
        }
Example #12
0
        protected void btnCreateAccount_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    MembersService       membersService = new MembersService(ddlPageLanguage.SelectedValue);
                    Member               enMember       = new Member();
                    TransactionResultDTO result;

                    enMember.realName    = txtRealName.Text;
                    enMember.displayName = txtDisplayName.Text;
                    enMember.email       = txtEmail.Text;
                    enMember.password    = txtPass1.Text;
                    enMember.language    = ddlLanguage.SelectedValue;

                    result = membersService.createMember(enMember);
                    if (result.code == TransactionResultDTO.transactionResultCode.Success)
                    {
                        EMail.sendAccountActivationEmail();
                    }
                    else
                    {
                        showError(result.failureReason);
                    }
                }
                catch (Exception)
                {
                    showError(HttpContext.GetGlobalResourceObject("Resource", "ErrorGeneral").ToString());
                }
            }
        }
Example #13
0
        public List <Combobox> SearchMembersListForcombobox(string q = null, string orgid = null, string userid = null)
        {
            List <Combobox>           result   = new List <Combobox>();
            SearchMembersRequestModel condtion = new SearchMembersRequestModel()
            {
                keyWords  = q,
                orgId     = orgid,
                userId    = userid,
                Page      = 1,
                PageSize  = 10,
                ordertype = EnumSortOrderType.标题降序
            };
            SearchMembersreplayModel l = MembersService.SearchMembersList(condtion);

            if (l.rows.Count > 0)
            {
                foreach (MembersBaseInfoModel u in l.rows)
                {
                    result.Add(new Combobox()
                    {
                        id   = u.UserId,
                        text = (string.IsNullOrEmpty(u.FullName) ? u.NickName : u.FullName) + "[" + u.MobilePhone + "]"
                    });
                }
            }
            return(result);
        }
Example #14
0
        public ReplayBase EditMemberBaseInfo(MembersBaseInfoModel condtion)
        {
            MembersService ms     = new MembersService();
            ReplayBase     result = ms.EditMemberBaseInfo(condtion);

            return(result);
        }
        public void SomeRandomTest()
        {
            var values = new List <Tuple <int[], string> >
            {
                new Tuple <int[], string>(new[] { 1, 1 }, "Open"),
                new Tuple <int[], string>(new[] { 54, 9 }, "Open"),
                new Tuple <int[], string>(new[] { 90, 7 }, "Open"),
                new Tuple <int[], string>(new[] { 21, 21 }, "Open"),
                new Tuple <int[], string>(new[] { 0, 0 }, "Open"),
                new Tuple <int[], string>(new[] { 55, 10 }, "Senior"),
                new Tuple <int[], string>(new[] { 90, 8 }, "Senior"),
                new Tuple <int[], string>(new[] { 90, 9 }, "Senior"),
                new Tuple <int[], string>(new[] { 60, 12 }, "Senior"),
                new Tuple <int[], string>(new[] { 75, 11 }, "Senior"),
            };

            Random r = new Random();

            for (int t = 0; t < 5; t++)
            {
                var input  = new List <int[]>();
                var output = new List <string>();
                for (int k = 0; k < 10; k++)
                {
                    var index = r.Next(0, 9);
                    input.Add(values[index].Item1);
                    output.Add(values[index].Item2);
                }
                CollectionAssert.AreEqual(MembersService.OpenOrSenior(input.ToArray()).ToList(), output.ToArray());
            }
        }
Example #16
0
        public FileResult ExportExcel(string keywords = "")
        {
            HSSFWorkbook   book     = new HSSFWorkbook();
            ISheet         sheet1   = book.CreateSheet("Sheet1");
            MembersService ShipServ = new MembersService();

            var DataLists = ShipServ.Reposity.GetAllList();


            IRow rowhead = sheet1.CreateRow(0);

            string[] colums = ("编号|姓名|关系|性别|民族|出生年月|年龄|楼盘|单元|门牌号|身份证号|现户籍地址|原户籍地址|是否兴塘社区户籍|服务处所|职务|联系电话1|联系电话2|政治面貌|党员所在支部|是否楼道组长|是否户代表|是否居民代表|是否居民组长|是否愿意参加公益|是否愿意从事居民事务|调查时间|特长备注").Split('|');
            for (int i = 0; i < colums.Length; i++)
            {
                rowhead.CreateCell(i).SetCellValue(colums[i]);
            }

            int RowNum = 0;

            foreach (var item in DataLists)
            {
                IRow row = sheet1.CreateRow(RowNum + 1);
                row.CreateCell(0).SetCellValue(RowNum + 1);
                row.CreateCell(1).SetCellValue(item.TrueName);
                row.CreateCell(2).SetCellValue(item.Relations);
                row.CreateCell(3).SetCellValue(item.Sex);
                row.CreateCell(4).SetCellValue(item.Nation);
                row.CreateCell(5).SetCellValue(item.Birthday);
                row.CreateCell(6).SetCellValue(item.Age);
                row.CreateCell(7).SetCellValue(item.Apartment);
                row.CreateCell(8).SetCellValue(item.UnitNum);
                row.CreateCell(9).SetCellValue(item.DoorCard);
                row.CreateCell(10).SetCellValue(item.UserID);
                row.CreateCell(11).SetCellValue(item.Address);
                row.CreateCell(12).SetCellValue(item.Address2);
                row.CreateCell(13).SetCellValue(item.HhdRegister);
                row.CreateCell(14).SetCellValue(item.ServiceAddr);
                row.CreateCell(15).SetCellValue(item.Duties);
                row.CreateCell(16).SetCellValue(item.Phone);
                row.CreateCell(17).SetCellValue(item.Phone2);
                row.CreateCell(18).SetCellValue(item.PoliticalRole);
                row.CreateCell(19).SetCellValue(item.PartyBranch);
                row.CreateCell(20).SetCellValue(item.CorridorLeader);
                row.CreateCell(21).SetCellValue(item.HouseLeader);
                row.CreateCell(22).SetCellValue(item.ResidentRepresentative);
                row.CreateCell(23).SetCellValue(item.ResidentLeader);
                row.CreateCell(24).SetCellValue(item.Pipwa);
                row.CreateCell(25).SetCellValue(item.Eira);
                row.CreateCell(26).SetCellValue(item.CreationTime.ToString());
                row.CreateCell(27).SetCellValue(item.Speciality);
                RowNum++;
            }

            MemoryStream ms = new MemoryStream();

            book.Write(ms);
            ms.Seek(0, SeekOrigin.Begin);
            ShipServ.Dispose();
            return(File(ms, "application/vnd.ms-excel", "Members" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls"));
        }
Example #17
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    MembersService       membersService = new MembersService(ddlPageLanguage.SelectedValue);
                    TransactionResultDTO result;

                    result = membersService.login(txtEmail.Text, txtPass.Text);
                    if (result.code == TransactionResultDTO.transactionResultCode.Success)
                    {
                        Member logedMember = (Member)result.object1;
                        SessionManager.create(logedMember.id, logedMember.displayName, logedMember.language, Convert.ToInt32(timeZoneOffset.Value));

                        if (Request.QueryString[Parameters.redirectTo] != null)
                        {
                            Response.Redirect(Request.QueryString[Parameters.redirectTo].ToString(), true);
                        }

                        Response.Redirect(Pages.getHomeDefault(), true);
                    }
                    else
                    {
                        showError(result.failureReason);
                    }
                }
                catch (Exception)
                {
                    showError(HttpContext.GetGlobalResourceObject("Resource", "ErrorGeneral").ToString());
                }
            }
        }
Example #18
0
        public async Task GetByIdAsyncWithCorrectDataShouldReturnCorrectResult()
        {
            MapperInitializer.InitializeMapper();
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;
            var dbContext         = new ApplicationDbContext(options);
            var cloudinary        = new Mock <ICloudinaryService>();
            var membersRepository = new EfDeletableEntityRepository <Member>(dbContext);
            var service           = new MembersService(membersRepository, cloudinary.Object);

            await membersRepository.AddAsync(new Member
            {
                Id          = 1,
                FullName    = "James Hetfield",
                ImgUrl      = "url",
                Description = "description",
                GroupId     = 1,
            });

            await membersRepository.SaveChangesAsync();

            var member = await service.GetByIdAsync <MemberTestVewModel>(1);

            var actual   = member.FullName;
            var expected = "James Hetfield";

            Assert.Equal(expected, actual);
        }
Example #19
0
 public OrderSuccessHub()
 {
     membersService     = new MembersService();
     memberlevelService = new MemberlevelService();
     settingService     = new SettingService();
     orderService       = new OrderService();
 }
Example #20
0
        public OrgInfoModel GetOrgInfoById(string Id)
        {
            MembersService ms = new MembersService();

            ms.GetOrgBaseInfo(Id);
            return(ms.orgInfo);
        }
Example #21
0
        public ActionResult Detail(int?id)
        {
            var obj = new Members();

            if (id.HasValue)
            {
                obj = MembersService.FindById(id.Value);
                if (obj.CurrentCityId > 0)
                {
                    var area = BaseService <Area> .FindById(obj.CurrentCityId);

                    if (area != null)
                    {
                        var parentArea = BaseService <Area> .FindById(area.AreaPID);

                        var text = area.Title;
                        if (parentArea != null && parentArea.Type != 1)
                        {
                            text = parentArea.Title + "/" + text;
                        }
                        ViewBag.city = text;
                    }
                }
                if (!obj.StoreId.IsNullOrEmpty())
                {
                    var store = WarehouseService.Find(o => o.StoreId == obj.StoreId);
                    if (store != null)
                    {
                        ViewBag.Store = store.Title;
                    }
                }
            }
            return(View(obj.IsNullThrow()));
        }
Example #22
0
        public SearchMemberDepartmentReplay SearchDepartments(SearchMemberDepartmentRequst condtion)
        {
            MembersService ms = new MembersService();
            SearchMemberDepartmentReplay result = ms.SearchDepartments(condtion);

            return(result);
        }
Example #23
0
        public ActionResult SetState(string ids, short state)
        {
            var sId  = ids.Split(',').Select(o => int.Parse(o));
            var list = MembersService.FindList(o => sId.Contains(o.Id));

            #region 操作日志状态记录
            var _oList = new List <Members>();
            foreach (var item in list)
            {
                var _member = new Members();
                ExtendHelper.CopyProperty <Members>(_member, item);
                _oList.Add(_member);
            }
            #endregion

            list.ForEach(o => { o.Status = state; });
            var re = MembersService.Update(list);
            #region 操作日志
            if (re.Successed)
            {
                for (int i = 0; i < list.Count(); i++)
                {
                    var msg = Sys.LogEngine.CompareModelToLog <Members>(Sys.LogModule.会员管理, list[i], _oList[i]);
                    new Sys.LogEngine().WriteUpdate(msg, Sys.LogModule.会员管理);
                }
            }
            #endregion
            return(new JsonNetResult(re));
        }
Example #24
0
        public DepInfoModel GetDepInfo(GetDepInfoRequestModel condtion)
        {
            MembersService ms = new MembersService();

            ms.GetDepBaseInfo(condtion);
            return(ms.depInfo);
        }
Example #25
0
        public ActionResult FindPageList(string date1, string date2, string title)
        {
            var count = 0;
            var list  = MembersService.FindPageList(date1, date2, title, ref count, true);

            return(ToDataGrid(list, count));
        }
 public MessagesController(IHubContext <ChatHub> hubContext, MessagesService messagesService, MembersService membersService, BadgeService badgeService)
 {
     this.hubContext      = hubContext;
     this.messagesService = messagesService;
     this.membersService  = membersService;
     this.badgeService    = badgeService;
 }
Example #27
0
        public JsonResult InsertBlank(bool IsReger = false)
        {
            ResultDto <int> result = new ResultDto <int>();

            try
            {
                using (MembersService Member = new MembersService())
                {
                    Members obj = new Members();
                    obj.UserName     = GetRndCode(6);
                    obj.Password     = "******";
                    obj.Email        = "0";
                    obj.UserID       = "0";
                    obj.TenantId     = TenantId;
                    obj.CreationTime = DateTime.Now;
                    obj.IsReger      = IsReger;
                    Member.Reposity.Insert(obj);
                    result.code    = 100;
                    result.message = "ok";
                }
            }
            catch (Exception ex)
            {
                result.code    = 500;
                result.message = ex.Message;
            }
            return(Json(result));
        }
Example #28
0
        public MembersInfoModel GetMemberInfo(GetMembersInfoRequestModel condtion)
        {
            MembersService ms = new MembersService();

            ms.GetMemberInfo(condtion);
            return(ms.memberInfo);
        }
 public GiversController(GiversService giversService, MembersService membersService, BadgeService badgeService, FileService fileService, IHostingEnvironment environment)
 {
     this.giversService      = giversService;
     this.membersService     = membersService;
     this.badgeService       = badgeService;
     this.fileService        = fileService;
     this.hostingEnvironment = environment;
 }
Example #30
0
        public async void LoadRowData()
        {
            MembersService members = new MembersService();

            list = await members.GetMembersDetials(HouseNumber);

            rowDataGrid.ItemsSource = list;
        }