public async Task <List <MembersDTO> > GetMembers(string branchname, Int64 fdconfigid, string ConnectionString)
        {
            List <MembersDTO> lstMembers = new List <MembersDTO>();
            await Task.Run(() =>
            {
                try
                {
                    //select distinct contactid,memberid,membercode,membername,mobileno from vwfddata where chitbranchname = '" + branchname + "' and fdconfigid = "+ fdconfigid + " order by membername
                    string query = "select distinct memberid,membercode,membername,mobileno,contactid from vwfdtransaction_details where chitbranchname='" + branchname + "' and fdconfigid=" + fdconfigid + " and balanceamount<=0 and interestpayout<>'On Maturity' and fdaccountid not in(select trans_type_id from maturity_bonds) and fdaccountid not in(select fd_account_id from self_or_adjustment) order by membername";
                    using (NpgsqlDataReader dr = NPGSqlHelper.ExecuteReader(ConnectionString, CommandType.Text, query))
                    {
                        while (dr.Read())
                        {
                            MembersDTO objMembers  = new MembersDTO();
                            objMembers.pMemberid   = dr["memberid"];
                            objMembers.pMembercode = dr["membercode"];
                            objMembers.pMembername = dr["membername"];
                            objMembers.pMobileno   = dr["mobileno"];
                            objMembers.pContactid  = dr["contactid"];
                            lstMembers.Add(objMembers);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            });

            return(lstMembers);
        }
Example #2
0
        public IHttpActionResult AddMember(MembersDTO membersDTO)//[FromBody]Members NewMember
        {
            Members members = membersDTO.ConvertToMembers();

            DB.Members.Add(members);
            DB.SaveChanges();
            return(Ok(DB.Members));
        }
Example #3
0
        public IHttpActionResult EditMember(MembersDTO NewMember)
        {
            Members m  = NewMember.ConvertToMembers();
            Members m2 = DB.Members.Where(x => x.Id == m.Id).First();

            m2.FreeTime = m.FreeTime;

            DB.SaveChanges();
            return(Ok(DB.Members));
        }
 public JsonResult SaveMember(MembersDTO memberModel)
 {
     try
     {
         var(isSaved, message) = _IMembersService.NewMember(memberModel);
         return(Json(message, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json("Failed :" + ex.Message, JsonRequestBehavior.AllowGet));
     }
 }
        public (bool isUpdated, string message) UpdateMember(MembersDTO model)
        {
            var modelData = _IMapper.Map <MembersDTO, Members>(model);

            _IUnitOfWork.Members.Update(modelData);
            var result = _IUnitOfWork.Commit();

            if (result > 0)
            {
                return(true, "Member Updated Successfuly");
            }
            else
            {
                return(false, "Failed updating Member");
            }
        }
 //Save Member
 public (bool isSave, string message) NewMember(MembersDTO model)
 {
     try
     {
         var modelData = _IMapper.Map <MembersDTO, Members>(model);
         _IUnitOfWork.Members.Add(modelData);
         var result = _IUnitOfWork.Commit();//Save to Database
         if (result > 0)
         {
             return(true, "Member added Successfuly");
         }
         else
         {
             return(false, "Failed adding Member");
         }
     }
     catch (Exception ex)
     {
         return(false, ex.Message);
     }
 }
Example #7
0
        public async Task <GetAllProjectMemberCandidateResponse> Handle(GetAllProjectMemberCandidateRequest query, CancellationToken cancellationToken)
        {
            var members = await _context.Members
                          .Where(x => x.MemberUsername != query.ExcludeCreatorUsername)
                          .ToListAsync(cancellationToken);

            var result = new GetAllProjectMemberCandidateResponse()
            {
                Members = new List <MembersDTO>()
            };

            foreach (var member in members)
            {
                var memberDTO = new MembersDTO()
                {
                    MemberUsername = member.MemberUsername
                };

                result.Members.Add(memberDTO);
            }

            return(result);
        }
 public JsonResult UpdateMemebr(MembersDTO memberModel)
 {
     (bool isUpdated, string message) = _IMembersService.UpdateMember(memberModel);
     return(Json(message, JsonRequestBehavior.AllowGet));
 }
Example #9
0
        public IHttpActionResult GetAllMembers()
        {
            List <MembersDTO> res = MembersDTO.ConvertToDto(DB.Members.ToList());

            return(Ok(res));
        }