public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            //int id = packet.ReadInt();
            string name = packet.ReadString();
            bool result = false;
            string msg = "ConsortiaInviteAddHandler.Failed";
            if(string.IsNullOrEmpty(name))
                return 0;
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaInviteUserInfo info = new ConsortiaInviteUserInfo();
                info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                info.ConsortiaName = client.Player.PlayerCharacter.ConsortiaName;
                info.InviteDate = DateTime.Now;
                info.InviteID = client.Player.PlayerCharacter.ID;
                info.InviteName = client.Player.PlayerCharacter.NickName;
                info.IsExist = true;
                info.Remark = "";
                info.UserID = 0;
                info.UserName = name;
                if (db.AddConsortiaInviteUsers(info, ref msg))
                {
                    msg = "ConsortiaInviteAddHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaInvite(info.ID, info.UserID, info.UserName, info.InviteID, info.InviteName, info.ConsortiaName,info.ConsortiaID);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
Exemplo n.º 2
0
 public bool AddConsortiaInviteUsers(ConsortiaInviteUserInfo info, ref string msg)
 {
     bool result = false;
     try
     {
         SqlParameter[] para = new SqlParameter[11];
         para[0] = new SqlParameter("@ID", info.ID);
         para[0].Direction = ParameterDirection.InputOutput;
         para[1] = new SqlParameter("@ConsortiaID", info.ConsortiaID);
         para[2] = new SqlParameter("@ConsortiaName", info.ConsortiaName == null ? "" : info.ConsortiaName);
         para[3] = new SqlParameter("@InviteDate", info.InviteDate);
         para[4] = new SqlParameter("@InviteID", info.InviteID);
         para[5] = new SqlParameter("@InviteName", info.InviteName == null ? "" : info.InviteName);
         para[6] = new SqlParameter("@IsExist", info.IsExist);
         para[7] = new SqlParameter("@Remark", info.Remark == null ? "" : info.Remark);
         para[8] = new SqlParameter("@UserID", info.UserID);
         para[8].Direction = ParameterDirection.InputOutput;
         para[9] = new SqlParameter("@UserName", info.UserName == null ? "" : info.UserName);
         para[10] = new SqlParameter("@Result", System.Data.SqlDbType.Int);
         para[10].Direction = ParameterDirection.ReturnValue;
         result = db.RunProcedure("SP_ConsortiaInviteUser_Add", para);
         info.ID = (int)para[0].Value;
         info.UserID = (int)para[8].Value;
         int returnValue = (int)para[10].Value;
         result = returnValue == 0;
         switch (returnValue)
         {
             case 2:
                 msg = "ConsortiaBussiness.AddConsortiaInviteUsers.Msg2";
                 break;
             case 4:
                 msg = "ConsortiaBussiness.AddConsortiaInviteUsers.Msg4";
                 break;
             case 5:
                 msg = "ConsortiaBussiness.AddConsortiaInviteUsers.Msg5";
                 break;
             case 6:
                 msg = "ConsortiaBussiness.AddConsortiaInviteUsers.Msg6";
                 break;
         }
     }
     catch (Exception e)
     {
         if (log.IsErrorEnabled)
             log.Error("Init", e);
     }
     finally
     {
     }
     return result;
 }
Exemplo n.º 3
0
        public ConsortiaInviteUserInfo[] GetConsortiaInviteUserPage(int page, int size, ref int total, int order, int userID, int inviteID)
        {
            List<ConsortiaInviteUserInfo> infos = new List<ConsortiaInviteUserInfo>();
            try
            {
                string sWhere = " IsExist=1 ";
                if (userID != -1)
                {
                    sWhere += " and UserID =" + userID + " ";
                }
                if (inviteID != -1)
                {
                    sWhere += " and UserID =" + inviteID + " ";
                }
                string sOrder = "ConsortiaName";
                switch (order)
                {
                    case 1:
                        sOrder = "Repute";
                        break;
                    case 2:
                        sOrder = "ChairmanName";
                        break;
                    case 3:
                        sOrder = "Count";
                        break;
                    case 4:
                        sOrder = "CelebCount";
                        break;
                    case 5:
                        sOrder = "Honor";
                        break;
                }

                sOrder += ",ID ";

                DataTable dt = GetPage("V_Consortia_Invite", sWhere, page, size, "*", sOrder, "ID", ref total);
                foreach (DataRow dr in dt.Rows)
                {
                    ConsortiaInviteUserInfo info = new ConsortiaInviteUserInfo();
                    info.ID = (int)dr["ID"];
                    info.CelebCount = (int)dr["CelebCount"];
                    info.ChairmanName = dr["ChairmanName"].ToString();
                    info.ConsortiaID = (int)dr["ConsortiaID"];
                    info.ConsortiaName = dr["ConsortiaName"].ToString();
                    info.Count = (int)dr["Count"];
                    info.Honor = (int)dr["Honor"];
                    info.InviteDate = (DateTime)dr["InviteDate"];
                    info.InviteID = (int)dr["InviteID"];
                    info.InviteName = dr["InviteName"].ToString();
                    info.IsExist = (bool)dr["IsExist"];
                    info.Remark = dr["Remark"].ToString();
                    info.Repute = (int)dr["Repute"];
                    info.UserID = (int)dr["UserID"];
                    info.UserName = dr["UserName"].ToString();
                    infos.Add(info);
                }

            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("Init", e);
            }
            finally
            {
            }

            return infos.ToArray();
        }
Exemplo n.º 4
0
 public static XElement CreateConsortiaInviteUserInfo(ConsortiaInviteUserInfo info)
 {
     return new XElement("Item", new XAttribute("ID", info.ID),
         new XAttribute("CelebCount", info.CelebCount),
         new XAttribute("ChairmanName", info.ChairmanName == null ? "" : info.ChairmanName),
         new XAttribute("ConsortiaID", info.ConsortiaID),
         new XAttribute("ConsortiaName", info.ConsortiaName == null ? "" : info.ConsortiaName),
         new XAttribute("Count", info.Count),
         new XAttribute("Honor", info.Honor),
         new XAttribute("InviteDate", info.InviteDate),
         new XAttribute("InviteID", info.InviteID),
         new XAttribute("InviteName", info.InviteName == null ? "" : info.InviteName),
         new XAttribute("Remark", info.Remark == null ? "" : info.Remark),
         new XAttribute("Repute", info.Repute),
         new XAttribute("UserID", info.UserID),
         new XAttribute("UserName", info.UserName == null ? "" : info.UserName));
 }