Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (LDGlobals.loadedAccountsDictionary.Count <= 0)
                {
                    GlobusLogHelper.log.Info("Please upload the accounts");
                    return;
                }
                if (string.IsNullOrEmpty(cmb_MsgGroupMemer_selectedAcc.SelectedItem.ToString()))
                {
                    GlobusLogHelper.log.Info("Please select an acount from drop down menu");
                    return;
                }

                try
                {
                    // cmb_MsgGroupMemer_selectedAcc.Items.Remove()
                }
                catch
                { }

                MessageGroupMember objMessageGroupMember = new MessageGroupMember();

                new Thread(() =>
                {
                    objMessageGroupMember.LinkdinGroupMemberUpdate();
                }).Start();
            }
            catch (Exception ex)
            {
                GlobusLogHelper.log.Info("Exception : " + ex);
            }
        }
Beispiel #2
0
 private void btn_GetMembers_of_SelectedGroup_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(cmb_MsgGroupMemer_selectedAcc.ToString()))
         {
             MessageGroupMember.SelectedAcc = cmb_MsgGroupMemer_selectedAcc.SelectedItem.ToString();
         }
         else
         {
             GlobusLogHelper.log.Info("Please select an account from drop down menu");
             return;
         }
         if (!string.IsNullOrEmpty(cmb_members_of_selected_group.ToString()))
         {
             MessageGroupMember.selected_group = cmb_members_of_selected_group.SelectedItem.ToString();
         }
         else
         {
             GlobusLogHelper.log.Info("Please select group from drop down menu");
             return;
         }
         if (!string.IsNullOrEmpty(txt_MsgGroupMember_SearchKeyword.ToString()))
         {
             MessageGroupMember.SearchKeyword = txt_MsgGroupMember_SearchKeyword.ToString();
         }
         chklstBoxGroupMembers.Items.Clear();
         MessageGroupMember objMessageGroupMember = new MessageGroupMember();
         Thread             th = new Thread(objMessageGroupMember.startGettingMembers);
         th.Start();
     }
     catch (Exception ex)
     {
         GlobusLogHelper.log.Info("Exception : " + ex);
     }
 }
        public IHttpActionResult StartChatWithSP(StartChatWithSPViewModel viewModel)
        {
            bool success = false;
            var  message = "";
            var  model   = new StartChatWithSPModel();

            try
            {
                var jobDetail = context.Jobs.Where(x => x.ID == viewModel.JobId && x.IsActive == true && x.IsDelete == false).FirstOrDefault();
                var msgGroup  = context.MessageGroups.Where(x => x.JobID == viewModel.JobId && x.GroupAdminID == viewModel.FromUserId && x.UniqueGroupName == ("QuiGig-Group-" + viewModel.ToUserId)).FirstOrDefault();
                if (msgGroup == null)
                {
                    msgGroup                 = new MessageGroup();
                    msgGroup.GroupName       = jobDetail.JobTitle;
                    msgGroup.GroupAdminID    = viewModel.FromUserId;
                    msgGroup.UniqueGroupName = "QuiGig-Group-" + viewModel.ToUserId;
                    msgGroup.JobID           = jobDetail.ID;
                    msgGroup.IsActive        = true;
                    msgGroup.CreatedDate     = DateTime.UtcNow;
                    msgGroup.UpdatedDate     = DateTime.UtcNow;
                    context.MessageGroups.Add(msgGroup);

                    MessageGroupMember msgGroupMember = new MessageGroupMember();
                    /// For service provider ////
                    msgGroupMember.GroupId  = msgGroup.ID;
                    msgGroupMember.MemberId = viewModel.ToUserId;
                    context.MessageGroupMembers.Add(msgGroupMember);

                    /// For customer ////
                    MessageGroupMember entity = new MessageGroupMember();
                    entity.GroupId  = msgGroup.ID;
                    entity.MemberId = viewModel.FromUserId;
                    context.MessageGroupMembers.Add(entity);
                    context.SaveChanges();
                }
                var proposal = context.Proposals.Where(x => x.JobID == viewModel.JobId && x.UserID == viewModel.ToUserId).FirstOrDefault();
                model = context.GetStartMessageChatWithUser(viewModel.JobId, proposal.ID, viewModel.ToUserId, viewModel.FromUserId).Select(x => new StartChatWithSPModel
                {
                    IsBlock      = x.IsBlock,
                    BlockByID    = x.BlockByID,
                    JobTitle     = x.JobTitle,
                    BlockBy      = x.BlockBy,
                    JobID        = x.JobID,
                    JobCompleted = x.JobCompleted,
                    FromUserID   = viewModel.FromUserId,
                    HiredStatus  = x.HiredStatus,
                    GroupId      = x.GroupId,
                    FromUserName = x.FromUserName,
                }).FirstOrDefault();
                try
                {
                    model.UserMessageList = context.GetUserMessageList(viewModel.JobId, viewModel.FromUserId, viewModel.ToUserId).Select(y => new UserMessageListModel
                    {
                        FromUserID        = y.FromUserID,
                        MessageText       = y.MessageText,
                        ToUserID          = y.ToUserID,
                        FromUserImage     = y.FromUserImage,
                        ToUserImage       = y.ToUserImage,
                        FromUserShortName = y.FromUserShortName,
                        ToUserShortName   = y.ToUserShortName
                    }).ToList();
                }
                catch (Exception ex)
                {
                }
                success = true;
                message = "Get List";
            }
            catch (Exception ex)
            {
                message = ex.InnerException.Message;
            }
            return(Ok(new
            {
                Success = success,
                Message = message,
                Result = model
            }));
        }