public ActionResult CreateFederationMeeting(string Id)
        {
            int FedMeetingId = string.IsNullOrEmpty(Id.DecryptString()) ? default(int) : Convert.ToInt32(Id.DecryptString());
            FederationMeetingDTO objfedmeetingDto = new FederationMeetingDTO();

            if (FedMeetingId > 0)
            {
                objfedmeetingDto = _federationMeetingService.GetByID(FedMeetingId);
            }

            if (objfedmeetingDto.lstFederationMemberDto == null || objfedmeetingDto.lstFederationMemberDto.Count() < 1)
            {
                List <MeetingMembersDTO> lstmemberDto = _memberService.GetMemberSelectList();
                objfedmeetingDto.lstFederationMemberDto = lstmemberDto;
            }

            List <SelectListDto> lstVillages = _villageService.GetVillageSelectList();
            SelectList           slVillages  = new SelectList(lstVillages, "ID", "Text");

            ViewBag.villages = slVillages;
            List <SelectListDto> lstGroupDto = _groupService.GetGroupsSelectList();
            SelectList           lstgroup    = new SelectList(lstGroupDto, "ID", "Text");

            ViewBag.GroupNames = lstgroup;

            SelectList Reason = GetDropDownListByMasterCode(Enums.RefMasterCodes.REASON);

            ViewBag.Reason = Reason;

            return(View(objfedmeetingDto));
        }
        public int InserFederationMeetig(FederationMeetingDTO obj, List <MeetingMembersDTO> lstmembers)
        {
            int suceess = 0;

            string bankxml = CommonMethods.SerializeListDto <List <MeetingMembersDTO> >(lstmembers);

            return(suceess);
        }
        public FederationMeetingDTO GetByID(int FedMeetingId)
        {
            List <uspFederationMeetingGetByFederationMeetingID_Result> lstuspFederationMeetingGetByFederationMeetingID_Result = _dbContext.uspFederationMeetingGetByFederationMeetingID(FedMeetingId).ToList();
            FederationMeetingDTO fedmeetingdto = new FederationMeetingDTO();

            fedmeetingdto = Mapper.Map <uspFederationMeetingGetByFederationMeetingID_Result, FederationMeetingDTO>(lstuspFederationMeetingGetByFederationMeetingID_Result.FirstOrDefault());

            List <MeetingMembersDTO> lstmemberdto = new List <MeetingMembersDTO>();
            List <uspFederationMeetingmembersGetById_Result> lstuspFederationMeetingmembersGetById_Result = _dbContext.uspFederationMeetingmembersGetById(FedMeetingId).ToList();

            // lstmemberdto = Mapper.Map<List<uspFederationMeetingmembersGetById_Result>, List<MeetingMembersDTO>>(lstuspFederationMeetingmembersGetById_Result.ToList());
            foreach (var item in lstuspFederationMeetingmembersGetById_Result)
            {
                MeetingMembersDTO objmemberdto = new MeetingMembersDTO();
                objmemberdto.MemberID   = item.MemberID;
                objmemberdto.MemberName = item.MemberName;
                //  objmemberdto.FederationMeetingMemberID = item.FederationMeetingMemberID;
                objmemberdto.IsAttended = Convert.ToBoolean(item.IsAttended);
                lstmemberdto.Add(objmemberdto);
            }
            fedmeetingdto.lstFederationMemberDto = lstmemberdto;
            return(fedmeetingdto);
        }
        private ResultDto InsertUpdateFederation(FederationMeetingDTO federation)
        {
            ResultDto resultDto = new ResultDto();
            string    obectName = "Federation Meeting";

            try
            {
                string          FederationMeetingmember  = CommonMethods.SerializeListDto <List <MeetingMembersDTO> >(federation.lstFederationMemberDto);
                ObjectParameter paramfederationMeetingId = new ObjectParameter("FederationMeetingId", federation.FederationMeetingId);

                int count = _dbContext.uspFederationMeetingInsertUpdate(paramfederationMeetingId, federation.MeetingDate, federation.StartTime, federation.EndTime, federation.TransactionDate
                                                                        , federation.IsConducted, federation.OtherReason, federation.Reason, federation.IsSplMeeting
                                                                        , federation.MeetingObjective, federation.MeetingComments, federation.UserId, FederationMeetingmember);

                resultDto.ObjectId = (int)paramfederationMeetingId.Value;

                if (resultDto.ObjectId > 0)
                {
                    resultDto.Message = string.Format("{0} details saved successfully", obectName);
                }
                else if (resultDto.ObjectId == -1)
                {
                    resultDto.Message = string.Format("Error occured while generating {0} code", obectName);
                }
                else
                {
                    resultDto.Message = string.Format("Error occured while saving {0} details", obectName);
                }
            }
            catch (Exception)
            {
                resultDto.Message  = string.Format("Service layer error occured while saving the {0} details", obectName);
                resultDto.ObjectId = -98;
            }
            return(resultDto);
        }
        public ActionResult CreateFederationMeeting(FederationMeetingDTO federation, FormCollection form)
        {
            List <SelectListDto> lstVillages = _villageService.GetVillageSelectList();
            SelectList           slVillages  = new SelectList(lstVillages, "ID", "Text");

            ViewBag.villages = slVillages;
            SelectList Reason = GetDropDownListByMasterCode(Enums.RefMasterCodes.REASON);

            ViewBag.Reason = Reason;

            List <MeetingMembersDTO> lstmemberDto = _memberService.GetMemberSelectList();

            ViewBag.members = lstmemberDto;
            bool IsAttand = false;

            string[] time1 = form["StartTime"].ToLower().Replace("am", "").Replace("pm", "").Split(':');
            string[] time2 = form["EndTime"].ToLower().Replace("am", "").Replace("pm", "").Split(':');

            int hour1 = int.Parse(time1[0]);

            if (form["StartTime"].ToLower().Contains("pm") && hour1 < 12)
            {
                hour1 = hour1 + 12;
            }

            int hour2 = int.Parse(time2[0]);

            if (form["EndTime"].ToLower().Contains("pm") && hour1 < 12)
            {
                hour2 = hour2 + 12;
            }

            federation.StartTime = new TimeSpan(hour1, int.Parse(time1[1]), 0);
            federation.EndTime   = new TimeSpan(hour2, int.Parse(time2[1]), 0);
            federation.GroupId   = Convert.ToInt32(form["ddlgroup"]);

            List <MeetingMembersDTO> obj = federation.lstFederationMemberDto;
            int maxIndex = Convert.ToInt32(form["hdnIndex"]);

            federation.lstFederationMemberDto = new List <MeetingMembersDTO>();
            MeetingMembersDTO members = null;

            for (int i = 1; federation.IsConducted && i <= maxIndex; i++)
            {
                if (form["hdnMemberID_" + i] == null)
                {
                    continue;
                }

                members            = new MeetingMembersDTO();
                members.MemberID   = Convert.ToInt32(form["hdnMemberID_" + i]);
                members.MemberName = form["hdnMember_" + i];
                if (form["Checkmember_" + i] == "on")
                {
                    members.IsAttended = true;
                }
                federation.lstFederationMemberDto.Add(members);
            }

            var resultdto = new ResultDto();

            federation.IsConducted = !federation.IsConducted;
            federation.UserId      = UserInfo.UserID;
            if (federation.FederationMeetingId == 0)
            {
                resultdto = _federationMeetingService.Insert(federation);
            }
            else
            {
                resultdto = _federationMeetingService.Update(federation);
            }
            ModelState.Clear();
            ViewBag.Result = resultdto;
            return(RedirectToAction("FederationMeetingLookup"));
        }
 public ResultDto Update(FederationMeetingDTO federation)
 {
     return(InsertUpdateFederation(federation));
 }