Esempio n. 1
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            EnvInfo envInfo = new EnvInfo();

            try
            {
                envInfo.NewCount         = Convert.ToInt32(textNewAccount.Text);
                envInfo.LoginBonusPoint  = Convert.ToInt32(textBonusPoint.Text);
                envInfo.ChargeBonusPoint = Convert.ToInt32(textChargePoint.Text);

                envInfo.ImageUploadPath = textImageUploadPath.Text;
                envInfo.ChargeSiteUrl   = txtChargeSiteUrl.Text;

                envInfo.ChargeGivePercent = Convert.ToInt32(textChargeGivePercent.Text);
                envInfo.EveryDayPoint     = Convert.ToInt32(textEveryDayPoint.Text);
                envInfo.CashRate          = Convert.ToInt32(textCashRate.Text);
            }
            catch
            {
                MessageBox.Show("输入的信息不准确.");
                return;
            }

            if (Database.GetInstance().SetEnviroment(envInfo) == false)
            {
                ErrorInfo errorInfo = BaseInfo.GetError();
                MessageBox.Show(errorInfo.ErrorString);
                return;
            }

            MessageBox.Show("设置成功.");
            this.Close();
        }
Esempio n. 2
0
        private void MngUser_Load(object sender, EventArgs e)
        {
            EnvInfo envInfo = Database.GetInstance().GetEnviroment();

            textNewAccount.Text  = envInfo.NewCount.ToString();
            textBonusPoint.Text  = envInfo.LoginBonusPoint.ToString();
            textChargePoint.Text = envInfo.ChargeBonusPoint.ToString();

            textImageUploadPath.Text = envInfo.ImageUploadPath;
            txtChargeSiteUrl.Text    = envInfo.ChargeSiteUrl;

            textChargeGivePercent.Text = envInfo.ChargeGivePercent.ToString();
            textEveryDayPoint.Text     = envInfo.EveryDayPoint.ToString();
            textCashRate.Text          = envInfo.CashRate.ToString();
        }
Esempio n. 3
0
        public bool ProcessCharge(string userID, int money)
        {
            EnvInfo  envInfo = Database.GetInstance().GetEnviroment();
            UserInfo manager = Database.GetInstance().GetManager(UserKind.Manager)[0];

            int cash        = money * envInfo.CashRate;
            int serviceCash = cash * envInfo.ChargeGivePercent / 100;

            // 수수료를 관리자에게서 제한다.
            if (GiveCash(manager.Id, -serviceCash) == false)
            {
                return(false);
            }

            if (GiveCash(userID, cash) == false)
            {
                return(false);
            }

            // 고객 충전기록
            ChargeHistoryInfo chargeHistoryInfo = new ChargeHistoryInfo();

            chargeHistoryInfo.Kind        = (int)ChargeKind.Charge;
            chargeHistoryInfo.Cash        = cash;
            chargeHistoryInfo.StartTime   = DateTime.Now;
            chargeHistoryInfo.EndTime     = DateTime.Now;
            chargeHistoryInfo.OwnId       = userID;
            chargeHistoryInfo.ApproveId   = Users.ManagerInfo.Id;
            chargeHistoryInfo.BankAccount = string.Format("收费 {0}", money - money * envInfo.ChargeGivePercent / 100);

            if (Database.GetInstance().AddChargeHistory(chargeHistoryInfo) == false)
            {
                return(false);
            }

            // 관리자 수수료기록
            chargeHistoryInfo = new ChargeHistoryInfo();

            chargeHistoryInfo.Kind        = (int)ChargeKind.Commission;
            chargeHistoryInfo.Cash        = -serviceCash;
            chargeHistoryInfo.StartTime   = DateTime.Now;
            chargeHistoryInfo.EndTime     = DateTime.Now;
            chargeHistoryInfo.OwnId       = manager.Id;
            chargeHistoryInfo.ApproveId   = Users.ManagerInfo.Id;
            chargeHistoryInfo.BankAccount = string.Format("佣金 {0}", money * envInfo.ChargeGivePercent / 100);

            if (Database.GetInstance().AddChargeHistory(chargeHistoryInfo) == false)
            {
                return(false);
            }


            // 2014-02-05: GreenRose
            // 사용자가에 충전상태를 알린다.
            UserInfo userInfo = Database.GetInstance().FindUser(userID);

            Server.GetInstance().Send(userInfo.Socket, NotifyType.Reply_UserInfo, userInfo);

            // 충전상태를 메세지로 보낸다.
            BoardInfo chargeBoardInfo = new BoardInfo();

            chargeBoardInfo.UserId  = Users.ManagerInfo.Id;
            chargeBoardInfo.SendId  = userInfo.Id;
            chargeBoardInfo.Title   = "通知";
            chargeBoardInfo.Content = string.Format("{0}缓冲填充. 您当前的缓存是{1}", cash, userInfo.Cash);
            chargeBoardInfo.Kind    = (int)BoardKind.Letter;

            if (Database.GetInstance().AddBoard(chargeBoardInfo) == false)
            {
                return(false);
            }

            List <BoardInfo> letters = Database.GetInstance().GetLetters(Users.ManagerInfo.Id);

            if (letters == null)
            {
                return(false);
            }

            HomeInfo homeInfo = new HomeInfo();

            homeInfo.Letters = letters;

            for (int i = 0; i < homeInfo.Letters.Count; i++)
            {
                if (homeInfo.Letters[i].Readed != 1)
                {
                    if (homeInfo.Letters[i].SendId == Users.ManagerInfo.Id)
                    {
                        break;
                    }
                    else
                    {
                        UserInfo liveUser = Users.GetInstance().FindUser(homeInfo.Letters[i].SendId);

                        if (liveUser != null)
                        {
                            homeInfo.Notices = Database.GetInstance().GetNotices(liveUser.Id);
                            Server.GetInstance().Send(liveUser.Socket, NotifyType.Reply_NoticeList, homeInfo);
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 4
0
        public AddCharge()
        {
            InitializeComponent();

            _envInfo = Database.GetInstance().GetEnviroment();
        }