Example #1
0
 private void dgTokenDetail_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == 9)
     {
         if (Convert.ToInt32(dgTokenDetail.Rows[e.RowIndex].Cells["tId"].Value) <= 0)
         {
             return;
         }
         frmTokenInformation frm = new frmTokenInformation();
         //  frm.MdiParent = this.MdiParent;
         StaticClass.DealerTokenId = Convert.ToInt32(dgTokenDetail.Rows[e.RowIndex].Cells["tId"].Value);
         // StaticClass.LocationX = 0;
         //  StaticClass.LocationY = 92;
         //  frm.Dock = DockStyle.Fill;
         frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
         frm.StartPosition   = FormStartPosition.CenterScreen;
         frm.MaximizeBox     = false;
         frm.ShowDialog();
         GetDealerUserLedger();
     }
 }
 private void dgAdvtDetail_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == 9)
     {
         frmTokenInformation frm = new frmTokenInformation();
         StaticClass.DealerTokenId    = 0;
         StaticClass.dealerUserId     = Convert.ToInt32(dgAdvtDetail.Rows[e.RowIndex].Cells["userid"].Value);
         StaticClass.DealerDfClientId = Convert.ToInt32(cmbClientName.SelectedValue);
         StaticClass.DealerTokenId    = Convert.ToInt32(dgAdvtDetail.Rows[e.RowIndex].Cells["tId"].Value);
         frm.FormBorderStyle          = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
         frm.StartPosition            = FormStartPosition.CenterScreen;
         frm.MaximizeBox = false;
         frm.ShowDialog();
         string str = "";
         if (cmbPlayerVersion.Text == "")
         {
             str = "GetLicenseExpiryToken " + Convert.ToInt32(cmbClientName.SelectedValue) + " , 'Normal'  , '" + gblClass.MusicType + "' ";
         }
         else
         {
             str = "GetLicenseExpiryToken " + Convert.ToInt32(cmbClientName.SelectedValue) + " , '" + cmbPlayerVersion.Text + "'  , '" + gblClass.MusicType + "' ";
         }
         FillAdvertisementData(str);
     }
 }
Example #3
0
 private void dgToken_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == 10)
     {
         frmTokenInformation frm = new frmTokenInformation();
         StaticClass.DealerTokenId    = 0;
         StaticClass.dealerUserId     = Convert.ToInt32(dgToken.Rows[e.RowIndex].Cells["uId"].Value);
         StaticClass.DealerDfClientId = Convert.ToInt32(cmbClientName.SelectedValue);
         StaticClass.DealerTokenId    = Convert.ToInt32(dgToken.Rows[e.RowIndex].Cells["id"].Value);
         frm.FormBorderStyle          = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
         frm.StartPosition            = FormStartPosition.CenterScreen;
         frm.MaximizeBox = false;
         frm.ShowDialog();
         FillData();
     }
 }
        private void dgAccountSettings_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult      result;
            string            swr       = "";
            string            sAr       = "";
            Int32             NoofToken = 0;

            if (e.RowIndex < 0)
            {
                return;
            }
            try
            {
                if ((dgAccountSettings.Focused) && (dgAccountSettings.CurrentCell.ColumnIndex == 3))
                {
                    dtpOrder.Location = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
                    dtpOrder.Width    = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Width;
                    dtpOrder.Visible  = true;
                    if (dgAccountSettings.CurrentCell.Value != DBNull.Value)
                    {
                        dtpOrder.Value = Convert.ToDateTime(dgAccountSettings.CurrentCell.Value);
                    }
                    else
                    {
                        dtpOrder.Value = DateTime.Today;
                    }
                }
                else if ((dgAccountSettings.Focused) && (dgAccountSettings.CurrentCell.ColumnIndex == 5))
                {
                    dtpOrder.Location = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
                    dtpOrder.Width    = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Width;
                    dtpOrder.Visible  = true;
                    if (dgAccountSettings.CurrentCell.Value != DBNull.Value)
                    {
                        dtpOrder.Value = Convert.ToDateTime(dgAccountSettings.CurrentCell.Value);
                    }
                    else
                    {
                        dtpOrder.Value = DateTime.Today;
                    }
                }
                else if ((dgAccountSettings.Focused) && (dgAccountSettings.CurrentCell.ColumnIndex == 7))
                {
                    dtpOrder.Location = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
                    dtpOrder.Width    = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Width;
                    dtpOrder.Visible  = true;
                    if (dgAccountSettings.CurrentCell.Value != DBNull.Value)
                    {
                        dtpOrder.Value = Convert.ToDateTime(dgAccountSettings.CurrentCell.Value);
                    }
                    else
                    {
                        dtpOrder.Value = DateTime.Today;
                    }
                }
                else if ((dgAccountSettings.Focused) && (dgAccountSettings.CurrentCell.ColumnIndex == 10))
                {
                    dtpOrder.Location = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location;
                    dtpOrder.Width    = dgAccountSettings.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Width;
                    dtpOrder.Visible  = true;
                    if (dgAccountSettings.CurrentCell.Value != DBNull.Value)
                    {
                        dtpOrder.Value = Convert.ToDateTime(dgAccountSettings.CurrentCell.Value);
                    }
                    else
                    {
                        dtpOrder.Value = DateTime.Today;
                    }
                }
                else
                {
                    dtpOrder.Visible = false;
                }

                if (e.ColumnIndex == 14)
                {
                    frmTokenInformation frm = new frmTokenInformation();

                    StaticClass.DealerTokenId    = 0;
                    StaticClass.dealerUserId     = Convert.ToInt32(cmbUserName.SelectedValue);
                    StaticClass.DealerDfClientId = Convert.ToInt32(cmbClientName.SelectedValue);
                    StaticClass.DealerUserName   = cmbUserName.Text.ToString();
                    StaticClass.DealerTokenId    = Convert.ToInt32(dgAccountSettings.Rows[e.RowIndex].Cells["tokenid"].Value);
                    frm.FormBorderStyle          = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
                    frm.StartPosition            = FormStartPosition.CenterScreen;
                    frm.MaximizeBox = false;
                    frm.ShowDialog();
                    FillTokenGenerationData();
                }
                if (e.ColumnIndex == 15)
                {
                    DialogResult result1;
                    result1 = MessageBox.Show("Are you sure to delete ?", "Management Panel", MessageBoxButtons.YesNo);
                    if (result1 == System.Windows.Forms.DialogResult.Yes)
                    {
                        string strDel = "";
                        strDel = "";
                        strDel = "delete from TitlesInPlaylists where Playlistid in( ";
                        strDel = strDel + "select distinct Playlistid from playlists where tokenid = " + Convert.ToInt32(dgAccountSettings.Rows[e.RowIndex].Cells["tokenid"].Value) + ")";
                        if (StaticClass.constr.State == ConnectionState.Open)
                        {
                            StaticClass.constr.Close();
                        }
                        StaticClass.constr.Open();
                        SqlCommand cmd = new SqlCommand(strDel, StaticClass.constr);
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();
                        StaticClass.constr.Close();

                        strDel = "";
                        strDel = "delete from playlists where tokenid = " + Convert.ToInt32(dgAccountSettings.Rows[e.RowIndex].Cells["tokenid"].Value) + " ";
                        if (StaticClass.constr.State == ConnectionState.Open)
                        {
                            StaticClass.constr.Close();
                        }
                        StaticClass.constr.Open();
                        cmd             = new SqlCommand(strDel, StaticClass.constr);
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();
                        StaticClass.constr.Close();

                        strDel = "";
                        strDel = "delete from AMPlayerTokens where tokenid = " + Convert.ToInt32(dgAccountSettings.Rows[e.RowIndex].Cells["tokenid"].Value) + " ";
                        if (StaticClass.constr.State == ConnectionState.Open)
                        {
                            StaticClass.constr.Close();
                        }
                        StaticClass.constr.Open();
                        cmd             = new SqlCommand(strDel, StaticClass.constr);
                        cmd.CommandType = CommandType.Text;
                        cmd.ExecuteNonQuery();
                        StaticClass.constr.Close();

                        dtpOrder.Visible = false;
                        FillTokenGenerationData();
                    }
                }
                if (e.ColumnIndex == 4)
                {
                    if (Convert.ToBoolean(dgAccountSettings.Rows[e.RowIndex].Cells[6].Value) == true)
                    {
                        dgAccountSettings.Rows[e.RowIndex].Cells[6].Value = false;
                    }
                }
                if (e.ColumnIndex == 6)
                {
                    if (Convert.ToBoolean(dgAccountSettings.Rows[e.RowIndex].Cells[4].Value) == true)
                    {
                        dgAccountSettings.Rows[e.RowIndex].Cells[4].Value = false;
                    }
                }
                //if (e.ColumnIndex == 9)
                //{
                //    if (dgAccountSettings.Rows[e.RowIndex].Cells[1].Value.ToString() == "Used")
                //    {
                //        MessageBox.Show("This token is used by client. !! You only block this token !!", "Management Panel");
                //        return;
                //    }
                //    result = MessageBox.Show("Are you sure to delete this token ?", "Management Panel", buttons);
                //    if (result == System.Windows.Forms.DialogResult.Yes)
                //    {
                //        swr = "select NoOfToken from Users where userid=" + Convert.ToInt32(cmbUserName.SelectedValue);
                //        DataTable dsUser = new DataTable();
                //        dsUser = objMainClass.fnFillDataTable(swr);
                //        NoofToken = Convert.ToInt32(dsUser.Rows[0]["NoOfToken"]);
                //        NoofToken = NoofToken - 1;
                //        if (StaticClass.constr.State == ConnectionState.Open) StaticClass.constr.Close();
                //        StaticClass.constr.Open();
                //        SqlCommand cmd = new SqlCommand("Delete_User_Token", StaticClass.constr);
                //        cmd.CommandType = CommandType.StoredProcedure;

                //        cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.BigInt));
                //        cmd.Parameters["@UserId"].Value = Convert.ToInt32(cmbUserName.SelectedValue);

                //        cmd.Parameters.Add(new SqlParameter("@TokenId", SqlDbType.BigInt));
                //        cmd.Parameters["@TokenId"].Value = Convert.ToInt32(dgAccountSettings.Rows[e.RowIndex].Cells[0].Value);

                //        cmd.Parameters.Add(new SqlParameter("@ClientId", SqlDbType.BigInt));
                //        cmd.Parameters["@ClientId"].Value = Convert.ToInt32(cmbClientName.SelectedValue);

                //        cmd.Parameters.Add(new SqlParameter("@NoofToken", SqlDbType.BigInt));
                //        cmd.Parameters["@NoofToken"].Value = Convert.ToInt32(NoofToken);
                //        try
                //        {
                //            cmd.ExecuteNonQuery();
                //            dgAccountSettings.Rows.RemoveAt(e.RowIndex);
                //        }
                //        catch (Exception ex)
                //        {
                //            MessageBox.Show(ex.Message);
                //        }
                //        finally
                //        {
                //            StaticClass.constr.Close();
                //        }
                //    }
                //    else if (result == System.Windows.Forms.DialogResult.No)
                //    {
                //        return;
                //    }

                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }