Example #1
0
    protected void InvoicesTab_UNPayInvoiceButton_Click(object sender, EventArgs e)
    {
        string    connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"];
        DataBlock dataBlock        = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);

        try
        {
            int invoiceId = Convert.ToInt32(Selected_InvoicesDataGrid_Index.Value);


            dataBlock.OpenConnection();
            dataBlock.OpenTransaction();
            dataBlock.invoiceTable.UnPayABill(invoiceId);
            dataBlock.CommitTransaction();
            dataBlock.CloseConnection();

            /*  dataBlock.invoiceTable.OpenConnection();
             * dataBlock.invoiceTable.OpenTransaction();
             * dataBlock.invoiceTable.UnPayABill(invoiceId);
             * dataBlock.invoiceTable.CommitTransaction();
             * dataBlock.invoiceTable.CloseConnection();*/
            LoadInvoicesTable();
            InvoicesDataGridUpdatePanel.Update();
            InvoicesTab_ButtonsUpdateTable.Update();
        }
        catch (Exception ex)
        {
            dataBlock.RollbackConnection();
            dataBlock.CloseConnection();

            /*dataBlock.invoiceTable.RollbackConnection();
             * dataBlock.invoiceTable.CloseConnection();*/
            RaiseException(ex);
        }
    }
Example #2
0
    protected void InvoicesTab_PayInvoiceButton_Click(object sender, EventArgs e)
    {
        string    currentLanguage  = ConfigurationManager.AppSettings["language"];
        string    connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"];
        DataBlock dataBlock        = new DataBlock(connectionString, currentLanguage);

        try
        {
            dataBlock.OpenConnection();
            dataBlock.OpenTransaction();
            int curUserId = dataBlock.usersTable.Get_UserID_byName(Page.User.Identity.Name);
            int invoiceId = Convert.ToInt32(Selected_InvoicesDataGrid_Index.Value);

            //old version

            /*  dataBlock.invoiceTable.OpenConnection();
             * dataBlock.invoiceTable.OpenTransaction();
             * dataBlock.invoiceTable.PayABill(invoiceId);
             * string invoiceName = dataBlock.invoiceTable.GetInvoiceName(invoiceId);
             * dataBlock.invoiceTable.CommitTransaction();
             * dataBlock.invoiceTable.CloseConnection();*/

            //test version
            dataBlock.invoiceTable.PayABill(invoiceId);
            string invoiceName = dataBlock.invoiceTable.GetInvoiceName(invoiceId);
            dataBlock.CommitTransaction();
            dataBlock.CloseConnection();
            //

            LoadInvoicesTable();
            InvoicesDataGridUpdatePanel.Update();
            InvoicesTab_ButtonsUpdateTable.Update();
            ////    добавление записи в журнал. потом возможно перенести куда надо(в логику).
            DB.SQL.SQLDB sqlDb   = new DB.SQL.SQLDB(connectionString);
            HistoryTable history = new HistoryTable(connectionString, currentLanguage, sqlDb);
            sqlDb.OpenConnection();
            history.AddHistoryRecord("FN_INVOICE", "INVOICE_STATUS_ID", dataBlock.invoiceTable.Status_Paid, curUserId, history.invoicePaid, "#" + invoiceId + @" :""" + invoiceName + @"""", sqlDb);
            sqlDb.CloseConnection();
            ////
        }
        catch (Exception ex)
        {
            dataBlock.invoiceTable.RollbackConnection();
            dataBlock.invoiceTable.CloseConnection();
            RaiseException(ex);
        }
    }
Example #3
0
    protected void InvoicesDataGrid_RadioButton_Checked(object sender, EventArgs e)
    {
        string    connectionString = ConfigurationSettings.AppSettings["fleetnetbaseConnectionString"];
        DataBlock dataBlock        = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);

        try
        {
            /*  foreach (DataGridItem oldrow in InvoicesDataGrid.Items)
             * {
             *    ((RadioButton)oldrow.FindControl("InvoicesDataGrid_RadioButton")).Checked = false;
             * }*/
            //Set the new selected row
            RadioButton  rb  = (RadioButton)sender;
            DataGridItem row = (DataGridItem)rb.NamingContainer;
            ((RadioButton)row.FindControl("InvoicesDataGrid_RadioButton")).Checked = true;
            int invoiceId = ((List <int>)Session["InvoicesTab_UserControl_UsersIds"])[row.DataSetIndex];
            Selected_InvoicesDataGrid_Index.Value = invoiceId.ToString();
            //LoadUserAdditionalInfo(userId); dataBlock.reportsTable.OpenConnection();

            //dataBlock.invoiceTable.OpenConnection();
            dataBlock.OpenConnection();
            //делает кнопку Оплатить неактивной, если счет уже оплачен и наоборот
            DateTime outdatetime = new DateTime();
            if (DateTime.TryParse(dataBlock.invoiceTable.GetDatePayment(invoiceId), out outdatetime))
            {
                InvoicesTab_PayInvoiceButton.Enabled = false;
            }
            else
            {
                InvoicesTab_PayInvoiceButton.Enabled = true;
            }
            ///////////////////////
            InvoicesDataGridUpdatePanel.Update();
            InvoicesTab_ButtonsUpdateTable.Update();
            //////////////////////
            //dataBlock.invoiceTable.CloseConnection();
            dataBlock.CloseConnection();
        }
        catch (Exception ex)
        {
            dataBlock.CloseConnection();
//            dataBlock.invoiceTable.CloseConnection();
            RaiseException(ex);
        }
    }