Exemplo n.º 1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     MemberClient client = new MemberClient("BasicHttpBinding_IMember", WCFServiceUrl.MemberServiceUrl);
     MemberModel member = client.GetMemberInfo(txtMemCardID.Text);
     if (member != null)
     {
         lblMC_Name.Text = member.MC_Name;
         lblCL_Name.Text = member.CL_LevelName;
         string sex = "未知";
         if (member.MC_Sex == 0)
         {
             sex = "女";
         }
         else if (member.MC_Sex == 1)
         {
             sex = "男";
         }
         lblSex.Text = sex;
         lblTel.Text = member.MC_Mobile;
     }
     else
     {
         MessageBox.Show("您输入的会员卡号不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 2
0
        public async Task GetAllUsers_FailNotAdmin()
        {
            var request  = _baseUrl;
            var response = await MemberClient.GetAsync(request);

            Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
        }
Exemplo n.º 3
0
    private void InitialiseMemberBank()
    {
        MemberBank[] ArrMB = null;

        using (var svcInstance = new MemberClient())
        {
            string strProcessCode, strProcessText;
            ArrMB = svcInstance.getBankAccounts(Convert.ToInt64(strOperatorId), strCurrencyCode, strCountryCode, out strProcessCode, out strProcessText);
        }

        drpBank.DataSource = ArrMB;
        if (xeResources.XPathSelectElement("BankNameNative/" + strSelectedLanguage.ToUpper() + "_" + strCurrencyCode.ToUpper()) != null)
        {
            drpBank.DataTextField = "bankNameNative";
        }
        else
        {
            drpBank.DataTextField = "bankName";
        }

        drpBank.DataValueField = "bankCode";
        drpBank.DataBind();

        drpBank.Items.Insert(0, new ListItem(base.strdrpBank, "-1"));
        drpBank.Items.Add(new ListItem(base.strdrpOtherBank, "OTHER"));
    }
        public async Task <ActionResult> Delete(int id, [FromForm] Member model)
        {
            try
            {
                var client = new MemberClient(_config);

                var member = await client.Get(id);

                if (null == member)
                {
                    return(NotFound());
                }

                var response = await client.Delete(member);

                if (response.IsSuccessStatusCode)
                {
                    _toastNotification.AddSuccessToastMessage($"Le membre {member.Name} a été supprimée.");

                    return(RedirectToAction(nameof(Index)));
                }
            }
            catch
            {
                return(View(model));
            }

            return(View(model));
        }
        public async Task <ActionResult> Create([FromForm] Member model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var client = new MemberClient(_config);

                    var response = await client.Create(model);

                    if (response.IsSuccessStatusCode)
                    {
                        _toastNotification.AddSuccessToastMessage($"Le member {model.Name} a été ajoutée.");

                        return(RedirectToAction(nameof(Index)));
                    }
                }
                catch
                {
                    return(View(model));
                }
            }

            return(View(model));
        }
Exemplo n.º 6
0
        public async Task GetUserRole_FailNotAdmin()
        {
            var request  = $"{_baseUrl}/{DefaultValues.MemberId}/role";
            var response = await MemberClient.GetAsync(request);

            Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
        }
Exemplo n.º 7
0
        public async Task GetMyProfile_SuccessStatusCode()
        {
            var request  = $"{_baseUrl}/me";
            var response = await MemberClient.GetAsync(request);

            response.EnsureSuccessStatusCode();
        }
        // GET: Members
        public async Task <ActionResult> Index()
        {
            var client = new MemberClient(_config);

            var Members = await client.GetAll();

            return(View(Members));
        }
 public static MemberSecondaryBank[] GetSecondaryBanks()
 {
     using (var client = new MemberClient())
     {
         string statusCode, statusText;
         return(client.getSecondaryBankAccounts(Convert.ToInt64(commonVariables.OperatorId), commonCookie.CookieCurrency, "vn", out statusCode, out statusText));
     }
 }
Exemplo n.º 10
0
        public async Task ChangeRole_FailNotAdmin()
        {
            var role = new UserJsonDataBuilder()
                       .WithDefaultRoleId()
                       .Build();
            var request  = $"{_baseUrl}/{DefaultValues.MemberId}/role";
            var response = await MemberClient.PostAsync(request, role);

            Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
        }
Exemplo n.º 11
0
        public async Task <ActionResult> Edit(int meetingId, int attendeeId, [FromForm] AttendeeViewModel model)
        {
            var memberClient = new MemberClient(_config);
            var members      = await memberClient.GetAll();

            if (ModelState.IsValid)
            {
                try
                {
                    var client = new MeetingClient(_config);

                    var attendee = await client.GetAttendee(meetingId, attendeeId);

                    if (null == attendee)
                    {
                        return(NotFound());
                    }

                    if (null == model.MemberId)
                    {
                        attendee.Member = null;
                    }
                    else
                    {
                        attendee.Member = await memberClient.Get(model.MemberId.Value);

                        // Keep only the member alias
                        attendee.Member.Name = attendee.Member.Alias;
                    }

                    var response = await client.UpdateAttendee(meetingId, attendee);

                    if (response.IsSuccessStatusCode)
                    {
                        _toastNotification.AddSuccessToastMessage($"Le participant a été modifiée.");

                        return(RedirectToAction("Details", "Meetings", new { Id = meetingId }));
                    }
                }
                catch
                {
                    model.Members = members.Select(p => new SelectListItem {
                        Value = p.Id.ToString(), Text = p.Alias
                    }).ToList();

                    return(View(model));
                }
            }

            model.Members = members.Select(p => new SelectListItem {
                Value = p.Id.ToString(), Text = p.Alias
            }).ToList();

            return(View(model));
        }
Exemplo n.º 12
0
        public async Task UpdateUserDetails_SuccessStatusCode()
        {
            var request = _baseUrl;
            var user    = new UsersFormDataBuilder()
                          .WithDefaultFirstName()
                          .WithDefaultLastName()
                          .Build();
            var response = await MemberClient.PutAsync(request, user);

            response.EnsureSuccessStatusCode();
        }
        public async Task <ActionResult> Accept(int id, [FromForm] AcceptViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var meetingClient = new MeetingClient(_config);
                    var memberClient  = new MemberClient(_config);

                    var attendee = await meetingClient.GetAttendee(id, model.AttendeeId);

                    if (null == attendee)
                    {
                        return(BadRequest("Attendee not found"));
                    }

                    var member = await memberClient.Get(model.MemberId);

                    if (null == member)
                    {
                        return(BadRequest("Member not found"));
                    }

                    if (null == attendee.Member)
                    {
                        attendee.Member = new Member();
                    }

                    attendee.Member.Id   = member.Id;
                    attendee.Member.Name = member.Alias;

                    var response = await meetingClient.UpdateAttendee(id, attendee);

                    if (response.IsSuccessStatusCode)
                    {
                        _toastNotification.AddSuccessToastMessage($"Merci, le role {attendee.Role.Name} a été assigné à {attendee.Member.Name}.");

                        CookieOptions option = new CookieOptions();

                        option.Expires = DateTime.Now.AddYears(1);

                        Response.Cookies.Append("member", member.Id.ToString(), option);

                        return(RedirectToAction(nameof(Index)));
                    }
                }
                catch
                {
                    return(View(model));
                }
            }

            return(View(model));
        }
        // GET: Members/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            var client = new MemberClient(_config);

            var Member = await client.Get(id);

            if (null == Member)
            {
                return(NotFound());
            }

            return(View(Member));
        }
    public static Task <string> GetWalletBalancesAsync()
    {
        using (var svcInstance = new MemberClient())
        {
            var member = new Members();
            var info   = member.MemberData();

            if (string.IsNullOrWhiteSpace(info.MemberCode))
            {
                member.CheckMemberSession(info.CurrentSessionId);
                info = member.MemberData();
            }

            return(svcInstance.getBalancesAsync(commonVariables.OperatorId, commonVariables.SiteUrl, info.MemberCode));
        }
    }
Exemplo n.º 16
0
 private void btnRead_Click(object sender, EventArgs e)
 {
     MemberClient client = new MemberClient("BasicHttpBinding_IMember", WCFServiceUrl.MemberServiceUrl);
     Member = client.GetMemberInfo(txtMemCardIDorMobile.Text);
     if (Member != null)
     {
         lblMC_Name.Text = Member.MC_Name;
         lblCL_Name.Text = Member.CL_LevelName;
         lblMC_Point.Text = Member.MC_Point.ToString();
         lblMC_TotalMoney.Text = Member.MC_TotalMoney.ToString();
     }
     else
     {
         MessageBox.Show("您输入的会员卡号/手机不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
    public static Task <getWalletBalanceResponse> GetWalletBalanceAsync(int walletId)
    {
        using (var svcInstance = new MemberClient())
        {
            var member = new Members();
            var info   = member.MemberData();

            if (string.IsNullOrWhiteSpace(info.MemberCode))
            {
                member.CheckMemberSession(info.CurrentSessionId);
                info = member.MemberData();
            }

            var request = new getWalletBalanceRequest(commonVariables.OperatorId, commonVariables.SiteUrl, info.MemberCode, Convert.ToString(walletId));
            return(svcInstance.getWalletBalanceAsync(request));
        }
    }
        public async Task <ActionResult> Accept(int id, int attendeeId)
        {
            var client = new MeetingClient(_config);

            var meeting = await client.Get(id);

            if (null == meeting)
            {
                return(NotFound());
            }

            var attendee = meeting.Attendees.Where(p => attendeeId == p.Id).SingleOrDefault();

            if (null == attendee)
            {
                return(NotFound());
            }

            var model = new AcceptViewModel
            {
                AttendeeId  = attendeeId,
                MeetingDate = meeting.Date,
                MeetingId   = meeting.Id,
                MeetingName = meeting.Name,
                RoleName    = attendee.Role.Name
            };

            var memberClient = new MemberClient(_config);

            var members = await memberClient.GetAll();

            var buffer = Request.Cookies["member"];
            int memberId;

            if (false == int.TryParse(buffer, out memberId))
            {
                memberId = 0;
            }

            model.MemberId = memberId;
            model.Members  = members.Select(p => new SelectListItem {
                Value = p.Id.ToString(), Text = p.Alias
            }).ToList();

            return(View(model));
        }
        public async Task <ActionResult> Edit(int id, [FromForm] Member model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var client = new MemberClient(_config);

                    var member = await client.Get(id);

                    if (null == member)
                    {
                        return(NotFound());
                    }

                    member.Active  = model.Active;
                    member.Alias   = model.Alias;
                    member.Email   = model.Email;
                    member.Notify  = model.Notify;
                    member.Email2  = model.Email2;
                    member.Notify2 = model.Notify2;
                    member.Email3  = model.Email3;
                    member.Notify3 = model.Notify3;
                    member.Name    = model.Name;
                    member.Note    = model.Note;

                    var response = await client.Update(member);

                    if (response.IsSuccessStatusCode)
                    {
                        _toastNotification.AddSuccessToastMessage($"Le membre {model.Name} a été modifiée.");

                        return(RedirectToAction(nameof(Index)));
                    }
                }
                catch
                {
                    return(View());
                }
            }

            return(View(model));
        }
Exemplo n.º 20
0
    public static string GetBankBranch(string bankId, string bankLocationId)
    {
        var list = new List <object>();

        try
        {
            using (var client = new MemberClient())
            {
                string statusCode, statusText;
                var    bankBranches = client.getBankBranches(Convert.ToInt64(bankId), Convert.ToInt64(bankLocationId), out statusCode, out statusText);
                foreach (DataRow row in bankBranches.Rows)
                {
                    list.Add(new { name = row["description"], value = row["bankBranchId"], });
                }
            }
        }
        catch (Exception ex)
        {
            commonAuditTrail.appendLog("system", "Payment_BankTransfer", "GetBankBranch", string.Empty, string.Empty, string.Empty, "-99", "exception", ex.Message, string.Empty, string.Empty, true);
        }
        return(JsonConvert.SerializeObject(list));
    }
        public async Task <ActionResult> Refuse(int id, [FromForm] RefuseViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var meetingClient = new MeetingClient(_config);
                    var memberClient  = new MemberClient(_config);

                    var attendee = await meetingClient.GetAttendee(id, model.AttendeeId);

                    if (null == attendee)
                    {
                        return(BadRequest("Attendee not found"));
                    }

                    var member = attendee.Member;

                    attendee.Member = null;

                    var response = await meetingClient.UpdateAttendee(id, attendee);

                    if (response.IsSuccessStatusCode)
                    {
                        _toastNotification.AddSuccessToastMessage($"Merci, le rôle {attendee.Role.Name} a été retiré à {member.Name}.");

                        return(RedirectToAction(nameof(Index)));
                    }
                }
                catch
                {
                    return(View());
                }
            }

            return(View(model));
        }
Exemplo n.º 22
0
        public async Task <ActionResult> Edit(int meetingId, int attendeeId)
        {
            var client   = new MeetingClient(_config);
            var attendee = await client.GetAttendee(meetingId, attendeeId);

            if (null == attendee)
            {
                return(NotFound());
            }

            var model = new AttendeeViewModel
            {
                Id        = attendeeId,
                MeetingId = meetingId,
                RoleId    = attendee.Role.Id,
                RoleName  = attendee.Role.Name
            };

            if (null == attendee.Member)
            {
                model.MemberId = null;
            }
            else
            {
                model.MemberId = attendee.Member.Id;
            }

            var memberClient = new MemberClient(_config);
            var members      = await memberClient.GetAll();

            model.Members = members.Select(p => new SelectListItem {
                Value = p.Id.ToString(), Text = p.Alias
            }).ToList();

            return(View(model));
        }
 public AdministrationController(MemberClient memberClient, AdministrationClient administrationClient)
 {
     _memberClient         = memberClient;
     _administrationClient = administrationClient;
 }
Exemplo n.º 24
0
 public HomeController(MemberClient memberClient)
 {
     _memberClient = memberClient;
 }
Exemplo n.º 25
0
 public TeacherController(MemberClient memberClient, TeacherClient teacherClient)
 {
     _memberClient  = memberClient;
     _teacherClient = teacherClient;
 }
Exemplo n.º 26
0
 public AccountController(MemberClient memberClient)
 {
     _memberClient = memberClient;
 }
Exemplo n.º 27
0
 public StudentController(StudentClient studentClient, MemberClient memberClient)
 {
     _studentClient = studentClient;
     _memberClient  = memberClient;
 }