Exemplo n.º 1
0
        public GroupInfoModel GetGroupInfo(string GroupID, string UserID = "")
        {
            GroupInfoModel group = null;

            var _group = base.getMany(a => a.ID == GroupID)
                         .Include(a => a.Users)
                         .ThenInclude(b => b.User)
                         .Include(a => a.Folders)
                         .Include(a => a.Notes)
                         .FirstOrDefault();

            if (_group != null)
            {
                group             = new GroupInfoModel();
                group.ID          = _group.ID;
                group.Name        = _group.Name;
                group.Explanation = _group.Explanation;
                group.CreateDate  = _group.CreateDate;
                group.Visible     = _group.Visible;
                group.FolderCount = _group.Folders.Count;
                group.NoteCount   = _group.Notes.Count;
                group.UserCount   = _group.Users.Where(a => a.Status == Status.Member || a.Status == Status.Manager).Count();
                group.WaitingUser = _group.Users.Where(a => a.Status == Status.Wait).Count();
                group.User        = _group.Users.FirstOrDefault(a => a.Status == Status.Owner).User;

                var user = _group.Users.FirstOrDefault(a => a.UserID == UserID);
                group.Status = user != null ? user.Status : !string.IsNullOrEmpty(UserID) ? Status.User : Status.Visitor;
            }

            return(group);
        }
Exemplo n.º 2
0
 //强制更新一个群的数据
 private void forceUpdateGroupInfo(int gid)
 {
     HttpReqHelper.requestSync(AppConst.WebUrl + "groupBaseInfo?protocol=" + HttpGroupProtocol.GROUP_BASE_INFO + "&gid=" + gid, delegate(string info)
     {
         try
         {
             GroupInfoModel model = Coding <GroupInfoModel> .decode(info);
             if (groupDic.ContainsKey(gid))
             {
                 groupDic[gid] = model;
             }
             else
             {
                 groupDic.TryAdd(gid, model);
             }
             //发送事件
             if (updateGroupInfoEvent != null)
             {
                 updateGroupInfoEvent(gid, model);
             }
             //移除无效列表
             invalidGroup.Remove(gid);
         }
         catch (Exception err)
         {
             Debug.Print("!!!DataMgr.modifyGroupInfo失败" + err.ToString());
         }
     });
 }
Exemplo n.º 3
0
 /// <summary>
 /// 新增拼团活动
 /// </summary>
 public ResultModel CreateGroupInfo(GroupInfoModel model)
 {
     using (brnshopEntities context = new brnshopEntities())
     {
         try
         {
             bsp_groupinfos newGroupInfo = new bsp_groupinfos();
             newGroupInfo.endtime    = model.endtime;
             newGroupInfo.groupoid   = model.groupoid;
             newGroupInfo.groupprice = model.groupprice;
             newGroupInfo.grouptype  = model.grouptype;
             newGroupInfo.maxtime    = model.maxtime;
             newGroupInfo.needcount  = model.needcount;
             newGroupInfo.shopprice  = model.shopprice;
             newGroupInfo.starttime  = model.starttime;
             context.bsp_groupinfos.Add(newGroupInfo);
             context.SaveChanges();
             return(ResultModel.Success("新增成功"));
         }
         catch (Exception ex)
         {
             Logger._.Error("CreateGroupInfo方法,", ex);
             return(ResultModel.Error(ex.ToString()));
         }
     }
 }
Exemplo n.º 4
0
        void refresh(object state)
        {
            GroupInfoModel newGroupModel = (GroupInfoModel)state;

            this.labelNickName.Text      = newGroupModel.Name;
            this.textBoxDescription.Text = newGroupModel.Description;
        }
Exemplo n.º 5
0
        private void GroupItem_Load(object sender, EventArgs e)
        {
            GraphicsPath path = new GraphicsPath();

            path.AddArc(pictureBoxGroupFace.DisplayRectangle, 0, 360);
            pictureBoxGroupFace.Region = new Region(path);
            m_SyncContext = SynchronizationContext.Current;
            if (m_myGroupModel == null)
            {
                return;
            }

            //获取这个群的基本信息
            DataMgr.Instance.getGroupByID(m_myGroupModel.GroupID, delegate(GroupInfoModel model) {
                m_groupInfoModel = model;
                //     Debug.Print("qqqqqqqqqqq群得到消息" + m_groupInfoModel.Name);
                initLabelSafePost();
                //下载头像

                if (m_groupInfoModel.Face != "" && m_groupInfoModel.Face != null)
                {
                    FaceMgr.Instance.getFaceByName(m_groupInfoModel.Face, delegate(Image face)
                    {
                        if (face != null)
                        {
                            this.pictureBoxGroupFace.Image = face;
                        }
                    });
                }
                else
                {
                    Debug.Print("err---------错误的头像!!!" + m_groupInfoModel.Face);
                }
            });
        }
Exemplo n.º 6
0
        public ActionResult Start(GroupInfoModel gim, ShoppingCart cart, BrowseHistory bh)
        {
            string approxtime = string.Empty;
            string mysAddress = gim.Address + " " + gim.ZipCode;

            string[] s = base.GetAddressCityState(gim.Address);
            ViewBag.ValidateAddress = string.Empty;
            List <BizInfo> lb = new List <BizInfo>();

            if (string.IsNullOrEmpty(gim.Address) || string.IsNullOrEmpty(gim.ZipCode) || gim.ZipCode.Length != 5 || string.IsNullOrEmpty(s[0]) || string.IsNullOrEmpty(s[1]) || string.IsNullOrEmpty(s[2]))
            {
                ViewBag.ValidateAddress = "Oops, feel like something wrong with you address. Please check it and try again.";
            }
            else
            {
                bh.Address          = s[0];
                bh.City             = s[1];
                bh.State            = s[2];
                bh.Zip              = gim.ZipCode;
                bh.AddressCityState = s[0] + ", " + s[1] + ", " + s[2];
                List <BizInfo> lbi = BizInfoRepository.GetBizInfoByZip(gim.ZipCode, true);
                foreach (var b in lbi)
                {
                    decimal st = SearchFilter.GetDistance(mysAddress, b.BizAddressString, out approxtime);
                    if (st >= 0 && st <= b.DeliveryRadius && b.Delivery)
                    {
                        lb.Add(b);
                    }
                }
                bh.GroupBizOption = lb;
            }
            gim.LBizInfo = lb;
            gim.Cart     = cart;
            return(PartialView(gim));
        }
Exemplo n.º 7
0
 //群资料时调用
 public FormShowGroupInfo(GroupInfoModel groupModel, Image face, GroupItem groupItem)
 {
     InitializeComponent();
     m_SyncContext = SynchronizationContext.Current;
     m_Face        = face;
     m_groupItem   = groupItem;
     //   DataMgr.Instance.deprecatedGroupInfoEvent += this.onGroupModelMotified;
 }
Exemplo n.º 8
0
 //双击
 private void GroupItem_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     //刷新一下数据,有可能已经过时了
     DataMgr.Instance.getGroupByID(m_myGroupModel.GroupID, delegate(GroupInfoModel model) {
         m_groupInfoModel = model;
         m_SyncContext.Post(openDialogSafePost, null);
     });
 }
Exemplo n.º 9
0
 private void 查看群资料ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //刷新一下数据,有可能已经过时了
     DataMgr.Instance.getGroupByID(m_myGroupModel.GroupID, delegate(GroupInfoModel model) {
         m_groupInfoModel = model;
         m_SyncContext.Post(setFormShowGroupInfoSafePost, null);
     });
 }
Exemplo n.º 10
0
 //当群模型发生改变(有更新)
 void onGroupModelUpdated(int gid, GroupInfoModel newMode)
 {
     if (m_groupInfoModel.Gid == gid)
     {
         m_groupInfoModel = newMode;
         //刷新群名字label
         initLabelSafePost();
     }
 }
Exemplo n.º 11
0
        public object getSegmentList(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg      = string.Empty;
                string mobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty;
                string routerToken = dicParas.ContainsKey("routerToken") ? dicParas["routerToken"].ToString() : string.Empty;
                string groupId     = dicParas.ContainsKey("groupId") ? dicParas["groupId"].ToString() : string.Empty;

                Base_MerchInfo merch = MerchBusiness.GetMerchModel(mobileToken);
                if (merch.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户令牌无效"));
                }

                Base_DeviceInfo router = DeviceBusiness.GetDeviceModel(routerToken);
                if (router.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "控制器令牌无效"));
                }

                Data_GameInfo group = GameBusiness.GetGameInfoModel(Convert.ToInt32(groupId));
                if (group.IsNull())
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "分组参数无效"));
                }

                //分组集合
                var groupList = MerchSegmentBusiness.GetMerchSegmentList().Where(t => t.ParentID == router.ID && t.GroupID == group.GroupID).ToList();

                GroupInfoModel model = new GroupInfoModel();
                model.groupId   = group.GroupID;
                model.groupName = group.GroupName;

                List <Terminal> Terminals = new List <Terminal>();
                foreach (var item in groupList)
                {
                    Terminal        t       = new Terminal();
                    Base_DeviceInfo cDevice = DeviceBusiness.GetDeviceModelById((int)item.DeviceID);
                    t.terminalName  = cDevice.DeviceName ?? cDevice.SN;
                    t.terminalToken = cDevice.Token;
                    t.headAddress   = item.HeadAddress;
                    t.sn            = cDevice.SN;
                    t.deviceType    = ((DeviceTypeEnum)cDevice.DeviceType).ToDescription();
                    t.status        = DeviceStatusBusiness.GetDeviceState(cDevice.Token);

                    Terminals.Add(t);
                }
                model.Terminals = Terminals;

                return(ResponseModelFactory <GroupInfoModel> .CreateModel(isSignKeyReturn, model));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 12
0
 public void SetGroupCard(Point location, GroupInfoModel model, Image face)
 {
     this.labelNickName.Text    = model.Name;
     this.labelUsername.Text    = "群号(" + model.Gid + ")";
     this.labelDiscription.Text = model.Description;
     this.pictureBoxFace.Image  = face;
     location      = new Point(location.X - this.Width - 20, location.Y - 10);//调整一下位置
     this.Location = location;
     this.Show();
 }
Exemplo n.º 13
0
 public FormModifyGroupInfo(GroupInfoModel groupModel, FormShowGroupInfo formShowGroupInfo)
 {
     InitializeComponent();
     this.textBoxNickName.Text = groupModel.Name;
     this.textBoxDisc.Text     = groupModel.Description;
     oldNickName         = this.textBoxNickName.Text;
     oldBoxDisc          = this.textBoxDisc.Text;
     m_SyncContext       = SynchronizationContext.Current;
     m_FormShowGroupInfo = formShowGroupInfo;
     m_groupModel        = groupModel;
 }
Exemplo n.º 14
0
        /// <summary>
        /// 获取邮组
        /// </summary>
        /// <param name="userId">用户UserId</param>
        /// <returns></returns>
        public async Task <GroupInfoModel> GetGroup(string groupid)
        {
            string         url   = $"https://api.exmail.qq.com/cgi-bin/group/get?access_token={this.Email_token}&groupid={groupid}";
            GroupInfoModel model = await HttpHelper.GetHttpAsync <GroupInfoModel>(url);

            if (model.Errcode != 0)
            {
                this.Errmsg = model.Errmsg;
                throw new Exception($"获取用户失败:{model.Errcode}-{this.Errmsg}");
            }
            return(await Task.FromResult(model));
        }
Exemplo n.º 15
0
 private void DisplayTags(GroupInfoModel tags)
 {
     try
     {
         _listTags = new List <ListTagModel>();
         if (tags.Tags != null)
         {
             foreach (var t in tags.Tags)
             {
                 _listTags.Add(new ListTagModel()
                 {
                     Name    = t.Name,
                     Value   = t.Value,
                     Quality = t.Quality,
                     Server  = new ServerModel()
                     {
                         Name = tags.Server.Name, IsConnected = tags.Server.IsConnected
                     },
                     Group = new GroupModel()
                     {
                         Name = tags.Group.Name, Active = tags.Group.Active
                     },
                     IconRow = "Image/dauthapdo.png"
                 });
             }
         }
         var data = lvTag.ItemsSource;
         if (data != null)
         {
             var temp = data as List <ListTagModel>;
             temp.Clear();
         }
         lvTag.ItemsSource = _listTags;
         lvTag.Items.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 16
0
        // GET: Group
        public ActionResult Index(ShoppingCart cart, BrowseHistory bh)
        {
            if (cart == null)
            {
                ControllerContext cc = new ControllerContext();
                cart = new ShoppingCart();
                cc.HttpContext.Session["ShoppingCart"] = cart;
                return(Redirect("/Home"));
            }

            ViewBag.status = 0; // new
            GroupInfoModel gim = new GroupInfoModel();

            if (string.IsNullOrEmpty(cart.CartKey) == false) // come back
            {
                gim.Name = cart.PersonName;
                if (GroupCart.GroupCarts[cart.CartKey].IsSharedCartLocked)
                {
                    if (cart.PersonName == GroupCart.GroupCarts[cart.CartKey].PartyBossName)
                    {
                        ViewBag.status = 11; // locked & boss
                    }
                    else
                    {
                        ViewBag.status = 12; //locked & guest
                    }
                }
                else
                {
                    ViewBag.status = 1; // unlocked
                }
                gim.LBizInfo = GroupCart.GroupCarts[cart.CartKey].SelectBizInfos;
            }
            gim.Address = string.IsNullOrEmpty(bh.AddressCityState) ? "" : bh.AddressCityState;
            gim.ZipCode = string.IsNullOrEmpty(bh.Zip) ? "" : bh.Zip;
            gim.Cart    = cart;
            return(View(gim));
        }
Exemplo n.º 17
0
 private void Woker_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (e.UserState == null)
     {
         return;
     }
     else if (e.UserState.GetType() == typeof(TagRequestModel))
     {
         var tag = e.UserState as TagRequestModel;
         if (tag.RequestType == RequestType.RemoveTag)
         {
             DisplayRemoveTag(tag);
         }
         else if (tag.RequestType == RequestType.AddTag)
         {
             DisplayAddTag(tag);
         }
     }
     else if (e.UserState.GetType() == typeof(List <ServerInfoModel>))
     {
         DisplayListServer(e.UserState as List <ServerInfoModel>);
     }
     else if (e.UserState.GetType() == typeof(GroupResponseModel))
     {
         var info = e.UserState as GroupResponseModel;
         if (info.RequestType == RequestType.ReadTag)
         {
             DisplayTags_AutoUpdate(info);      //DisplayText(tag);
         }
         else if (info.RequestType == RequestType.ReadGroupTags)
         {
             var group = new GroupInfoModel()
             {
                 Server = info.Server, Group = info.Group, Tags = info.Tags
             };
             DisplayTags(group);
         }
     }
     else if (e.UserState.GetType() == typeof(ErrorResponseModel))
     {
         var info = e.UserState as ErrorResponseModel;
         MessageBox.Show(info.Message, "Server message", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else if (e.UserState.GetType() == typeof(GroupRequestModel))
     {
         var info = e.UserState as GroupRequestModel;
         if (info.RequestType == RequestType.AddGroup)
         {
             DisplayAddGroup(info);
         }
         else if (info.RequestType == RequestType.RemoveGroup)
         {
             DisplayRemoveGroup(info);
         }
     }
     else if (e.UserState.GetType() == typeof(ServerRequestModel))
     {
         var info = e.UserState as ServerRequestModel;
         if (info.RequestType == RequestType.AddServer)
         {
             DisplayAddServer(info);
         }
         else if (info.RequestType == RequestType.RemoveServer)
         {
             DisplayRemoveServer(info);
         }
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// 新增拼团活动
 /// </summary>
 public ResultModel CreateGroupInfo(GroupInfoModel model)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 19
0
        /// <summary>
        /// 新增拼团活动
        /// </summary>
        public ActionResult CreateGroupInfo(GroupInfoModel model)
        {
            GROUP group = RemotingHelp.GetModelObject <GROUP>();

            return(Json(group.CreateGroupInfo(model), JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 20
0
        /// <summary>
        /// 新增拼团活动
        /// </summary>
        public ResultModel CreateGroupInfo(GroupInfoModel model)
        {
            GROUP group = RemotingHelp.GetModelObject <GROUP>();

            return(group.CreateGroupInfo(model));
        }
Exemplo n.º 21
0
 //刷新展示内容
 public void refreshSafePost(GroupInfoModel newGroupModel)
 {
     m_SyncContext.Post(refresh, newGroupModel);
 }
Exemplo n.º 22
0
        public void getGroupByID(int groupId, RequestGroupInfoEvent callBack)
        {
            if (groupDic.ContainsKey(groupId))
            {
                //判断有效性,这样可以保证拉取信息的地方,总可以获得最新的数据

                if (invalidGroup.Contains(groupId))//已过时,去更新,返回最新数据。
                {
                    HttpReqHelper.requestSync(AppConst.WebUrl + "groupBaseInfo?protocol=" + HttpGroupProtocol.GROUP_BASE_INFO + "&gid=" + groupId, delegate(string info)
                    {
                        try
                        {
                            GroupInfoModel newmodel = Coding <GroupInfoModel> .decode(info);
                            if (groupDic.ContainsKey(groupId))
                            {
                                groupDic[groupId] = newmodel;
                            }
                            //发送数据已更新的事件
                            if (updateGroupInfoEvent != null)
                            {
                                updateGroupInfoEvent(groupId, newmodel);
                            }
                            //移除无效列表
                            invalidGroup.Remove(groupId);
                            //返回最新数据
                            if (callBack != null)
                            {
                                callBack(groupDic[groupId]);
                            }
                        }
                        catch (Exception err)
                        {
                            Debug.Print("!!!DataMgr.modifyGroupInfo失败" + err.ToString());
                        }
                    });
                }
                else  //有效数据直接返回
                {
                    if (callBack != null)
                    {
                        callBack(groupDic[groupId]);
                    }
                }
            }
            else//还没有这条数据
            {
                HttpReqHelper.requestSync(AppConst.WebUrl + "groupBaseInfo?protocol=" + HttpGroupProtocol.GROUP_BASE_INFO + "&gid=" + groupId, delegate(string info) {
                    try
                    {
                        GroupInfoModel model = Coding <GroupInfoModel> .decode(info);
                        //  Debug.Print("收到信息"+ groupId+"  " + model.Name+ model.Master+"|||"+model.Createdtime+model.Verifymode);
                        groupDic.TryAdd(groupId, model);
                        //返回结果
                        if (callBack != null)
                        {
                            callBack(model);
                        }
                    }
                    catch (Exception err)
                    {
                        Debug.Print("!!!DataMgr.getGroupByID解析失败" + err.ToString());
                        if (callBack != null)
                        {
                            callBack(default(GroupInfoModel));
                        }
                    }
                });
            }
        }