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

            int id = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaApplyLoginHandler.ADD_Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaApplyUserInfo info = new ConsortiaApplyUserInfo();
                info.ApplyDate = DateTime.Now;
                info.ConsortiaID = id;
                info.ConsortiaName = "";
                info.IsExist = true;
                info.Remark = "";
                info.UserID = client.Player.PlayerCharacter.ID;
                info.UserName = client.Player.PlayerCharacter.NickName;
                if (db.AddConsortiaApplyUsers(info, ref msg))
                {
                    msg = id != 0 ? "ConsortiaApplyLoginHandler.ADD_Success" : "ConsortiaApplyLoginHandler.DELETE_Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
Пример #2
0
        public ConsortiaApplyUserInfo[] GetConsortiaApplyUserPage(int page, int size, ref int total, int order, int consortiaID, int applyID, int userID)
        {
            List<ConsortiaApplyUserInfo> infos = new List<ConsortiaApplyUserInfo>();
            try
            {
                string sWhere = " IsExist=1 ";
                if (consortiaID != -1)
                {
                    sWhere += " and ConsortiaID =" + consortiaID + " ";
                }
                if (applyID != -1)
                {
                    sWhere += " and ID =" + applyID + " ";
                }
                if (userID != -1)
                {
                    sWhere += " and UserID ='" + userID + "' ";
                }
                string sOrder = "ID";
                switch (order)
                {
                    case 1:
                        sOrder = "UserName,ID";
                        break;
                    case 2:
                        sOrder = "ApplyDate,ID";
                        break;
                }

                DataTable dt = GetPage("V_Consortia_Apply_Users", sWhere, page, size, "*", sOrder, "ID", ref total);
                foreach (DataRow dr in dt.Rows)
                {
                    ConsortiaApplyUserInfo info = new ConsortiaApplyUserInfo();
                    info.ID = (int)dr["ID"];
                    info.ApplyDate = (DateTime)dr["ApplyDate"];
                    info.ConsortiaID = (int)dr["ConsortiaID"];
                    info.ConsortiaName = dr["ConsortiaName"].ToString();
                    info.ID = (int)dr["ID"];
                    info.IsExist = (bool)dr["IsExist"];
                    info.Remark = dr["Remark"].ToString();
                    info.UserID = (int)dr["UserID"];
                    info.UserName = dr["UserName"].ToString();
                    info.UserLevel = (int)dr["Grade"];
                    info.Win = (int)dr["Win"];
                    info.Total = (int)dr["Total"];
                    info.Repute = (int)dr["Repute"];
                    info.FightPower = (int)dr["FightPower"];
                    infos.Add(info);
                }

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

            return infos.ToArray();
        }
Пример #3
0
 public bool AddConsortiaApplyUsers(ConsortiaApplyUserInfo info, ref string msg)
 {
     bool result = false;
     try
     {
         SqlParameter[] para = new SqlParameter[9];
         para[0] = new SqlParameter("@ID", info.ID);
         para[0].Direction = ParameterDirection.InputOutput;
         para[1] = new SqlParameter("@ApplyDate", info.ApplyDate);
         para[2] = new SqlParameter("@ConsortiaID", info.ConsortiaID);
         para[3] = new SqlParameter("@ConsortiaName", info.ConsortiaName == null ? "" : info.ConsortiaName);
         para[4] = new SqlParameter("@IsExist", info.IsExist);
         para[5] = new SqlParameter("@Remark", info.Remark == null ? "" : info.Remark);
         para[6] = new SqlParameter("@UserID", info.UserID);
         para[7] = new SqlParameter("@UserName", info.UserName == null ? "" : info.UserName);
         para[8] = new SqlParameter("@Result", System.Data.SqlDbType.Int);
         para[8].Direction = ParameterDirection.ReturnValue;
         result = db.RunProcedure("SP_ConsortiaApplyUser_Add", para);
         info.ID = (int)para[0].Value;
         int returnValue = (int)para[8].Value;
         result = returnValue == 0;
         switch (returnValue)
         {
             case 2:
                 msg = "ConsortiaBussiness.AddConsortiaApplyUsers.Msg2";
                 break;
             case 6:
                 msg = "ConsortiaBussiness.AddConsortiaApplyUsers.Msg6";
                 break;
             case 7:
                 msg = "ConsortiaBussiness.AddConsortiaApplyUsers.Msg7";
                 break;
         }
     }
     catch (Exception e)
     {
         if (log.IsErrorEnabled)
             log.Error("Init", e);
     }
     finally
     {
     }
     return result;
 }
Пример #4
0
 public static XElement CreateConsortiaApplyUserInfo(ConsortiaApplyUserInfo info)
 {
     return new XElement("Item", new XAttribute("ID", info.ID),
         new XAttribute("ApplyDate", info.ApplyDate.ToString("yyyy-MM-dd HH:mm:ss")),
         new XAttribute("ConsortiaID", info.ConsortiaID),
         new XAttribute("ConsortiaName", info.ConsortiaName == null ? "" : info.ConsortiaName),
         new XAttribute("Remark", info.Remark),
         new XAttribute("UserID", info.UserID),
         new XAttribute("UserName", info.UserName == null ? "" : info.UserName),
         new XAttribute("UserLevel", info.UserLevel),
         new XAttribute("Win", info.Win),
         new XAttribute("Total", info.Total),
         new XAttribute("Repute", info.Repute));
 }