protected void DoPause(bool pause)
        {
            ApiControl tc = Config.GetApIEngine();

            try
            {
                string    sIDs = GetCheckedValues(Config.MainCheckboxName);
                string [] s    = sIDs.Split(new char [] { ',' });
                int       l;
                for (l = 0; l < s.Length; l++)
                {
                    if (s[l] != String.Empty)
                    {
                        if (pause)
                        {
                            tc.UpdateSelectedTournamentsStatus(2, Utils.GetInt(s[l]));
                        }
                        else
                        {
                            tc.UpdateSelectedTournamentsStatus(1, Utils.GetInt(s[l]));
                        }
                    }
                }
            }
            finally
            {
                BindGrid();
                tc = null;
            }
        }
Beispiel #2
0
        protected void SavePrize()
        {
            if (ddPrizeValueType.SelectedValue != Config.PrizeValueAny)
            {
                string stat = prData.CheckPercent();

                if (stat != String.Empty)
                {
                    lblInfo.Text    = stat;
                    lblInfo.Visible = true;
                    return;
                }
            }

            string xml = prData.DataSetToXML(nPrizeNumber, Utils.GetInt(ddCurrency.SelectedValue), Utils.GetInt(ddPrizeValueType.SelectedValue));

            hdnTournamentPrizeXML.Value = xml;
            xmlTournamentPrize          = xml;

            ApiControl oTournament = Config.GetApIEngine();

            if (!oTournament.SetPrizePool(nTournamentID, xmlTournamentPrize))
            {
                ShowError("COM error occured");
                oTournament = null;
                return;
            }
            oTournament       = null;
            lblInfo.Text      = "Tournament Prizes were saved";
            lblInfo.ForeColor = Color.Green;
            lblInfo.Visible   = true;

            Response.Redirect(GetGoBackUrl());
        }
        protected void btnAddBots_Click(object sender, EventArgs e)
        {
            ApiControl ac       = Config.GetApIEngine();
            int        mxNumber = txtMaxNumber.Visible ? Utils.GetInt(txtMaxNumber.Text) : Utils.GetInt(ddMaxNumber_Add.SelectedValue);

            ac.AddBots(Utils.GetInt(ddProcesses.SelectedValue), Utils.GetInt(ddSitdownType_Add.SelectedValue), mxNumber, ApiTarget);
        }
Beispiel #4
0
        protected override void AfterModifySetOfRecordsFromCombo(string sProcedureName, string sIDs, int typeAction)
        {
            ApiControl oTc = Config.GetApIEngine();

            string [] ar = sIDs.Split(new char[] { ',' });
            int       l;

            switch (typeAction)
            {
            case 0:
                if (sProcedureName == Config.DbEnableChat || sProcedureName == Config.DbDisableChat)
                {
                    for (l = 0; l < ar.Length; l++)
                    {
                        if (ar[l] != String.Empty)
                        {
                            oTc.UpdateUserChatAllow(int.Parse(ar[l]), (sProcedureName == Config.DbEnableChat ? 1 : 0));
                        }
                    }
                }
                break;

            case 1:
            case 2:
                for (l = 0; l < ar.Length; l++)
                {
                    if (ar[l] != String.Empty)
                    {
                        oTc.UpdateUserStatus(int.Parse(ar[l]), typeAction);
                    }
                }
                break;
            }
            oTc = null;
        }
Beispiel #5
0
        protected void btnKickOff_Click(object sender, System.EventArgs e)
        {
            ApiControl oTc = Config.GetApIEngine();

            try
            {
                string    sIDs = GetCheckedValues(Config.MainCheckboxName);
                string [] s    = sIDs.Split(new char [] { ',' });
                int       l;
                for (l = 0; l < s.Length; l++)
                {
                    if (s[l] != String.Empty)
                    {
                        if (!IsTournament)
                        {
                            oTc.KickOffUserFromProcess(int.Parse(s[l]), intProcessID);
                        }
                        else
                        {
                            oTc.KickOffUserFromTournament(int.Parse(s[l]), intProcessID);
                        }
                    }
                }
            }
            finally
            {
                oTc = null;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ApiControl oTournament = Config.GetApIEngine();
            int        engineID;

            try
            {
                //1. Create new xml
                if (comboEngine.Items.Count <= 0)
                {
                    return;
                }

                engineID = Convert.ToInt32(comboEngine.Items[comboEngine.SelectedIndex].Value);
                string xmlString = oTournament.GetDefaultProperty(engineID,
                                                                  (enType == TrnType.Tornament ?  ApiMsg.enProcessFormTarget.Tournament : ApiMsg.enProcessFormTarget.SitAndGo));

                xmlString = oCom.getFormXml(xmlString, Page);
                xmlString = oCom.setAttributeValue(xmlString, "properties/property", "Tournament Type", (string)Session["Tournament Type Maintenance"]);
                xmlString = oCom.setAttributeValue(xmlString, "properties/property", "Category", Utils.GetInt(enType).ToString());

                if (xmlString == null)
                {
                    Log.Write(this, "Some error occured. Object does not return error description");
                    ShowError("Error occured while creating xml.");
                    return;
                }

                //2. Call InitGameProcess method of Com
                //int sEngineID = Utils.GetInt(comboEngine.Items[comboEngine.SelectedIndex].Value);
                int sADispID     = Utils.GetInt(comboActDisp.Items[comboActDisp.SelectedIndex].Value);
                int tournamentID = 0;
                oTournament.InitGameProcess(engineID, (int)(enType == TrnType.Tornament ?
                                                            ApiMsg.enProcessFormTarget.Tournament : ApiMsg.enProcessFormTarget.SitAndGo), ref tournamentID, xmlString, sADispID);
                if (tournamentID <= 0)
                {
                    Log.Write(this, "Some error occured. Object does not return error description");
                    ShowError("Object error. Tournament wasn't created.");
                    Log.Write(this, "Object error. Tournament wasn't created.");
                    return;
                }

                //3. Save xml in DB
                nTournamentID = tournamentID;
                DBase.Execute(Config.DbUpdateTournamentSettings, "@ID", nTournamentID, "@SettingsXml", xmlString);                 //delete game process in com error case


                //4. Success message
                //		StoreBackID(nTournamentID);
                hdnTournamentID.Value = nTournamentID.ToString();
                lblInfo.Text          = "Tournament was created";
                lblInfo.ForeColor     = Color.Green;
                GetData();
            }
            finally{ oTournament = null; }
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="agApiControl"></param>
        private void download(ApiControl agApiControl)
        {
            DownloadControl wkDownloadControl = new DownloadControl(agApiControl.PostInfoList, txtFolder.Text);

            wkDownloadControl.ProgressChanged += new EventHandler(DownloadControl_ProgressChanged);

            wkDownloadControl.DownloadEnd += new EventHandler(DownloadControl_DownloadEnd);

            wkDownloadControl.ImageDonload();
        }
Beispiel #8
0
        /// <summary>
        /// Return table with default engine properties
        /// </summary>
        private void FillEngineProperty()
        {
            //Creating com objects and getting xml
            string     xmlString = "";
            ApiControl oEngine   = Config.GetApIEngine();

            xmlString = oEngine.GetDefaultProperty(1, ApiMsg.enProcessFormTarget.Process);
            oEngine   = null;
            oCom.FillTable(xmlString, "gameengine/properties/property", true, ref table);
        }
Beispiel #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wkApiControl_ProgressChanged(object sender, EventArgs e)
        {
            ApiControl wkApiControl = (ApiControl)sender;

            downloadProgress.CountUp(wkApiControl.PostInfoList.Count(), string.Format("ダウンロードリストを作成中です...{0}/{1}", wkApiControl.PostInfoList.Count(), wkApiControl.TotalPosts));

            if (downloadProgress.Cancel)
            {
                wkApiControl.CreatePostInfoListCancel();
            }
        }
Beispiel #10
0
        protected void  btnSendMsgAll_Click(object sender, System.EventArgs e)
        {
            if (txtMessage.Text.Length <= 0)
            {
                return;
            }
            string     msg  = txtMessage.Text;
            ApiControl admC = Config.GetApIEngine();

            admC.SendMessageToAll(msg);
            string m = LogAdmin.LogFileName;
        }
        private void CreateDataSource()
        {
            ApiControl ac  = Config.GetApIEngine();
            string     rez = ac.GetBotsInfo(Utils.GetInt(ddProcesses.SelectedValue), ApiTarget);

            if (rez == String.Empty)
            {
                return;
            }
            GetInfoasDS(rez);
            return;
        }
        protected void btnSetupPolicy_Click(object sender, EventArgs e)
        {
            string IDs = this.GetCheckedValues(Common.Config.MainCheckboxName);

            if (IDs == String.Empty)
            {
                return;
            }
            ApiControl ac = Config.GetApIEngine();

            ac.SetupBotsPolicy(IDs, Utils.GetInt(ddSitdownType_Policy.SelectedValue), Utils.GetInt(ddProcesses.SelectedValue), ApiTarget);
        }
        protected void btnSaveBet_Click(object sender, System.EventArgs e)
        {
            string xml = String.Format("<tsbettings tournamentid=\"{0}\" coefficient=\"{1}\">", TournID, txtCoeff.Text);

            foreach (DataRow dr in tbBlind.Rows)
            {
                xml += String.Format("<level num=\"{0}\" blind=\"{1}\" ante=\"{2}\"/>", dr["level"], dr["blind"], dr["ante"]);
            }
            xml += "</tsbettings>";

            ApiControl api = Config.GetApIEngine();

            api.SaveTournamentBettings(xml);
            api = null;
        }
        public string Details(System.Web.UI.Page page, int nGameLogID)
        {
            Common.Web.Page oPage = page as Common.Web.Page;
            Common.Web.Core oDB   = oPage.DBase;
            ApiControl      oApi  = Config.GetApIEngine();

            if (nGameLogID > 0)
            {
                lblName.Text = "Game Log #: " + nGameLogID.ToString();
                string txtHistory = oApi.GetPersonalHandHistory(nGameLogID, ApiMsg.msgForAction.GETPERSONALHANDHISTORYASTEXT);
                hdnLogData.Value = txtHistory;
            }

            oApi = null;
            return("");
        }
Beispiel #15
0
        protected void SendUsersMessage(ArrayList al)
        {
            ApiControl admC = Config.GetApIEngine();
            int        l;
            string     uids = "";
            string     msg  = txtMessage.Text;

            for (l = 0; l < al.Count; l++)
            {
                if (al[l].ToString().Length > 0)
                {
                    uids += al[l].ToString().Trim() + ",";
                }
            }
            admC.SendMessageToUser(uids.TrimEnd(','), msg);
            admC = null;
        }
        protected void  btSystemShut_Click(object sender, System.EventArgs e)
        {
            ApiControl admC = Config.GetApIEngine();

            try
            {
                admC.ChangeClientConnectionsAllowedStatus(4);
                lbStatus.Text      = "Client Connections Allowed Status changed to Shutdown";
                lbStatus.ForeColor = Color.Green;
            }
            catch
            {
                lbStatus.Text      = "Client Connections Allowed Status change error";
                lbStatus.ForeColor = Color.Red;
            }
            finally
            {
                admC = null;
            }
        }
        protected void  btEnableCln_Click(object sender, System.EventArgs e)
        {
            ApiControl admC = Config.GetApIEngine();

            try
            {
                admC.ChangeClientConnectionsAllowedStatus(1);
                lbStatus.Text      = "Client Connections Enabled";
                lbStatus.ForeColor = Color.Green;
            }
            catch
            {
                lbStatus.Text      = "Error during enable Client Connections";
                lbStatus.ForeColor = Color.Red;
            }
            finally
            {
                admC = null;
            }
        }
        /// <summary>
        /// Return table with default tournament properties
        /// </summary>
        private void FillTournamentProperty()
        {
            if (comboEngine.Items.Count <= 0)
            {
                return;
            }
            int        engineID    = Convert.ToInt32(comboEngine.Items[comboEngine.SelectedIndex].Value);
            ApiControl oTournament = Config.GetApIEngine();
            string     xmlString   = oTournament.GetDefaultProperty(engineID,
                                                                    (enType == TrnType.Tornament ?  ApiMsg.enProcessFormTarget.Tournament : ApiMsg.enProcessFormTarget.SitAndGo));

            oTournament = null;
            if (xmlString.Length == 0)            //((xmlString == null) || (xmlString == ""))
            {
                Log.Write(this, "Some error occured. Object does not return error description");
                ShowError("Error occured while getting xml.");
                return;
            }

            oCom.FillTable(xmlString, true, ref table);
        }
        protected virtual void btnDeleteTournament_Click(object sender, EventArgs e)
        {
            string     sIDs   = GetCheckedValues(Config.MainCheckboxName);
            ApiControl oTourn = Config.GetApIEngine();

            string [] ss = sIDs.Split(new char[] { ',' });
            int       k  = 0;

            for (k = 0; k < ss.Length; k++)
            {
                int iid = Utils.GetInt(ss[k]);
                if (iid > 0)
                {
                    oTourn.DropTournament(iid);
                }
            }

            ModifySetOfRecordsFromCombo(sIDs, sDbDeleteQuery);
            BindGrid();

            oTourn = null;
        }
Beispiel #20
0
        protected void btnReInit_click(object sender, EventArgs e)
        {
            //1. Delete records in GameProcessState and GameProcessStats
            string  xmlString = "";
            DataRow oDR       = GetFirstRow(Config.DbReinitGameProcess, "@gameProcessID", nGameProcessID);

            if (oDR != null)
            {
                xmlString = oDR["SettingsXML"].ToString();
            }
            else
            {
                ShowError("DB error occured during reiniting gameProcess");
                oCom.FillTable(xmlString, "gameengine/properties/property", false, ref table);
                return;
            }

            bool       errorNumber = false;
            ApiControl oEngine     = Config.GetApIEngine();
            int        pID         = nGameProcessID;

            nActDispID  = Core.GetSelectedValueInt(comboActDisp);
            nEngineID   = Core.GetSelectedValueInt(comboEngine);
            errorNumber = oEngine.InitGameProcess(nEngineID, (int)ApiMsg.enProcessFormTarget.Process, ref pID, xmlString, nActDispID);
            oEngine     = null;

            if (!errorNumber)
            {
                Log.Write(this, "Init game process error");
                ShowError("Error occured. Game process wasn't reinited.");
                oCom.FillTable(xmlString, "gameengine/properties/property", false, ref table);
                return;
            }

            //3. Everything is Ok
            oCom.FillTable(xmlString, "gameengine/properties/property", false, ref table);
            lblInfo.Text      = "Game process was reinited";
            lblInfo.ForeColor = Color.Green;
        }
Beispiel #21
0
        /// <summary>
        /// ダウンロード
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDownload_Click(object sender, EventArgs e)
        {
            if (txtApiKey.Text == string.Empty)
            {
                MessageBox.Show(this, "APIキーが設定されていません。", Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                return;
            }

            if (string.IsNullOrEmpty(txtFolder.Text) || !Directory.Exists(txtFolder.Text))
            {
                MessageBox.Show(this, "保存先が無効です。", Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                return;
            }

            if (txtUrl.Text == string.Empty)
            {
                MessageBox.Show(this, "URLが設定されていません。", Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                return;
            }



            ApiControl wkApiControl = new ApiControl(new Uri(txtUrl.Text).Host, txtApiKey.Text);

            downloadProgress = new Progress(wkApiControl.TotalPosts);

            wkApiControl.ProgressChanged += new EventHandler(wkApiControl_ProgressChanged);

            wkApiControl.ReadEnd += new EventHandler(wkApiControl_ReadEnd);

            wkApiControl.CreatePostInfoList();

            downloadProgress.SetCancelButton();

            downloadProgress.ShowDialog(this);
        }
Beispiel #22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //1. Create new xml
            string     xmlString = "";
            ApiControl oEngine   = Config.GetApIEngine();

            try
            {
                DateTime actTime;
                try
                {
                    actTime = DateTime.Parse(txtActivatedTime.Text, new CultureInfo("en-US"));
                }
                catch
                {
                    lblInfo.Text = "Incorrect value for Activated Time. Please enter valid date.";
                    return;
                }

                nEngineID = Core.GetSelectedValueInt(comboEngine);

                xmlString = oEngine.GetDefaultProperty(nEngineID, ApiMsg.enProcessFormTarget.Process);

                xmlString = oCom.getFormXml(xmlString, "gameengine/properties/property", Page);
                xmlString = oCom.setAttributeValue(xmlString, "gameengine/properties/property", "Tournament Type", (string)Session["Tournament Type Process"]);
                if (xmlString == null)
                {
                    return;
                }

                //2. Save values in DB
                nCurrencyID    = Core.GetSelectedValueInt(comboCurrency);
                nSubCategoryID = Core.GetSelectedValueInt(comboSubCategory);
                nActDispID     = Core.GetSelectedValueInt(comboActDisp);


                SqlCommand             oCmd    = DBase.GetCommand(Config.DbCreateFirstGameProcess);
                SqlParameterCollection oParams = oCmd.Parameters;

                oParams.Add("@Name", txtName.Text);
                oParams.Add("@GameEngineID", nEngineID);
                oParams.Add("@CurrencyTypeID", nCurrencyID);
                oParams.Add("@SubCategoryID", nSubCategoryID);
                oParams.Add("@SettingsXml", xmlString);
                oParams.Add("@ActionDispatcherID", nActDispID);
                oParams.Add("@ActivatedTime", actTime);
                oParams.Add("@ProtectedCode", txtProtCode.Text);
                oParams.Add("@RewardID", txtReward.Text);
                oParams.Add("@Visible", chVisible.Checked ? 1:0);
                oParams.Add("@CreatorUserID", SqlDbType.Int);
                oParams["@CreatorUserID"].Value = 0;
                oParams.Add("@ProtectedMode", Utils.GetInt(ddProtectedM.SelectedValue));
                oParams.Add("@IsHighlighted", Utils.GetInt(ddHighlightedM.SelectedValue));
                oParams.Add("@IsMassWatchingAllowed", Utils.GetInt(ddMassWatchingAllowed.SelectedValue));

                SqlParameter oParam = new SqlParameter("@GameProcessID", SqlDbType.Int);
                oParam.Direction = ParameterDirection.Output;
                oParams.Add(oParam);
                int Return = DBase.ExecuteReturnInt(oCmd);

                if (Return <= 0)
                {
                    if (Return < 0)
                    {
                        lblInfo.Text = "Such game process name already exists. Please try another one.";
                    }
                    else
                    {
                        lblInfo.Text = "Database error occured";
                    }
                    oCom.FillTable(xmlString, "gameengine/properties/property", true, ref table);
                    return;
                }

                int processID = Utils.GetInt(oParams["@GameProcessID"].Value);

                //3. Call InitGameProcess method of Com
                int pID = processID;
                if (!oEngine.InitGameProcess(nEngineID, (int)ApiMsg.enProcessFormTarget.Process, ref pID, xmlString, nActDispID))
                {
                    Log.Write(this, "Init game process error");
                    ShowError("Error occured. Game process wasn't created.");
                    oCom.FillTable(xmlString, "gameengine/properties/property", true, ref table);
                    return;
                }

                //4. Success message
                nGameProcessID         = processID;
                hdnGameProcessID.Value = nGameProcessID.ToString();
                lblInfo.Text           = "Game process was created";
                lblInfo.ForeColor      = Color.Green;
                oCom.FillTable(xmlString, "gameengine/properties/property", false, ref table);
                ShowControls();
            }
            finally
            { oEngine = null; }
        }
        protected void btnStandUpAll_Click(object sender, EventArgs e)
        {
            ApiControl ac = Config.GetApIEngine();

            ac.StandupAllBots(Utils.GetInt(ddProcesses.SelectedValue), ApiTarget);
        }
        protected void btnStandUpwp_Click(object sender, EventArgs e)
        {
            ApiControl ac = Config.GetApIEngine();

            ac.StandupAllBotsWP(ApiTarget);
        }
        protected void btnSitdownAuto_Click(object sender, EventArgs e)
        {
            ApiControl ac = Config.GetApIEngine();

            ac.BotsSitdownAuto(chAuto.Checked, Utils.GetInt(ddSitdownType_Auto.SelectedValue), Utils.GetInt(ddMaxNumber_Auto.SelectedValue), ApiTarget);
        }