public void ResetCache()
 {
     GiveAwayCount = 0;
     FriendsList.Clear();
     ApplyList.Clear();
     TodayRobList.Clear();
 }
示例#2
0
 public void AddNewRequest(GuildCharacter character)
 {
     ApplyList.Insert(0, character);
     if (ApplyList.Count > 20)
     {
         ApplyList.RemoveAt(ApplyList.Count - 1);
     }
 }
        /// <summary>
        /// 添加好友申请
        /// </summary>
        /// <returns></returns>
        public void AddFriendApply(int uid)
        {
            if (ApplyList.Count >= DataHelper.FriendApplyCountMax)
            {
                ApplyList.RemoveAt(ApplyList.Count - 1);
            }
            FriendApplyData apply = new FriendApplyData()
            {
                UserId    = uid,
                ApplyDate = DateTime.Now
            };

            ApplyList.Add(apply);
        }
示例#4
0
        public void RemoveApplyInfo(uint uuid)
        {
            PkgTeamUserIntro removeApplyInfo = null;

            foreach (PkgTeamUserIntro applyInfo in ApplyList)
            {
                if (applyInfo.brief.uuid == uuid)
                {
                    removeApplyInfo = applyInfo;
                }
            }
            if (removeApplyInfo != null)
            {
                ApplyList.Remove(removeApplyInfo);

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_APPLY_INFO_CHANGED, null);
            }
        }
示例#5
0
 private void HandleApplyList(ApplyList list)
 {
     if (list.ListId != "")
     {
         ApplyList newlist = ApplyList.getApplyListInfo(list.ListId);
         if (newlist != null)
         {
             if (Convert.ToDateTime(newlist.expirationDate) < DateTime.Now)
             {
                 ApplyList.updateApplyListInfo(list);
             }
         }
         else
         {
             ApplyList.addApplyListInfo(list);
         }
     }
 }
示例#6
0
        /// <summary>
        /// 修改申请表并插入审批记录
        /// </summary>
        /// <param name="approve_status">审批状态</param>
        /// <param name="reason">拒绝原因</param>
        private void ChangeApproveStatus(string approve_status, string reason = "")
        {
            applyinfo_grid.SelectedRows[0].Cells["apply_status"].Value  = approve_status;
            applyinfo_grid.SelectedRows[0].Cells["reject_reason"].Value = reason;
            string list_id = applyinfo_grid.SelectedRows[0].Cells["list_id"].Value.ToString();

            btn_approve.Enabled = false;
            btn_reject.Enabled  = false;

            string    applyid = applyinfo_grid.SelectedRows[0].Cells["apply_id"].Value.ToString();
            ApplyInfo apply   = ApplyInfo.getApplyInfo(applyid);

            if (apply != null)
            {
                ApprovalRecord approval = new ApprovalRecord();

                approval.approvalStatus   = apply.applyStatus = approve_status;
                approval.approvalContent  = apply.rejectReason = reason;
                approval.approvalUserId   = apply.lastApprovalUserId = currentUser.UserId;
                approval.ApprovalDate     = apply.lastApprovalDate = DateTime.Now.ToString();
                approval.applyId          = apply.applyId;
                approval.ApprovalUserType = currentUser.UserType;
                approval.applyUserId      = apply.applyUserId;
                if (!approve_status.Contains("拒绝"))
                {
                    ApplyList list = new ApplyList();
                    list.insertUserId   = apply.applyUserId;
                    list.insertDate     = DateTime.Now.ToString();
                    list.expirationDate = DateTime.Now.AddMonths(3).ToString();
                    list.ListId         = applyinfo_grid.SelectedRows[0].Cells["list_id"].Value.ToString();
                    HandleApplyList(list);
                }

                if (ApplyInfo.updateApplyInfo(apply) > 0 && ApprovalRecord.addApprovalInfo(approval) > 0)
                {
                    bindApplyGrid();
                    MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("操作失败,请重试!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
示例#7
0
    public static string SelectSingleSalesReturn(long sales_return_id)
    {
        try
        {
            if (sales_return_id == 0)
            {
                return("'Null'");
            }

            List <SalesReturn> _salesReturn = new List <SalesReturn>();

            var data = Database._SalesReturnSelect(sales_return_id);

            foreach (var d in data)
            {
                SalesReturn _sr = new SalesReturn();
                _sr.ID           = d.ID;
                _sr.CustomerID   = d.CustomerID.Value;
                _sr.CustomerName = d.CustomerName;
                _sr.Address      = d.Address;
                _sr.ForwarderID  = d.DeliverToID.Value;
                _sr.SalesmanID   = d.SalesmanID.Value;
                _sr.PoNO         = d.PONo;
                _sr.TermID       = d.TermID.Value;
                _sr.RefNo        = d.RefNo;
                _sr.RefSerial    = d.RefNoSerial;
                _sr.Date         = d.CreatedDate.Value;
                _sr.Notes        = d.Notes;
                _sr.TotalAmount  = d.TotalAmount.Value;

                var salesReturnDetails = Database._SalesReturnDetailsSelect(d.ID);
                List <SalesReturnDetail> salesReturnDetail = new List <SalesReturnDetail>();
                foreach (var srd in salesReturnDetails)
                {
                    SalesReturnDetail _srd = new SalesReturnDetail();
                    _srd.ID           = srd.ID;
                    _srd.ProductID    = srd.ProductID.Value;
                    _srd.ProductName  = srd.ProductName;
                    _srd.LocationID   = srd.LocationID.Value;
                    _srd.LocationName = srd.LocationName;
                    _srd.Quantity     = srd.Quantity.Value;
                    _srd.Unit         = srd.UnitName;
                    _srd.UnitPrice    = srd.UnitPrice.Value;
                    _srd.Discount     = srd.Discount;
                    _srd.Amount       = srd.Amount.Value;
                    salesReturnDetail.Add(_srd);
                }

                _sr.SalesReturnDetails = salesReturnDetail;

                //--------------------------
                var salesReturnPayment      = Database._invoicePaymentSalesReturns.Where(x => x.SalesReturnID == d.ID);
                List <ApplyList> ApplyLists = new List <ApplyList>();
                foreach (var srp in salesReturnPayment)
                {
                    ApplyList _al = new ApplyList();
                    _al.InvoiceID   = srp.InvoiceID.Value;
                    _al.RefNo       = Database._Invoices.SingleOrDefault(x => x.ID == srp.InvoiceID).RefNo + Database._Invoices.SingleOrDefault(x => x.ID == srp.InvoiceID).RefNoSerial;
                    _al.Date        = Database._Invoices.SingleOrDefault(x => x.ID == srp.InvoiceID).CreatedDate.Value;
                    _al.Description = "Invoices";
                    var salesman_id = Database._Invoices.SingleOrDefault(x => x.ID == srp.InvoiceID.Value).SalesmanID;
                    _al.Salesman      = Database._Employees.SingleOrDefault(x => x.ID == salesman_id).EmployeeName;
                    _al.Balance       = (Database._Invoices.SingleOrDefault(x => x.ID == srp.InvoiceID).TotalAmount.Value - srp.Amount.Value);
                    _al.AppliedAmount = srp.Amount.Value;

                    ApplyLists.Add(_al);
                }

                _sr.ApplyLists = ApplyLists;



                _salesReturn.Add(_sr);
            }


            if (_salesReturn.Count <= 0)
            {
                return("'Null'");
            }
            else
            {
                return(JsonConvert.SerializeObject(_salesReturn, Newtonsoft.Json.Formatting.None));
            }
        }
        catch (Exception)
        {
            return(string.Empty);
        }
    }
示例#8
0
        void HandleServerData(ushort protocol, byte[] data)
        {
            switch (protocol)
            {
            case NetMsg.MSG_TEAM_INFO:
            {
                S2CTeamInfo pack = S2CPackBase.DeserializePack <S2CTeamInfo>(data);

                // 如果是新创建的队伍
                if (TeamId == 0 && pack.team_info.team_id > 0)
                {
                    RemoveAllBeInvitedInfos();
                }

                TeamId         = pack.team_info.team_id;
                LeaderId       = pack.team_info.leader_id;
                TargetId       = pack.team_info.target_id;
                TargetMinLevel = pack.team_info.min_lv;
                TargetMaxLevel = pack.team_info.max_lv;
                TeamMembers    = pack.team_info.members;
                if (pack.team_info.auto_match == 0)
                {
                    mIsAutoMatchingPlayer = false;
                }
                else
                {
                    mIsAutoMatchingPlayer = true;
                }
                mIsAutoMatchingTeam = false;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, new CEventBaseArgs(pack.auto_build));
                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_AUTO_MATCHING_STATE_CHANGED, null);

                UpdateMembersTeamIcon(null);

                break;
            }

            case NetMsg.MSG_TEAM_LIST:
            {
                S2CTeamList pack = S2CPackBase.DeserializePack <S2CTeamList>(data);

                break;
            }

            case NetMsg.MSG_TEAM_APPLY:
            {
                S2CTeamApply pack = S2CPackBase.DeserializePack <S2CTeamApply>(data);

                if (pack.result == 1)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_APPLY_SUCCESS"));
                }
                else
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_APPLY_FAIL"));
                }

                break;
            }

            case NetMsg.MSG_TEAM_APPLY_INFO:
            {
                S2CTeamApplyInfo pack = S2CPackBase.DeserializePack <S2CTeamApplyInfo>(data);

                foreach (PkgTeamUserIntro applyInfo in pack.apply_list)
                {
                    if (IsInApllyList(applyInfo.brief.uuid) == false)
                    {
                        ApplyList.Add(applyInfo);
                    }
                }

                if (IsAutoAgree == true && SceneHelp.Instance.IsInWildInstance() == true)
                {
                    List <uint> uuids = new List <uint>();
                    uuids.Clear();
                    foreach (PkgTeamUserIntro apply in ApplyList)
                    {
                        uuids.Add(apply.brief.uuid);
                    }
                    HandleApply(1, uuids);
                }
                else
                {
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_APPLY_INFO_CHANGED, null);
                }

                break;
            }

            case NetMsg.MSG_TEAM_ADD_MEMBER:
            {
                S2CTeamAddMember pack = S2CPackBase.DeserializePack <S2CTeamAddMember>(data);

                if (HaveMember(pack.member.brief.uuid) == false)
                {
                    TeamMembers.Add(pack.member);

                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, null);

                    // 在申请列表里面删除该玩家
                    RemoveApplyInfo(pack.member.brief.uuid);
                }

                break;
            }

            case NetMsg.MSG_TEAM_LEAVE:
            {
                S2CTeamLeave pack = S2CPackBase.DeserializePack <S2CTeamLeave>(data);

                if (pack.uuid == Game.Instance.LocalPlayerID.obj_idx)
                {
                    if (pack.reason == 1)
                    {
                        ApplyList.Clear();
                        ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_APPLY_INFO_CHANGED, null);

                        if (TeamMembers.Count == 1)
                        {
                            if (HaveTeam == true)
                            {
                                UINotice.Instance.ShowMessage(DBConstText.GetText("TEAM_DISMISS_TIPS"));
                            }
                        }
                        else
                        {
                            if (HaveTeam == true)
                            {
                                string msg = DBConstText.GetText("TEAM_ME_LEAVE_TIPS");
                                //ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_SYSTEM_MESSAGE_SHOW, new CEventBaseArgs(msg));
                                UINotice.Instance.ShowMessage(msg);
                            }
                        }
                    }
                    else
                    {
                        if (HaveTeam == true)
                        {
                            string msg = DBConstText.GetText("TEAM_ME_EXPEL_TIPS");
                            //ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_SYSTEM_MESSAGE_SHOW, new CEventBaseArgs(msg));
                            UINotice.Instance.ShowMessage(msg);
                        }
                    }

                    List <PkgTeamMember> tempMembers = new List <PkgTeamMember>(TeamMembers);

                    TeamId         = 0;
                    LeaderId       = 0;
                    TargetType     = 1;
                    TargetId       = 0;
                    TargetMinLevel = 0;
                    TargetMaxLevel = 0;
                    TeamMembers.Clear();

                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, null);

                    UpdateMembersTeamIcon(tempMembers);
                }
                else
                {
                    PkgTeamMember leaveMember = GetMember(pack.uuid);
                    if (leaveMember != null)
                    {
                        TeamMembers.Remove(leaveMember);

                        ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, null);

                        string msg = "";
                        if (pack.reason == 1)
                        {
                            msg = string.Format(DBConstText.GetText("TEAM_LEAVE_TIPS"), System.Text.Encoding.UTF8.GetString(leaveMember.brief.name));
                            UINotice.Instance.ShowMessage(msg);
                        }
                        else
                        {
                            msg = string.Format(DBConstText.GetText("TEAM_EXPEL_TIPS"), System.Text.Encoding.UTF8.GetString(leaveMember.brief.name));
                            UINotice.Instance.ShowMessage(msg);
                        }
                        ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_SYSTEM_MESSAGE_SHOW, new CEventBaseArgs(msg));
                    }
                }

                if (IsAutoAgree == true && SceneHelp.Instance.IsInWildInstance() == true)
                {
                    List <uint> uuids = new List <uint>();
                    uuids.Clear();
                    foreach (PkgTeamUserIntro apply in ApplyList)
                    {
                        uuids.Add(apply.brief.uuid);
                    }
                    HandleApply(1, uuids);
                }

                break;
            }

            case NetMsg.MSG_TEAM_BE_REJECTED:
            {
                S2CTeamBeRejected pack = S2CPackBase.DeserializePack <S2CTeamBeRejected>(data);

                UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_REJECT_TIPS"), System.Text.Encoding.UTF8.GetString(pack.leader_name)));

                break;
            }

            case NetMsg.MSG_TEAM_PROMOTE:
            {
                S2CTeamPromote pack = S2CPackBase.DeserializePack <S2CTeamPromote>(data);

                // 没有队伍的话,LeaderId要赋值为0
                if (HaveTeam == true)
                {
                    LeaderId = pack.uuid;
                }
                else
                {
                    LeaderId = 0;
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, null);

                UpdateMembersTeamIcon(null);

                // 如果不是转让给自己,则清空申请列表
                if (pack.uuid != Game.GetInstance().LocalPlayerID.obj_idx)
                {
                    ApplyList.Clear();
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_APPLY_INFO_CHANGED, null);

                    PkgTeamMember member = GetMember(pack.uuid);
                    if (member != null)
                    {
                        string msg = string.Format(DBConstText.GetText("TEAM_PROMOTE_TIPS"), System.Text.Encoding.UTF8.GetString(member.brief.name));
                        UINotice.Instance.ShowMessage(msg);
                        ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_SYSTEM_MESSAGE_SHOW, new CEventBaseArgs(msg));
                    }
                }
                else
                {
                    string msg = DBConstText.GetText("TEAM_ME_PROMOTE_TIPS");
                    UINotice.Instance.ShowMessage(msg);
                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_SYSTEM_MESSAGE_SHOW, new CEventBaseArgs(msg));

                    mIsAutoMatchingPlayer = false;

                    ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_AUTO_MATCHING_STATE_CHANGED, null);
                }

                break;
            }

            case NetMsg.MSG_TEAM_INVITE:
            {
                S2CTeamInvite pack = S2CPackBase.DeserializePack <S2CTeamInvite>(data);

                if (pack.type > 0)
                {
                    UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_HAVE_INVITED"), System.Text.Encoding.UTF8.GetString(pack.name)));
                }

                AddInviteCD(pack.uuid);

                break;
            }

            case NetMsg.MSG_TEAM_BE_INVITE:
            {
                S2CTeamBeInvite pack = S2CPackBase.DeserializePack <S2CTeamBeInvite>(data);

                if (IsAutoRejectInvite == true)
                {
                    HandleInvite(2, pack.team_id, 1);
                    break;
                }

                bool existing = false;
                foreach (S2CTeamBeInvite teamBeInvite in BeInvitedInfos)
                {
                    if (teamBeInvite.team_id == pack.team_id)
                    {
                        existing = true;
                    }
                }
                if (existing == false)
                {
                    BeInvitedInfos.Add(pack);
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_BE_INVITED, null);

                break;
            }

            case NetMsg.MSG_TEAM_HANDLE_INVITE:
            {
                S2CTeamHandleInvite pack = S2CPackBase.DeserializePack <S2CTeamHandleInvite>(data);

                if (pack.choice == 2)
                {
                    // 对方已设置本次登录不再接收邀请
                    if (pack.type == 1)
                    {
                        UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_AUTO_REJECT_TIPS"), System.Text.Encoding.UTF8.GetString(pack.name)));
                    }
                    else
                    {
                        UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("TEAM_REJECT_INVITE"), System.Text.Encoding.UTF8.GetString(pack.name)));
                    }
                }

                break;
            }

            case NetMsg.MSG_TEAM_INTRO:
            {
                S2CTeamIntro pack = S2CPackBase.DeserializePack <S2CTeamIntro>(data);

                break;
            }

            case NetMsg.MSG_TEAM_TARGET:
            {
                S2CTeamTarget pack = S2CPackBase.DeserializePack <S2CTeamTarget>(data);

                TargetId       = pack.target_id;
                TargetMinLevel = pack.min_lv;
                TargetMaxLevel = pack.max_lv;

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_TARGET_CHANGED, null);

                break;
            }

            case NetMsg.MSG_TEAM_MEMBER_INFO:
            {
                S2CTeamMemberInfo pack = S2CPackBase.DeserializePack <S2CTeamMemberInfo>(data);

                PkgTeamMember member = GetMember(pack.uuid);
                if (member != null)
                {
                    member.dungeon_id = pack.dungeon_id;
                    member.brief      = pack.info;
                }

                ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_TEAM_INFO_CHANGED, null);

                break;
            }

            case NetMsg.MSG_TEAM_SET_MATCH:
            {
                S2CTeamSetMatch pack = S2CPackBase.DeserializePack <S2CTeamSetMatch>(data);

                if (pack.auto_match == 0)
                {
                    IsAutoMatchingPlayer = false;
                }
                else
                {
                    IsAutoMatchingPlayer = true;
                }

                break;
            }

            case NetMsg.MSG_TEAM_NEARBY_USER:
            {
                S2CTeamNearbyUser pack = S2CPackBase.DeserializePack <S2CTeamNearbyUser>(data);

                break;
            }

            case NetMsg.MSG_TEAM_ERROR:
            {
                S2CTeamError pack = S2CPackBase.DeserializePack <S2CTeamError>(data);

                PkgTeamMember member = GetMember(pack.uuid);
                if (member != null)
                {
                    UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_CAN_NOT_START_INSTANCE") + xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_83") + GameConst.COLOR_DARK_RED + System.Text.Encoding.UTF8.GetString(member.brief.name) + xc.TextHelper.GetConstText("CODE_TEXT_LOCALIZATION_42") + DBErrorCode.GetErrorString(pack.err_code));
                }

                ui.ugui.UIManager.Instance.ShowWaitScreen(false);

                break;
            }

            default: break;
            }
        }
示例#9
0
 public void RemoveRequest(int userId)
 {
     ApplyList.RemoveAll(t => t.UserID == userId);
 }
示例#10
0
 /// <summary>
 /// 查找邀请人
 /// </summary>
 /// <returns></returns>
 public GuildCharacter FindRequest(int userId)
 {
     return(ApplyList.Find(t => t.UserID == userId));
 }
 /// <summary>
 /// 查找好友申请
 /// </summary>
 /// <returns></returns>
 public FriendApplyData FindFriendApply(int uid)
 {
     return(ApplyList.Find(t => (t.UserId == uid)));
 }
 /// <summary>
 /// 是否有此好友申请
 /// </summary>
 /// <returns></returns>
 public bool IsHaveFriendApply(int uid)
 {
     return(ApplyList.Find(t => (t.UserId == uid)) != null);
 }