private void vGrid_UpdateCommand(object source, DataGridCommandEventArgs e)
 {
     DBase.ExecuteReturnInt(Config.DBSaveBotChatVariant, "@ID", int.Parse(e.Item.Cells[2].Text),
                            "@postvariant", ((TextBox)e.Item.Cells[3].Controls[0]).Text, "@mapid", MapID);
     vGrid.EditItemIndex = -1;
     GridBindVariant();
 }
Ejemplo n.º 2
0
        protected void btnDecline_Click(object sender, System.EventArgs e)
        {
            ArrayList sIDs = GetCheckedValuesToArray(Config.MainCheckboxName);

            if (sIDs.Count <= 0)
            {
                return;
            }
            DataTable dt = (DataTable)Session["Avatars_DT"];

            dt.Constraints.Clear();
            dt.Constraints.Add("cnst_ID_Avatars", dt.Columns["ID"], true);
            string fPath = Config.GetConfigValue("AvatarUploadPath");

            foreach (string sr in sIDs)
            {
                int     id  = int.Parse(sr);
                int     ret = DBase.ExecuteReturnInt(Config.DbDeleteAvatar, "@id", id);
                DataRow dr  = dt.Rows.Find(id);
                fPath += ("\\" + dr["LoginName"] + "\\" + dr["File"]);
                if (File.Exists(fPath))
                {
                    File.Delete(fPath);
                }
            }
            Bind_Grid();
        }
 protected void btnAddVarinats_Click(object sender, EventArgs e)
 {
     if (MapID < 0)
     {
         return;
     }
     DBase.ExecuteReturnInt(Config.DBSaveBotChatVariant, "@ID", -1, "@mapid", MapID);
     GridBindVariant();
 }
        private void oGrid_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int ID = Utils.GetInt(e.Item.Cells[0].Text);

            ID = DBase.ExecuteReturnInt(Config.DbSaveActionDispatcher, "@ID", ID, "@IP", ((TextBox)e.Item.Cells[1].Controls[0]).Text, "@Port",
                                        Utils.GetInt(((TextBox)e.Item.Cells[2].Controls[0]).Text));
            oGrid.EditItemIndex = -1;
            DoBindData();
        }
Ejemplo n.º 5
0
        protected void btnAccept_Click(object sender, System.EventArgs e)
        {
            string sIDs = GetCheckedValues(Config.MainCheckboxName);

            if (sIDs == String.Empty)
            {
                return;
            }
            DBase.ExecuteReturnInt(Config.DbAcceptAvatar, "@ids", sIDs);
            Bind_Grid();
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            ArrayList lIDs = GetCheckedValuesToArray(Config.MainCheckboxName);

            foreach (string s in lIDs)
            {
                DBase.ExecuteReturnInt(Config.DbSavePushingContentProcesses, "@id", -1, "@PushingContentID", ContentID,
                                       "@ProcessID", Utils.GetInt(s));
            }
            GridBind();
        }
Ejemplo n.º 7
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            int nRes = 0;

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

            //user Data
            oParams.Add("@ID", nUserID);
            oParams.Add("@FirstName", txtFirstName.Text);
            oParams.Add("@LastName", txtLastName.Text);
            oParams.Add("@Email", txtEmail.Text);
            oParams.Add("@Location", txtLocation.Text);
            oParams.Add("@StatusID", Core.GetSelectedValueInt(comboStatus));
            oParams.Add("@SexID", Core.GetSelectedValueInt(comboSex));
            oParams.Add("@LoginName", txtLogin.Text);
            oParams.Add("@Password", txtPassword.Text);
            //Mailing Address data
            oParams.Add("@Address", txtAddress.Text);
            oParams.Add("@City", txtCity.Text);
            oParams.Add("@Zip", txtZip.Text);
            oParams.Add("@Phone", txtPhone.Text);
            oParams.Add("@StateID", Core.GetSelectedValueInt(comboState));
            oParams.Add("@CountryID", Core.GetSelectedValueInt(comboCountry));
            oParams.Add("@ChatAccess", (ChatCheck.Checked ? 1: 0));

            nRes = DBase.ExecuteReturnInt(oCmd);
            if (nRes > 0)
            {
                nUserID         = nRes;
                hdnUserID.Value = nRes.ToString();
                StoreBackID(nRes);
                lblInfo.Text      = "User has been saved";
                lblInfo.ForeColor = Color.Green;

                Response.Redirect(GetGoBackUrl());

                ShowControls();
            }
            else
            {
                switch (nRes)
                {
                case -1:
                    lblInfo.Text = "Such login name already exists";
                    break;

                default:
                    lblInfo.Text = "Database error occured";
                    break;
                }
            }
        }
        private void oGrid_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            DropDownList CustomDDL = ( DropDownList)e.Item.Cells[3].Controls[0];
            int          idx       = Utils.GetInt(CustomDDL.SelectedValue);

            //int ret=
            DBase.ExecuteReturnInt(Config.DBSaveBotChatListMap, "@ID", int.Parse(e.Item.Cells[2].Text),
                                   "@keywords", ((TextBox)e.Item.Cells[4].Controls[0]).Text,
                                   "@actiontypeid", idx);
            oGrid.EditItemIndex = -1;
            GridBind();
        }
Ejemplo n.º 9
0
        protected void btnSaveBet_Click(object sender, System.EventArgs e)
        {
            string xml = String.Format("<tsbettings tournamentid=\"{0}\" coefficient=\"{1}\">", 0, 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>";
            BID  = DBase.ExecuteReturnInt(Config.DbSaveTournamentBettingsXMLTmpl, "@ID", BID, "@Name", txtName.Text, "@Data", xml);
            Response.Redirect(Session["TournamentBettingsMaintenanceUrl"].ToString());
        }
        protected void SavePrize()
        {
            if (cbPrizeValueType.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(cbCurrency.SelectedValue), Utils.GetInt(cbPrizeValueType.SelectedValue));

            hdnTournamentPrizeXML.Value = xml;
            xmlTournamentPrize          = xml;


            //Save values to DB
            int nRes = 0;

            nRes = DBase.ExecuteReturnInt(Config.DbSaveTournamentPrizeDetails, "@ID", nTournamentPrizeID,
                                          "@name", txtName.Text, "@PrizeXml", xmlTournamentPrize,
                                          "@CurrencyTypeID", Utils.GetInt(cbCurrency.SelectedValue),
                                          "@PrizeValueType", Utils.GetInt(cbPrizeValueType.SelectedValue));
            if (nRes > 0)
            {
                nTournamentPrizeID         = nRes;
                hdnTournamentPrizeID.Value = nTournamentPrizeID.ToString();
                StoreBackID(nTournamentPrizeID);
                lblInfo.Text      = "Tournament Prize Table was saved";
                lblInfo.ForeColor = Color.Green;
                lblInfo.Visible   = true;

                Response.Redirect(GetGoBackUrl());
            }
            else
            {
                if (nRes == -1)
                {
                    ShowError("Such tournament prize name already exists");
                }
                else
                {
                    ShowError("Database error occured");
                }
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            int ret = DBase.ExecuteReturnInt(Config.DbSavePushingContentUsers, "@ID", -1,
                                             "@PushingContentID", ContentID, "@UserLoginname", txtLoginName.Text);

            if (ret == -1)
            {
                lbStatus.Text = "User does not exists";
            }
            else if (ret == -2)
            {
                lbStatus.Text = "User already exists in this content";
            }
            GridBind();
        }
        /// <summary>
        /// Process saved file
        /// </summary>
        public string ProcessFile(string filePath, string fileName, int fileSize, string OrigFile)
        {
            int rez = DBase.ExecuteReturnInt("admSaveAvatar", "@File", OrigFile, "@Path",
                                             Config.GetConfigValue("AvatarUploadURL") + hdnLoginName.Value, "@Size", fileSize,
                                             "@UserID", nUserID);

            if (rez <= 0)
            {
                try
                {
                    File.Delete(filePath);
                }
                catch (Exception oEx)
                {
                    Log.Write(this, "Fail to delete file. Error description: " + oEx.Message);
                }
                return("Error uploading file " + OrigFile);
            }
            //rename uploaded file to permanent name
            try
            {
                string cDir        = Config.GetConfigValue("AvatarUploadPath");
                string chPath      = cDir + "\\" + hdnLoginName.Value;
                string filePathNew = chPath + "\\" + OrigFile;
                if (!Directory.Exists(chPath))
                {
                    Directory.CreateDirectory(chPath);
                }
                if (File.Exists(filePathNew))
                {
                    File.Delete(filePathNew);
                }
                File.Move(filePath, filePathNew);
            }
            catch (Exception oEx)
            {
                try
                {
                    DBase.Execute("admDeleteAvatar", "@ID", rez);
                    File.Delete(filePath);
                }
                catch {}
                Log.Write(this, "Fail to move file. Error description: " + oEx.Message);
                return("Error occured during moving file " + fileName + ". ");
            }

            return("");
        }
        protected void btnTransfer_click(object sender, System.EventArgs e)
        {
            int nTrgAccountID = 0;

            if (Utils.GetDecimal(hdnBalance.Value) < Utils.GetDecimal(txtAmountTr.Text))
            {
                return;
            }
            if (Utils.GetDecimal(txtAmountTr.Text) == 0)
            {
                return;
            }
            int UserID = DBase.ExecuteReturnInt(Config.DbGetUserID, new object[] { "@LoginName", txtUser.Text });

            if (UserID <= 0)
            {
                lblInfo.Text = "Invalid Login name";
                return;
            }
            DataRow oDR = GetFirstRow(Config.DbGetUserDetailsAccount, new object[] { "@UserID", UserID, "@CurrencyID", nCurrencyID });

            if (oDR != null)
            {
                nTrgAccountID = Utils.GetInt(oDR["AccountID"]);
            }
            else
            {
                return;
            }

            DBase.BeginTransaction("TransferAmmount");
            if (!SaveMoney(nAccountID, (0 - Utils.GetDecimal(txtAmountTr.Text)), txtReasonTr.Text))
            {
                DBase.RollbackTransaction();
                return;
            }
            if (!SaveMoney(nTrgAccountID, Utils.GetDecimal(txtAmountTr.Text), txtReasonTr.Text))
            {
                DBase.RollbackTransaction();
                return;
            }

            DBase.CommitTransaction();

            lblInfo.Text      = "User balance was changed";
            lblInfo.ForeColor = Color.Green;
            GetData();
        }
 private void dgPeriod_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     if (e.CommandName == "Report")
     {
         try
         {
             lbStatus.Text = "";
             DateTime dtb = DateTime.Parse(e.Item.Cells[1].Text);
             DateTime dte = DateTime.Parse(e.Item.Cells[2].Text);
             CreateReport(dtb, dte, Reports.cpReportType.PlayPeriod, chAsResendTB.Checked);
         }
         catch
         {
             lbStatus.Text      = "Error Parameters";
             lbStatus.ForeColor = Color.Red;
         }
     }
     else if (e.CommandName == "Reset")
     {
         try
         {
             lbStatus.Text = "";
             int PerID = Utils.GetInt(e.Item.Cells[0].Text);
             if (PerID <= 0)
             {
                 return;
             }
             if (DBase.ExecuteReturnInt(Config.DbClosePeriod, new object[] { "@PeriodID", PerID }) != 0)
             {
                 lbStatus.Text      = "Error Execute";
                 lbStatus.ForeColor = Color.Red;
             }
             else
             {
                 DBase.Execute("accUpdatePlayMoneyBalances");
                 lbStatus.Text      = "Period Closed";
                 lbStatus.ForeColor = Color.Green;
                 DoDataBind();
             }
         }
         catch
         {
             lbStatus.Text      = "Error Execute";
             lbStatus.ForeColor = Color.Red;
         }
     }
 }
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            int nRes = DBase.ExecuteReturnInt(Config.DbSaveEmailTemplate, "@ID", nTemplateID,
                                              "@Subject", txtSubject.Text, "@Body", Server.HtmlDecode(txtBody.Value),
                                              "@TemplateBody", templateLetterBody, "@TemplatePath", templateImageUrl,
                                              "@TemplatePathValue", Config.FileEmailTemplateUrl);

            if (nRes > 0)
            {
                Redirect(GetGoBackUrl());
            }
            else
            {
                lblError.Text      = "Database error occured";
                lblError.ForeColor = Color.Red;
            }
        }
        public void btnAddUser_Click(object sender, EventArgs e)
        {
            int ret = DBase.ExecuteReturnInt(Config.DbAddInvitedUser, "@processid", mProcessID, "@loginname", txtUserName.Text,
                                             "@ISTournament", mIsTournament);

            if (ret == -2)
            {
                lbMessage.Text = "User does not exists";
                return;
            }
            if (ret == -1)
            {
                lbMessage.Text = "User already exists";
                return;
            }
            BindGrid();
        }
        private void oGrid_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            CultureInfo ci = new CultureInfo("en-US");

            DateTime dt;

            try
            {
                dt = DateTime.Parse(((TextBox)e.Item.Cells[4].Controls[0]).Text, ci);
            }
            catch { return; }
            int ret = DBase.ExecuteReturnInt(Config.DbSavePushingContentList, "@ID", int.Parse(e.Item.Cells[2].Text),
                                             "@Name", ((TextBox)e.Item.Cells[3].Controls[0]).Text,
                                             "@ActivateDate", dt);

            oGrid.EditItemIndex = -1;
            GridBind();
        }
Ejemplo n.º 18
0
        private void oGrid_UpdateCommand(object source, DataGridCommandEventArgs e)
        {
            DateTime dt;
            decimal  dc;

            try
            {
                dt = DateTime.Parse(((TextBox)e.Item.Cells[3].Controls[0]).Text, new CultureInfo("en-US"));
            }
            catch { return; }
            try
            {
                dc = Decimal.Parse(((TextBox)e.Item.Cells[6].Controls[0]).Text, new CultureInfo("en-US"));
            }
            catch { return; }

            DBase.ExecuteReturnInt(Config.DbSaveForcedExits, "@ID", int.Parse(e.Item.Cells[2].Text),
                                   "@DateExit", dt,
                                   "@Message", ((TextBox)e.Item.Cells[4].Controls[0]).Text,
                                   "@AmountReset", dc,
                                   "@WarningTimes", ((TextBox)e.Item.Cells[5].Controls[0]).Text);
            oGrid.EditItemIndex = -1;
            GridBind();
        }
        private int GetTournamentNextId()
        {
            int mxInt = DBase.ExecuteReturnInt(Config.DbGetTournamentMaxID, null);

            return(mxInt + 1);
        }
Ejemplo n.º 20
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string tranName = "SaveAffiliate";

            DBase.BeginTransaction(tranName);
            bool rez = false;

            lblInfo.Text      = "";
            lblInfo.ForeColor = Color.Red;

            try
            {
                if (chDeny.Checked)
                {
                    DBase.Execute(Config.DbDeleteAffiliate, new object[] { "@IDs", nAffiliateID.ToString() });
                    btnReturn_Click(null, null);
                    return;
                }

                //1. Save/Update affiliate in DB
                int nRes = DBase.ExecuteReturnInt(Config.DbSaveAffiliateDetails,
                                                  "@ID", nAffiliateID, "@Name", txtName.Text, "@EmailFrom", txtEmail.Text, "@StatusID", int.Parse(ddStatus.SelectedValue),
                                                  "@SkinsID", int.Parse(ddSkins.SelectedValue), "@Password", txtPassword.Text, "@BeneficiaryName", txtBeneficiaryName.Text, "@MailingAddress",
                                                  txtAddress.Text, "@City", txtCity.Text, "@StateID", int.Parse(ddState.SelectedValue), "@Zip", txtZip.Text,
                                                  "@CountryID", int.Parse(ddCountry.SelectedValue), "@FirstName", txtFirstName.Text,
                                                  "@LastName", txtLastName.Text, "@Title", txtTitle.Text, "@Phone", txtPhone.Text, "@Fax", txtFax.Text);
                if (nRes <= 0)
                {
                    switch (nRes)
                    {
                    case -1:
                        lblInfo.Text = "Such Affiliate name already exists";
                        break;

                    default:
                        lblInfo.Text = "Database error occured";
                        break;
                    }
                    DBase.RollbackTransaction(tranName);
                    return;
                }
                // Everything is Ok
                DBase.CommitTransaction(tranName);
                nAffiliateID         = nRes;
                hdnAffiliateID.Value = nRes.ToString();
                StoreBackID(nRes);
                lblInfo.Text      = "Affiliate has been saved";
                lblInfo.ForeColor = Color.Green;

                if (hdnState.Value != ddStatus.SelectedValue && ddStatus.SelectedValue == "4")
                {
                    string val = Config.GetDbConfigValue(DBase, 18);                   //Template name for affiliates
                    if (val == String.Empty)
                    {
                        rez = true;
                        return;
                    }
                    DataTable tb = DBase.GetDataTable(Config.DbGetEmailTemplateDetailsByName, "@Name", val);
                    if (tb == null)
                    {
                        rez = true;
                        return;
                    }
                    if (tb.Rows.Count <= 0)
                    {
                        rez = true;
                        return;
                    }
                    val = Config.GetDbConfigValue(DBase, 1);                  // Admin Email
                    if (val == String.Empty)
                    {
                        rez = true;
                        return;
                    }
                    CommonUse.CSentMail.Send(DBase, txtEmail.Text, val, tb.Rows[0]["subject"].ToString(),                    //Send message as autoresponder
                                             tb.Rows[0]["body"].ToString().Replace("<BR>", "\n").Replace("<br>", "\n").Replace("&nbsp;", " "), 3, MailFormat.Text);
                }
            }
            catch (Exception ex)
            {
                Common.Log.Write(this, ex);
                DBase.RollbackTransaction(tranName);
                lblInfo.Text      = "Error occured";
                lblInfo.ForeColor = Color.Red;
            }
            finally
            {
                if (rez)
                {
                    lblInfo.Text     += "  Error send Email";
                    lblInfo.ForeColor = Color.Red;
                }
                if (lblInfo.ForeColor != Color.Red)
                {
                    btnReturn_Click(null, null);
                }
            }
        }
Ejemplo n.º 21
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 btnSave_Click(object sender, System.EventArgs e)
        {
            int    nRes     = nSubCategoryID;
            string tranName = "SaveSubcategory";

            DBase.BeginTransaction(tranName);

            //1. Save subcategory info
            if (nSubCategoryID <= 0)
            {
                nRes = DBase.ExecuteReturnInt(Config.DbSaveSBSubCategory,
                                              new object[] { "@id", nSubCategoryID,
                                                             "@CategoryID", Core.GetSelectedValueInt(comboCategory),
                                                             "@name", txtName.Text,
                                                             "@SpreadFrom", txtSpreadFrom.Text,
                                                             "@SpreadTo", txtSpreadTo.Text,
                                                             "@SpreadStep", txtSpreadStep.Text,
                                                             "@OuFrom", txtOuFrom.Text,
                                                             "@OuTo", txtOuTo.Text,
                                                             "@OuStep", txtOuStep.Text });

                if (nRes <= 0)
                {
                    lblInfo.ForeColor = Color.Red;
                    switch (nRes)
                    {
                    case -1:
                        lblInfo.Text = "Typed subcategory name already exists";
                        break;

                    case 0:
                        lblInfo.Text = "Database error occured";
                        break;

                    default:
                        lblInfo.Text = "Unknown error occured";
                        break;
                    }
                    DBase.RollbackTransaction(tranName);
                    return;
                }
            }

            //2. Update Team info
            int nRes2 = DBase.ExecuteNonQuery(Config.DbSaveTeamTable, "@SubcategoryID", nRes,
                                              "@TeamValues", hdnTeamCSV.Value);

            if (nRes2 < 0)
            {
                DBase.RollbackTransaction(tranName);
                lblInfo.Text      = "DB erors occured during processing Team Table";
                lblInfo.ForeColor = Color.Red;
                return;
            }

            DBase.CommitTransaction(tranName);
            lblInfo.ForeColor = Color.Green;
            lblInfo.Text      = "SubCategory details have been saved";
            StoreBackID(nRes);
            hdnID.Value = nRes.ToString();
            //BindTeam();

            Response.Redirect(GetGoBackUrl());
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Save event handler.
        /// </summary>
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            //1. Get XML
            sXML = hdnXML.Value;
            oPrize.FillTable(ref sXML, ref table, true, false);              //fill table from xml

            //2. Save category in DB
            string tranNameTotal = "admSaveSBCategoryDetails";

            DBase.BeginTransaction(tranNameTotal);
            int nRes = DBase.ExecuteReturnInt(Config.DbSaveSBCategoryDetails, new object[] { "@id", nCategoryID, "@Name", txtName.Text });

            if (nRes <= 0)
            {
                DBase.RollbackTransaction(tranNameTotal);
                lblInfo.ForeColor = Color.Red;
                switch (nRes)
                {
                case -1:
                    lblInfo.Text = "Typed category name already exists";
                    break;

                case 0:
                    lblInfo.Text = "Database error occured";
                    break;

                default:
                    lblInfo.Text = "Unknown error occured";
                    break;
                }
                return;
            }


            //3. Batch upload of Teaser Table
            try
            {
                DataTable    xmlDT           = oPrize.getDataTable(sXML);    //DataTable from xml
                DataColumn[] PrimaryKeyArray = new DataColumn[3];
                PrimaryKeyArray[0] = xmlDT.Columns[PrizeTable.tblColName];
                PrimaryKeyArray[1] = xmlDT.Columns[PrizeTable.tblRowName];
                PrimaryKeyArray[2] = xmlDT.Columns[PrizeTable.tblValueName];
                xmlDT.PrimaryKey   = PrimaryKeyArray;
                //using primary key we can update only recods that were changed
                DataTable oDT = DBase.GetDataTableBatch("select id, Points, BetCount, Rate, CategoryID from Teaser where categoryID = " + nRes.ToString() + " order by Points, BetCount");                  //dataTable from SQL
                //clear all old data
                foreach (DataRow oDR in oDT.Rows)
                {
                    DataRow oRow = xmlDT.Rows.Find(new object[3] {
                        oDR["Points"].ToString(), oDR["BetCount"].ToString(), oDR["Rate"].ToString()
                    });
                    if (oRow != null)
                    {
                        oRow.Delete();
                    }
                    else
                    {
                        oDR.Delete();
                    }
                }
                //do we have any records to add
                bool hasRecords = true;
                if (xmlDT.Rows.Count < 1)
                {
                    hasRecords = false;
                }
                if ((xmlDT.Rows.Count == 1) && (xmlDT.Rows[0][PrizeTable.tblValueName].ToString() == ""))
                {
                    hasRecords = false;                                                                                                    //one record, but value is empty
                }
                if (hasRecords)
                {
                    //add new data
                    foreach (DataRow oDR in xmlDT.Rows)
                    {
                        DataRow row = oDT.NewRow();
                        row["Points"]     = oDR[PrizeTable.tblColName];
                        row["BetCount"]   = oDR[PrizeTable.tblRowName];
                        row["Rate"]       = Utils.GetDecimal(oDR[PrizeTable.tblValueName]);
                        row["CategoryID"] = nRes;
                        oDT.Rows.Add(row);
                    }
                }
                bool bRes = DBase.Update(oDT);
                if (!bRes)
                {
                    DBase.RollbackTransaction(tranNameTotal);
                    ShowError("DB error occured during Teaser data update.");
                    return;
                }
            }
            catch (Exception oEx)
            {
                DBase.RollbackTransaction(tranNameTotal);
                ShowError("DB error occured during Teaser data update block.");
                Log.Write(this, oEx);
                return;
            }
            //End of Batch upload of Teaser Table

            //4. Sucess message
            DBase.CommitTransaction(tranNameTotal);
            nCategoryID = nRes;
            StoreBackID(nRes);
            hdnID.Value       = nRes.ToString();
            lblInfo.ForeColor = Color.Green;
            lblInfo.Text      = "Category details have been saved";

            Response.Redirect(GetGoBackUrl());
        }
Ejemplo n.º 24
0
        private bool SaveData(int stateID)
        {
            string tranName = "SaveEvent";

            DBase.BeginTransaction(tranName);
            //1. Save/Update Event
            object StartDate = Utils.GetDbDate(Request["comboDate"] + " " + Request["comboTime"] + ":00");
            int    nRes      = DBase.ExecuteReturnInt(Config.DbSaveEvent,
                                                      "@EventID", nEventID,
                                                      "@StateID", stateID,
                                                      "@StartSchedule", sGuid,
                                                      "@SubCategoryID", Request["comboSubCategory"],
                                                      "@AwayTeamID", Request["comboAway"],
                                                      "@HomeTeamID", Request["comboHome"],
                                                      "@StartDate", StartDate);

            if (nRes <= 0)
            {
                ShowError("Database error occured");
                DBase.RollbackTransaction(tranName);
                return(false);
            }

            //2. Update Outcomes
            decimal   Rate   = 0;
            decimal   Point  = 0;
            bool      isSave = false;
            string    sPoint = "";
            DataTable oDT    = DBase.GetDataTableBatch(string.Format(Config.DbUpdateOutcome, nRes));

            DataColumn[] PrimaryKeyArray = new DataColumn[4];
            PrimaryKeyArray[0] = oDT.Columns["EventID"];
            PrimaryKeyArray[1] = oDT.Columns["BetTypeID"];
            PrimaryKeyArray[2] = oDT.Columns["isHome"];
            PrimaryKeyArray[3] = oDT.Columns["PeriodID"];
            oDT.PrimaryKey     = PrimaryKeyArray;

            //Home Spread
            Rate   = Utils.GetDecimal(txtHomeSpread.Text);
            sPoint = Request["comboHomeSpread"];
            Point  = Utils.GetDecimal(sPoint);
            isSave = isNumber(sPoint);
            UpdateRow(oDT, nRes, typeSpread, againstHome, periodFull, Rate, Point, isSave);
            UpdateRow(oDT, nRes, typeSpread, againstAway, periodFull, -Rate, -Point, isSave);
            Rate   = Utils.GetDecimal(txtHomeSpreadHalf.Text);
            sPoint = Request["comboHomeSpreadHalf"];
            Point  = Utils.GetDecimal(sPoint);
            isSave = isNumber(sPoint);
            UpdateRow(oDT, nRes, typeSpread, againstHome, periodHalf, Rate, Point, isSave);
            UpdateRow(oDT, nRes, typeSpread, againstAway, periodHalf, -Rate, -Point, isSave);
            //Over Under
            Rate   = Utils.GetDecimal(txtTotalOU.Text);
            sPoint = Request["comboTotalOU"];
            Point  = Utils.GetDecimal(sPoint);
            isSave = isNumber(sPoint);
            UpdateRow(oDT, nRes, typeOu, againstHome, periodFull, Rate, Point, isSave);
            UpdateRow(oDT, nRes, typeOu, againstAway, periodFull, -Rate, -Point, isSave);
            Rate   = Utils.GetDecimal(txtTotalOUHalf.Text);
            sPoint = Request["comboTotalOUHalf"];
            Point  = Utils.GetDecimal(sPoint);
            isSave = isNumber(sPoint);
            UpdateRow(oDT, nRes, typeOu, againstHome, periodHalf, Rate, Point, isSave);
            UpdateRow(oDT, nRes, typeOu, againstAway, periodHalf, -Rate, -Point, isSave);
            //ML
            Rate   = Utils.GetDecimal(txtHomeTeam.Text);
            sPoint = Request["comboHomeTeam"];
            Point  = Utils.GetDecimal(sPoint);
            isSave = isNumber(sPoint);
            UpdateRow(oDT, nRes, typeML, againstHome, periodFull, Rate, Point, isSave);
            UpdateRow(oDT, nRes, typeML, againstAway, periodFull, -Rate, -Point, isSave);

            bool bRes = DBase.Update(oDT);

            if (!bRes)
            {
                ShowError("DataBase error occured during saving Outcomes");
                DBase.RollbackTransaction(tranName);
                return(false);
            }


            // Everything is Ok
            DBase.CommitTransaction(tranName);
            nEventID = nRes;
            StoreBackID(nRes);
            hdnEventID.Value = nRes.ToString();
            return(true);
        }
 protected override void btnAdd_Click(object sender, EventArgs e)
 {
     //int ret=
     DBase.ExecuteReturnInt(Config.DBSaveBotChatListMap, "@ID", -1);
     GridBind();
 }
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            string tranName = "UpdateSubCategoryStats";

            DBase.BeginTransaction(tranName);

            //1. Save/update Subcategory details
            SqlCommand             oCmd    = DBase.GetCommand(Config.DbSaveSubCategoryDetails);
            SqlParameterCollection oParams = oCmd.Parameters;

            oParams.Add("@ID", nSubCategoryID);
            oParams.Add("@Name", txtName.Text);
            oParams.Add("@StatusID", Core.GetSelectedValueInt(comboStatus));
            oParams.Add("@CategoryID", Core.GetSelectedValueInt(comboCategory));

            int nRes = DBase.ExecuteReturnInt(oCmd);

            if (nRes <= 0)
            {
                lblInfo.ForeColor = Color.Red;
                switch (nRes)
                {
                case -1:
                    lblInfo.Text = "Typed category name already exists";
                    break;

                default:
                    lblInfo.Text = "Database error occured";
                    break;
                }
                DBase.RollbackTransaction(tranName);
                return;
            }


            //2. update SubCategoryStats table
            DataTable oDT = DBase.GetDataTableBatch(string.Format(Config.DbUpdateSubCategoryStats, nRes));

            DataColumn[] PrimaryKeyArray = new DataColumn[2];
            PrimaryKeyArray[0] = oDT.Columns["SubCategoryID"];
            PrimaryKeyArray[1] = oDT.Columns["StatsTypeID"];
            oDT.PrimaryKey     = PrimaryKeyArray;

            try
            {
                //a. Delete rows that are not any more in the list
                string[] statsList = hdnStatsList.Value.Split(',');
                int      statsLen  = statsList.Length;
                if (hdnStatsList.Value == "")
                {
                    statsLen = 0;
                }
                int k = 0;
                while (k < oDT.Rows.Count)
                {
                    DataRow oRow  = oDT.Rows[k];
                    bool    bFind = false;
                    for (int i = 0; i < statsLen; i++)
                    {
                        if (oRow["StatsTypeID"].ToString() == statsList[i])
                        {
                            bFind = true;
                        }
                    }
                    if (!bFind)
                    {
                        oRow.Delete();
                    }
                    k++;
                }

                //b. Add/update order for the list
                for (int i = 0; i < statsLen; i++)
                {
                    DataRow oRow = oDT.Rows.Find(new object[] { nRes, statsList[i] });
                    if (oRow == null)
                    {
                        oDT.Rows.Add(new object[] { nSubCategoryID, statsList[i], i + 1 });
                    }
                    else
                    {
                        if (Convert.ToInt32(oRow["Order"]) != i + 1)
                        {
                            oRow["Order"] = i + 1;
                        }
                    }
                }
            }
            catch (Exception oEx)
            {
                Log.Write(this, "DataTable operations Error: " + oEx.Message);
                DBase.RollbackTransaction(tranName);
                lblInfo.Text      = "DataBase error occured during updating table";
                lblInfo.ForeColor = Color.Red;
                return;
            }

            bool bRes = DBase.Update(oDT);

            if (bRes)
            {
                DBase.CommitTransaction(tranName);
                hdnSubCategoryID.Value = nRes.ToString();
                StoreBackID(nRes);
                lblInfo.Text      = "Category details have been saved";
                lblInfo.ForeColor = Color.Green;

                Response.Redirect(GetGoBackUrl());

                nSubCategoryID = nRes;
                BindStatsList();
                rowRelatedProcesses.Visible = true;
                BindRelatedProcessList();
            }
            else
            {
                DBase.RollbackTransaction(tranName);
                lblInfo.Text      = "DataBase error occured during updating table";
                lblInfo.ForeColor = Color.Red;
            }
        }
        protected void btnCreateReport_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (ddReport.Value == "0")
                {
                    Reports_PreRender(null, null);
                    return;
                }
                ItemSelected();
                Session["RepDs_" + ddReport.Value]         = null;
                Session["CrystalRepPrm_" + ddReport.Value] = null;

                int ret = OnLineReport(Utils.GetInt(ddReport.Value));
                if (ret >= 0)
                {
                    return;
                }

                ArrayList ar = new ArrayList();
                ar.Add(new String[] { "valueaslist", chValueAsList.Checked.ToString() });
                if (txdtFrom.Disabled == false)
                {
                    ar.Add(new String[] { "db", txdtFrom.Value.Trim() });
                    ar.Add(new String[] { "de", txdtTo.Value.Trim() });
                }
                if (chMoney.Disabled == false)
                {
                    ar.Add(new String[] { "chm", chMoney.Checked.ToString() });
                    ar.Add(new String[] { "chn_m", chPlayMoney.Checked.ToString() });
                }
                if (txPID.Disabled == false)
                {
                    if (chValueAsList.Checked == false)
                    {
                        int uID = Utils.GetInt(txPID.Value);
                        if (uID == 0 && txLoginName.Value != String.Empty)
                        {
                            uID = DBase.ExecuteReturnInt("wntGetUserID", new object[] { "@LoginName", txLoginName.Value });
                        }
                        ar.Add(new String[] { "uid", uID.ToString() });
                    }
                    else
                    {
                        ar.Add(new String[] { "uid", txPID.Value });
                        ar.Add(new String[] { "loginname", CheckStringPrm(txLoginName.Value) });
                    }
                }
                if (txtMACAddress.Disabled == false)
                {
                    ar.Add(new String[] { "macaddress", CheckStringPrm(txtMACAddress.Value) });
                }
                ar.Add(new String[] { "nobots", (chnoBots.Checked?"1":"0") });

                Session["CrystalRepPrm_" + ddReport.Value] = ar;

                String scriptString = "<script language=JavaScript>";
                scriptString += " window.open('" + Config.SiteBaseUrl + "Reports/ViewForm.aspx?RepID=" + ddReport.Value + "');ItemSelected();</script>";

                if (!this.IsStartupScriptRegistered("clientScript"))
                {
                    this.RegisterStartupScript("clientScript", scriptString);
                }
            }
            catch (Exception ex)
            {
                Log.Write(this, ex);
            }
        }
        private int OnLineReport(int mID)
        {
            int      ret   = -1;
            DateTime m_dtb = DateTime.Now;
            DateTime m_dte = DateTime.Now;
            DataSet  ds;

            lbResult.Text = "";
            int    uID    = 0;
            string dtPref = "From " + txdtFrom.Value + " to " + txdtTo.Value;

            try
            {
                if (txdtFrom.Disabled == false)
                {
                    m_dtb = DateTime.Parse(txdtFrom.Value.Trim());
                    m_dte = DateTime.Parse(txdtTo.Value.Trim());
                }
                if (txPID.Disabled == false)
                {
                    uID = Utils.GetInt(txPID.Value);
                    if (uID == 0 && txLoginName.Value != String.Empty)
                    {
                        uID = DBase.ExecuteReturnInt("wntGetUserID", new object[] { "@LoginName", txLoginName.Value });
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Write(this, ex);
                return(1);
            }

            ReportDoc rdc = new ReportDoc(Config.DbConnectionString, 600, DBase);

            switch (mID)
            {
            case 3:
                int Intr = Utils.GetInt(txDiscretCount.Value);
                if (Intr <= 0)
                {
                    return(2);
                }
                int iType = Utils.GetInt(slIntrType.Value);
                ds = rdc.CreateReportSource("wntConcurrentPlayers", "ConcurrentPlayers", new object[] { "@dtBegin", m_dtb, "@dtEnd", m_dte,
                                                                                                        "@Interval", Intr, "@IntervalType", iType, "@NoBots", chnoBots.Checked?1:0 });
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lbResult.Text = dtPref + "<br>Maximum concurrent players: " +
                                    ds.Tables[0].Rows[0]["Maximum"].ToString() + "<br>Minimum concurrent players: " + ds.Tables[0].Rows[0]["Minimum"].ToString();
                }
                else
                {
                    lbResult.Text = dtPref + " No data";
                }
                ret = 0;
                break;

            case 5:
                ds = rdc.CreateReportSource("wntBiggestHand", "BiggestHand", new object[] { "@dtBegin", m_dtb, "@dtEnd", m_dte, "@NoBots", chnoBots.Checked?1:0 });
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lbResult.Text = dtPref + "<br>Biggest Chip Hand ID: " +
                                    ds.Tables[0].Rows[0]["HandID"].ToString() + "<br>Amount: " + ds.Tables[0].Rows[0]["Amount"].ToString();
                }
                else
                {
                    lbResult.Text = dtPref + " Biggest Chip Hand ID: 0  , Amount: 0";
                }
                ret = 0;
                break;

            case 6:
                ds = rdc.CreateReportSource("wntUsersSignupAndPlay", "UsersSignupAndPlay", new object[] { "@dtBegin", m_dtb, "@dtEnd", m_dte, "@NoBots", chnoBots.Checked?1:0 });
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lbResult.Text = dtPref + "<br>Players registered: " +
                                    ds.Tables[0].Rows[0]["Registered"].ToString() + "<br>Played a game: " + ds.Tables[0].Rows[0]["Played"].ToString();
                }
                else
                {
                    lbResult.Text = dtPref + " Registered: 0  , Played a game: 0";
                }
                ret = 0;
                break;

            case 8:
                ds = rdc.CreateReportSource("wntTimeSpendByUser", "TimeSpendByUser",
                                            new object[] { "@dtBegin", m_dtb, "@dtEnd", m_dte, "@UserID", uID, "@NoBots", chnoBots.Checked?1:0 });
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lbResult.Text = dtPref + "<br>Average Time Spent on the System is " + ds.Tables[0].Rows[0]["SpentTime"].ToString() + " minutes per user ";
                }
                else
                {
                    lbResult.Text = dtPref + "<br>Average Time Spent on the System is 0";
                }
                ret = 0;
                break;
            }

            return(ret);
        }
Ejemplo n.º 29
0
        /*	public string GetBannerURL()
         *      {
         *              return Config.GetConfigValue("SkinsBannerURL")+"/Skin_"+ nSkinID.ToString()+"/Banner/"+Config.GetConfigValue("ImageBannerName");
         *      }*/

        private void btnSignUp_Click(object sender, System.EventArgs e)
        {
            int nSkinID = 0;

            nSkinID = Common.Utils.GetInt(ddSkins.SelectedValue);
            if (nSkinID <= 0)
            {
                return;
            }

            if (!chAgree.Checked)
            {
                lblInfo.Text = "You must agree to the Affiliate Agreement";
                return;
            }

            if (txtPassword.Text != txtPasswordRet.Text)
            {
                lblInfo.Text = "Re-Typed password not equal to Password";
                return;
            }

            string tranName = "SaveAffiliate";

            try
            {
                DBase.BeginTransaction(tranName);

                //1. Save/Update affiliate in DB
                int nRes = DBase.ExecuteReturnInt(Config.DbSaveAffiliateDetails,
                                                  "@ID", -1, "@Name", txtName.Text, "@EmailFrom", txtEmail.Text, "@StatusID", 5, "@SkinsID", nSkinID
                                                  , "@Password", txtPassword.Text, "@BeneficiaryName", txtBeneficiaryName.Text, "@MailingAddress",
                                                  txtAddress.Text, "@City", txtCity.Text, "@StateID", int.Parse(ddState.SelectedValue), "@Zip", txtZip.Text,
                                                  "@CountryID", int.Parse(ddCountry.SelectedValue), "@FirstName", txtFirstName.Text,
                                                  "@LastName", txtLastName.Text, "@Title", txtTitle.Text, "@Phone", txtPhone.Text, "@Fax", txtFax.Text);
                if (nRes <= 0)
                {
                    switch (nRes)
                    {
                    case -1:
                        lblInfo.Text = "Such Affiliate Login already exists";
                        break;

                    default:
                        lblInfo.Text = "Database error occured";
                        break;
                    }
                    DBase.RollbackTransaction(tranName);
                    return;
                }
                // Everything is Ok
                DBase.CommitTransaction(tranName);
                lblInfo.Text      = "Affiliate has been saved";
                lblInfo.ForeColor = Color.Green;
                Response.Redirect("Signupcomplete.aspx?SkinsID=" + nSkinID.ToString());
            }
            catch (Exception ex)
            {
                Log.Write(this, ex);
                DBase.RollbackTransaction(tranName);
                lblInfo.Text = "Error occured during save data";
            }
        }
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     //int ret=
     DBase.ExecuteReturnInt(Config.DbSavePushingContentList, "@ID", -1);
     GridBind();
 }