private void oGrid_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int ID = Utils.GetInt(e.Item.Cells[0].Text);

            DBase.Execute(Config.DbDeleteActionDispatcher, "@ID", ID);
            DoBindData();
        }
        public void  btnDeleteBan_Click(object sender, System.EventArgs e)
        {
            string sIDs = GetCheckedValues(Config.MainCheckboxName);

            DBase.Execute(Config.DbDeleteBan, "@IDs", sIDs);
            Data_Bind();
        }
        private void dgPeriod_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            lbStatus.Text = "";
            int mID = Utils.GetInt(e.Item.Cells[0].Text);

            DBase.Execute(Config.DbDeletePlayPeriod, new object[] { "@ID", mID });
            DoDataBind();
        }
 public void  btnAddBan_Click(object sender, System.EventArgs e)
 {
     if (Common.Utils.GetInt(txtUID.Text) == 0 && txtIP.Text == String.Empty && txtHost.Text == String.Empty)
     {
         return;
     }
     DBase.Execute(Config.DbSaveBan, "@UserID", Common.Utils.GetInt(txtUID.Text), "@IP", txtIP.Text, "@Host", txtHost.Text);
     Data_Bind();
 }
 public void btnAddTableName_Click(object sender, System.EventArgs e)
 {
     if (txtName.Text == String.Empty)
     {
         return;
     }
     DBase.Execute(Config.DbSaveExoticName, "@Name", txtName.Text);
     Data_Bind();
 }
        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; }
        }
Пример #7
0
        protected void  btnSetNotBot_Click(object sender, System.EventArgs e)
        {
            string sIDs = GetCheckedValues(Config.MainCheckboxName);

            if (sIDs == String.Empty)
            {
                return;
            }
            DBase.Execute("admSetBot", new object[] { "@IDs", sIDs, "@StatusID", 0 });
            BindGrid();
        }
        /// <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("");
        }
 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;
         }
     }
 }
Пример #10
0
        protected void btnSave_Click(object sender, System.EventArgs e)
        {
            //1. Send answer to customer
            lblInfo.Text = "";
            string msgBody = String.Format("{0}\r\n{1}\r\n\r\n{2}", txtHeader.Text, txtAnswer.Text, RemoveTags(lblFooter.Text));
            int    rez     = CommonUse.CSentMail.Send(DBase, txtEmail.Text, GetAffiliateEmail(), "Re: " + lblSubject.Text,
                                                      msgBody, MailFormat.Text);

            if (rez == 1)
            {
                ShowError("Send Mail error occured");
            }
            else if (rez == 2)
            {
                ShowError("Message was send , but Database error occured");
            }

            if (rez <= 1)
            {
                return;
            }

            //2. Update DB
            int nRes = DBase.Execute(Config.DbSaveSupportDetails, new object[] { "@id", nSupportID, "@Answer", msgBody });

            if (nRes <= 0)
            {
                lblInfo.ForeColor = Color.Red;
                lblInfo.Text     += " Database error occured";
                return;
            }

            //3. Sucess message
            lblInfo.ForeColor = Color.Green;
            lblInfo.Text     += " Message was saved and send";
            StoreBackID(nRes);
            hdnID.Value = nRes.ToString();

            txtAnswer.ReadOnly = true;
            btnSave.Visible    = false;

            btnReturn_Click(null, null);
            //Response.Redirect(GetGoBackUrl());
        }
        protected bool SaveMoney(int pAccountID, decimal pAmount, string pReason)
        {
            if (pAmount == 0)
            {
                lblInfo.Text      = "Amount is not correct";
                lblInfo.ForeColor = Color.Red;
                return(false);
            }

            int nRes = DBase.Execute(Config.DbSaveTransaction, "@Amount", pAmount,
                                     "@AccountID", pAccountID, "@Comment", pReason);

            if (nRes == 0)
            {
                lblInfo.Text      = "Database error occured";
                lblInfo.ForeColor = Color.Red;
                return(false);
            }
            return(true);
        }
        private void dgPeriod_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            lbStatus.Text = "";
            int      mID = Utils.GetInt(e.Item.Cells[0].Text);
            DateTime dtFrom;
            DateTime dtTo;

            hdnDisbledItem.Value = "-1";
            try
            {
                dtFrom = DateTime.Parse(((TextBox)(e.Item.Cells[1].Controls[0])).Text);
            }
            catch
            {
                lbStatus.Text      = "Error Date From Value";
                lbStatus.ForeColor = Color.Red;
                return;
            }
            try
            {
                dtTo = DateTime.Parse(((TextBox)(e.Item.Cells[2].Controls[0])).Text);
            }
            catch
            {
                lbStatus.Text      = "Error Date To Value";
                lbStatus.ForeColor = Color.Red;
                return;
            }

            if (dtFrom >= dtTo)
            {
                lbStatus.Text      = "Error Date Interval";
                lbStatus.ForeColor = Color.Red;
                return;
            }

            DBase.Execute(Config.DbSavePlayPeriod, new object[] { "@ID", mID, "@DateFrom", dtFrom, "@DateTo", dtTo });
            dgPeriod.EditItemIndex = -1;
            DoDataBind();
        }
Пример #13
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);
                }
            }
        }
 protected void AddItemSql(string NewIP)
 {
     DBase.Execute(Config.DbSaveAllowedIP, new object[] { "@ip", NewIP });
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int     fileID          = -1;
            int     originalFileID  = -1;
            string  sKey            = "";
            string  sError          = "";
            string  sErrorVersion   = "";
            int     iContentType    = -1;
            int     iVersion        = -1;
            bool    bRes            = false;
            string  tranName        = "";
            DataRow oRow            = null;
            int     executableCount = 0;

            if (AffID <= 0)
            {
                return;
            }
            oPostedFile = new PostedFile(AffID);
            //Batch upload of version and Content type changes
            //a. Content type and version changes
            tranName = "UpdateGameEngineFile";
            DBase.BeginTransaction(tranName);
            DataTable oDT = DBase.GetDataTableBatch(String.Format(Config.ClientFilesBatchSQL, AffID));

            DataColumn[] PrimaryKeyArrayVersion = new DataColumn[1];
            PrimaryKeyArrayVersion[0] = oDT.Columns["ID"];
            oDT.PrimaryKey            = PrimaryKeyArrayVersion;
            for (int i = 0; i < Request.Form.AllKeys.Length; i++)
            {
                string    sFormKey = Request.Form.AllKeys[i];
                string [] tags     = sFormKey.TrimStart('_').Split('_');

                if (tags.Length < 2)
                {
                    continue;
                }

                //a. content Type
                if (tags[0] == chkComboName.TrimEnd('_'))
                {
                    fileID       = Convert.ToInt32(sFormKey.Substring(chkComboName.Length));
                    iContentType = Convert.ToInt32(Request[sFormKey]);
                    if ((fileID > 0) && (iContentType == ContentTypeExecutable))
                    {
                        executableCount++;
                    }
                    oRow = oDT.Rows.Find(fileID);
                    if ((oRow != null) && (oRow["contentTypeID"] != DBNull.Value) &&
                        (Convert.ToInt32(oRow["contentTypeID"]) != iContentType))
                    {
                        if (executableCount > 1)
                        {
                            sErrorVersion += "You can not have more than one executable file. Content type of file " + oRow["name"] + " remains the same.<br>";
                        }
                        else
                        {
                            oRow["contentTypeID"] = iContentType;
                        }
                    }
                }
                else if (tags[0] == edtName.TrimEnd('_'))                 //b. File Version
                {
                    fileID = Convert.ToInt32(tags[1]);
                    oRow   = oDT.Rows.Find(fileID);
                    if (oRow != null)
                    {
                        if (tags[2] == "version")
                        {
                            iVersion = Utils.GetInt(Request[sFormKey]);
                            if (oRow[tags[2]] != DBNull.Value)
                            {
                                if (Convert.ToInt32(oRow[tags[2]]) > iVersion)
                                {
                                    sErrorVersion += "Version you specified for file: " + oRow["name"] + " is not correct or lower than existing one. File version was not changed.<br>";
                                }
                                else if (Convert.ToInt32(oRow[tags[2]]) < iVersion)
                                {
                                    oRow[tags[2]] = iVersion;
                                }
                            }
                            else
                            {
                                oRow[tags[2]] = iVersion;
                            }
                        }
                        else
                        {
                            oRow[tags[2]] = Utils.GetInt(Request[sFormKey]);
                        }
                    }
                }
            }

            bRes = DBase.Update(oDT);
            if (bRes)
            {
                DBase.CommitTransaction(tranName);
            }
            else
            {
                DBase.RollbackTransaction(tranName);
                lblInfo.Text      = "DataBase error occured during updating table";
                lblInfo.ForeColor = Color.Red;
                return;
            }
            sError += sErrorVersion;


            //file upload
            for (int i = 0; i < Request.Files.Count; i++)
            {
                sKey   = Request.Files.AllKeys[i];
                fileID = -1;
                if ((sKey != null) && (sKey != ""))
                {
                    fileID = Convert.ToInt32(sKey);
                }
                originalFileID = fileID;
                iContentType   = -1;
                if (Request[chkComboName + sKey] != null)
                {
                    iContentType = Convert.ToInt32(Request[chkComboName + sKey]);
                }
                HttpPostedFile postFile = Request.Files[i];
                if ((postFile.FileName != "") && (postFile.FileName != null))
                {
                    string sErrorUpload = oPostedFile.SaveFile(Page, postFile, iContentType, ref fileID);
                    if ((originalFileID <= 0) && (fileID > 0))                 //for new record
                    {
                        //insert record in GameEngineFile table
                        DBase.Execute(Config.DbSaveGameEngineFile, "@gameEngineID", nGameEngineID, "@fileID", fileID);
                    }
                    if (sErrorUpload != "")
                    {
                        sError += sErrorUpload + "<br>";
                    }
                }
            }

            //File Upload result
            if (sError == "")
            {
                lblInfo.Text      = "File upload was successful";
                lblInfo.ForeColor = Color.Green;
            }
            else
            {
                lblInfo.Text      = "There were errors during file upload. Some files could not be uploaded. See details below:<br>" + sError;
                lblInfo.ForeColor = Color.Red;
            }
            BindDataGrid();
        }
 protected void btnAddRow_Click(object sender, System.EventArgs e)
 {
     DBase.Execute(Config.DbSavePlayPeriod, new object[] { "@ID", -1, "@DateFrom", DateTime.Now, "@DateTo", DateTime.Now });
     DoDataBind();
 }
        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.DbDeleteSkin, new object[] { "@IDs", nAffiliateID.ToString() });
                    btnReturn_Click(null, null);
                    return;
                }

                //1. Save/Update affiliate in DB
                int nRes = DBase.ExecuteReturnInt(Config.DbSaveSkinsDetails,
                                                  "@ID", nAffiliateID, "@Name", txtName.Text, "@EmailFrom", txtEmail.Text, "@StatusID", int.Parse(ddStatus.SelectedValue),
                                                  "@SkinsDomain", txtDomain.Text, "@EmailSupport", txtSuppEmail.Text);
                if (nRes <= 0)
                {
                    switch (nRes)
                    {
                    case -1:
                        lblInfo.Text = "Such Skins name already exists";
                        break;

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

                /*
                 *                      //2. Create installation files
                 *                      Admin.CommonUse.Affiliate oAffiliate = new Admin.CommonUse.Affiliate(Page);
                 *                      bool bRes = oAffiliate.CreateAffiliate(nRes);
                 *                      if (!bRes)
                 *                      {
                 *                              lblInfo.Text = "Affiliate install shield error occured";
                 *                              DBase.RollbackTransaction(tranName);
                 *                              return;
                 *                      }
                 */
                // Everything is Ok
                DBase.CommitTransaction(tranName);
                nAffiliateID         = nRes;
                hdnAffiliateID.Value = nRes.ToString();
                StoreBackID(nRes);
                lblInfo.Text      = "Skin 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);
                }
            }
        }