Esempio n. 1
0
 public ActionResult SubmitMember(Member member)
 {
     if (ModelState.IsValid)
     {
         memberModel.UpdateMember(member);
         return(RedirectToAction("Index"));
     }
     return(View(member));
 }
        public IActionResult Delete(Members member)
        {
            member.IsActive = false;
            var result = MemberServices.UpdateMember(member);

            if (result.Equals(EnumServices.UpdateResult.success))
            {
                return(Ok("Sucessfully deleted"));
            }
            else
            {
                return(BadRequest("Error Deleting"));
            }
        }
Esempio n. 3
0
 public IActionResult Put(string id, [FromBody] AdminRequestUpdateMember _member)
 {
     if (!id.Equals(id))
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         Member mem    = _memberServices.GetById(id);
         Member entity = _memberServices.UpdateMember(_member.CopyTo(mem));
         _memberServices.Commit();
         return(Ok(entity));
     }
     else
     {
         return(BadRequest());
     }
 }
        public IActionResult Edit(MemberVm viewModel)
        {
            var result = EnumServices.UpdateResult.fail; //0 = fail, 1 = success

            if (!ModelState.IsValid)
            {
                viewModel.PageMessage = "Not Valid Entry";
                return(View("MemberForm", viewModel));
            }
            else
            {
                result = MemberServices.UpdateMember(viewModel.Member);
            }
            if (result.Equals(EnumServices.UpdateResult.success))
            {
                viewModel.PageMessage = "Successfully updated";
                return(RedirectToAction("Edit", "Member", new { @id = viewModel.Member.Id }));
            }
            else
            {
                viewModel.PageMessage = "Error updating";
                return(View("MemberForm", viewModel));
            }
        }
Esempio n. 5
0
        private void btnCommit_Click(object sender, EventArgs e)
        {
            //【1】Checksum input

            //【2】Encapsulation objects
            Member objMember = new Member()
            {
                MemberId        = lblMemberId.Text,
                MemberName      = txtMemberName.Text.Trim(),
                MemberCardId    = txtMemberCardId.Text.Trim(),
                MemberLevel     = Convert.ToInt32(cboMemberLevel.SelectedValue),
                IdType          = cboIdType.Text,
                IdNumber        = txtIdCardNumber.Text.Trim(),
                Gender          = rbMale.Checked == true ? "Male" : "Female",
                TelNo           = txtTelNo.Text.Trim(),
                HomeAddress     = txtHomeAddress.Text.Trim(),
                Birthday        = Convert.ToDateTime(dtpBirthday.Text),
                CardStatus      = cboCardStatus.Text,
                CardClosingDate = Convert.ToDateTime(dtpCardClosingDate.Text),
                PayMethod       = cboPayMethod.Text,
                IsReturnDeposit = false,
                LoginId         = Program.currentUser.LoginId,
                OperatingTime   = DateTime.Now,
                ReMarks         = txtRemarks.Text,
            };

            //Picture
            if (pbCurrentImage.BackgroundImage == null)
            {
                objMember.MemberPhoto = null;
            }
            else
            {
                objMember.MemberPhoto = new Common.SerializeObjectToString().SerializeObject(pbCurrentImage.BackgroundImage);
            }

            //【3】Submit
            switch (actionFlag)
            {
            case 2:    //Add
                try
                {
                    if (objMemberServices.AddMember(objMember) == 1)
                    {
                        //Notice Successful!
                        MessageBox.Show("Successful addition of membership information!", "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //Close
                        Close();
                        //Back OK to main interface
                        this.DialogResult = DialogResult.OK;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to add member information! Specific reasons:" + ex.Message, "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case 3:    //Modify
                try
                {
                    if (objMemberServices.UpdateMember(objMember) == 1)
                    {
                        //Notice Successful!
                        MessageBox.Show("Modify Information Successful", "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //Close
                        Close();
                        //Back OK to main interface
                        this.DialogResult = DialogResult.OK;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to modify membership information! Specific reasons:" + ex.Message, "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;
            }
        }
Esempio n. 6
0
        private void updateButton_Click(object sender, RoutedEventArgs e)
        {
            MemberServices ms = new MemberServices();

            ms.UpdateMember(UpdatenameTextBoxa.Text, UpdatepositionTextBoxa.Text, UpdatedateOfBirthTextBoxa.Text, UpdatecontactNoTextBoxa.Text, UpdatejoinDateTextBoxa.Text, UpdateemailTextBoxa.Text, UpdateaddressTextBoxa.Text, UpdatesalaryTextBoxa.Text);
        }