Подсистема автоматизированной тарификации биллинговой системы "Отик-интернет"
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
ght ;.gbTimePayment.Height += dpWEHeight ;.Height += dpWEHeight ;
}
{.Height = 0 ;.gbTimePayment.Height -= dpWEHeight ;.Height -= dpWEHeight ;
}.panel5.Focus() ;
}void btBudni_Click(object sender, System.EventArgs e)
{(panelBudni.Height == 0)
{.Height = dpBHeight ;.gbTimePayment.Height += dpBHeight ;.Height += dpBHeight ;
}
{.Height = 0 ;.gbTimePayment.Height -= dpBHeight ;.Height -= dpBHeight ;
}.panel5.Focus() ;
}void PaymentForm_Load(object sender, System.EventArgs e)
{= false ;= false ;.Enabled = OpenedForChanging ;() ;(OpenedForChanging)
{.Data.Odbc.OdbcDataAdapter SelectTarif = new System.Data.Odbc.OdbcDataAdapter(
"SELECT * FROM name_tarif WHERE NameTarif='"+NameTarif+"'", TarifConnection) ;.Data.DataTable TarifTable = new System.Data.DataTable() ;.Fill(TarifTable) ;( TarifTable.Rows.Count < 1 )
{.Close() ;;
}= (int)TarifTable.Rows[0]["IdSinglePayment"] ;= (int)TarifTable.Rows[0]["IdTimePayment"] ;= (int)TarifTable.Rows[0]["IdWeekEndPayment"] ;.Tag = TarifTable.Rows[0]["FreeFavour"].ToString() ;.Text = TarifTable.Rows[0]["NameTarif"].ToString() ;.Text = TarifTable.Rows[0]["AbonPay"].ToString() ;.Text = tbTraficSize.Tag.ToString() ;.Text = "Байтах" ;() ;.Checked = ( IdTimePayment != 0 ) ;= CalculateTimePayment() ;= CalculateWeekEndPayment() ;
}
}void btReset_Click(object sender, System.EventArgs e)
{() ;
}void btClear_Click(object sender, System.EventArgs e)
{() ;
}void InsertData()
{( chbTimePayment.Checked )
{.Data.Odbc.OdbcCommand maxTimePayment = new System.Data.Odbc.OdbcCommand(
"SELECT MAX(NumberTimePayment) FROM time_payment ", TarifConnection) ;max_tp = (int)maxTimePayment.ExecuteScalar() ;( System.Data.DataRow row in TimePaymentTable.Rows )
{_tp++ ;prIn = row[2].ToString().Replace(",", ".") ;prOut = row[3].ToString().Replace(",", ".") ;.TimeSpan ets = ((System.TimeSpan)row[1]) ;endtStr = System.Convert.ToString(ets.Days*24+ets.Hours)+":"+ets.Minutes+":"+ets.Hours ;req = "INSERT INTO time_payment (TimeBegin, TimeEnd, Price, PriceOut, IdTimePayment, NumberTimePayment, test) "+
"VALUES ('"+row[0].ToString()+"', '"+endtStr+"', "+prIn+", "+prOut+", "++", "+max_tp+", 1)" ;.Data.Odbc.OdbcCommand addTimePayment = new System.Data.Odbc.OdbcCommand(, TarifConnection) ;.ExecuteNonQuery() ;
}( WeekEndPaymentTable.Rows.Count == 0 ) IdWeekEndPayment = 0 ;( IdWeekEndPayment != 0 )
{( System.Data.DataRow row in WeekEndPaymentTable.Rows )
{_tp++ ;prIn = row[2].ToString().Replace(",", ".") ;prOut = row[3].ToString().Replace(",", ".") ;.TimeSpan ets = ((System.TimeSpan)row[1]) ;endtStr = System.Convert.ToString(ets.Days*24+ets.Hours)+":"+ets.Minutes+":"+ets.Hours ;.Data.Odbc.OdbcCommand addWeekEndPayment = new System.Data.Odbc.OdbcCommand(
"INSERT INTO time_payment (TimeBegin, TimeEnd, Price, PriceOut, IdTimePayment, NumberTimePayment, test) "+
"VALUES ('"+row[0].ToString()+"', '"+endtStr+"', "+prIn+", "+prOut+", "++", "+max_tp+", 1)", TarifConnection) ;.ExecuteNonQuery() ;
}
}
}
{= IdWeekEndPayment = 0 ;
}.Data.Odbc.OdbcCommand insertSinglePayment = new System.Data.Odbc.OdbcCommand(
"INSERT INTO single_payment (IdSinglePayment, WithEquipment, WithoutEquipment, MinPayment) "+
"VALUES ("+IdSinglePayment+", "+tbSPWithEquip.Text+", "+tbSPWithoutEquip.Text+
", "+tbSPMinPayment.Text+")", TarifConnection) ;.ExecuteNonQuery() ;.Data.Odbc.OdbcCommand insertNameTarif = new System.Data.Odbc.OdbcCommand(
"INSERT INTO name_tarif (NameTarif, IdSinglePayment, IdTimePayment, IdWeekEndPayment, AbonPay, FreeFavour) "+
"VALUES ('"+tbNameTarif.Text+"', "+IdSinglePayment+", "+IdTimePayment+", "+IdWeekEndPayment+
", "+tbAbonPayment.Text+", "+tbTraficSize.Tag.ToString()+")", TarifConnection) ;.ExecuteNonQuery() ;
}void DeleteData()
{.Data.Odbc.OdbcCommand killNameTarif = new System.Data.Odbc.OdbcCommand(
"DELETE FROM name_tarif WHERE NameTarif='"+NameTarif+"'", TarifConnection) ;.ExecuteNonQuery() ;( IdSinglePayment != 0 )
{.Data.Odbc.OdbcCommand killSinglePayment = new System.Data.Odbc.OdbcCommand(
"DELETE FROM single_payment WHERE IdSinglePayment="+IdSinglePayment, TarifConnection) ;.ExecuteNonQuery() ;
}( IdTimePayment != 0 )
{.Data.Odbc.OdbcCommand killTimePayment = new System.Data.Odbc.OdbcCommand(
"DELETE FROM time_payment WHERE IdTimePayment="+IdTimePayment, TarifConnection) ;.ExecuteNonQuery() ;
}( IdWeekEndPayment != 0 )
{.Data.Odbc.OdbcCommand killWeekEndPayment = new System.Data.Odbc.OdbcCommand(
"DELETE FROM time_payment WHERE IdTimePayment="+IdWeekEndPayment, TarifConnection) ;.ExecuteNonQuery() ;
}
}bool ValidateData()
{.Text = tbAbonPayment.Text.Replace(",", ".") ;.Text = tbSPWithEquip.Text.Replace(",",".") ;.Text = tbSPWithoutEquip.Text.Replace(",",".") ;.Text = tbSPMinPayment.Text.Replace(",",".") ;.Text.Trim() ;( tbNameTarif.Text == "" )
{.Show("Неврное имя тарифа!", "Ошибка",.Windows.Forms.MessageBoxButtons.OK,.Windows.Forms.MessageBoxIcon.Error) ;false ;
}( (chbTimePayment.Checked) && (TimePaymentTable.Rows.Count == 0) )
{
MessageBox.Show("Введите временные платежи!", "Ошибка",
System.Windows.Forms.MessageBoxButtons.OK,.Windows.Forms.MessageBoxIcon.Error) ;false ;
}( (chbTimePayment.Checked) && (!tpOk || !wpOk) )
{
MessageBox.Show("Проверте временные платежи!", "Ошибка",
System.Windows.Forms.MessageBoxButtons.OK,.Windows.Forms.MessageBoxIcon.Error) ;false ;
}true ;
}void btApplay_Click(object sender, System.EventArgs e)
{( !ValidateData() ) return ;( MessageBox.Show(this, "Подтверждаете изменения?", "Confirm",.Windows.Forms.MessageBoxButtons.YesNo,.Windows.Forms.MessageBoxIcon.Question) ==.Windows.Forms.DialogResult.Yes )
{success = false ;( TarifConnection.State == System.Data.ConnectionState.Closed )
{.Open() ;
}
{() ;( OpenedForChanging )
{() ;
}
{.Data.Odbc.OdbcCommand maxIdSinglePayment = new System.Data.Odbc.OdbcCommand(
"SELECT MAX(IdSinglePayment) FROM single_payment ", TarifConnection) ;= (int)maxIdSinglePayment.ExecuteScalar() + 1 ;
}.Data.Odbc.OdbcCommand maxIdTimePayment = new System.Data.Odbc.OdbcCommand(
"SELECT MAX(IdTimePayment) FROM time_payment ", TarifConnection) ;max_IdTP = (int)maxIdTimePayment.ExecuteScalar() ;( IdTimePayment == 0 )
{= max_IdTP + 1 ;( IdWeekEndPayment == 0 ) IdWeekEndPayment = max_IdTP + 2 ;
}( IdWeekEndPayment == 0 ) IdWeekEndPayment = max_IdTP + 1 ;() ;= true ;
}(Exception ex)
{.Show(ex.Message) ;
} ( success ) this.Close() ;
}
}
bool CalculateTimePayment()
{( !chbTimePayment.Checked) return true;( TimePaymentTable.Rows.Count == 0 )
{.Text = "Введите данные!" ;false;
}f = 1 ;( ; f < TimePaymentTable.Rows.Count ; f++)
{( (dgTimePayment[f-1, 1].ToString() == "") || // == System.Convert.DBNul
(dgTimePayment[f, 0].ToString() == "") )
{.Text = "заполните строку " + (f+1) ;false;
}.TimeSpan odt = (System.TimeSpan)dgTimePayment[f-1, 1] ;.TimeSpan ndt = (System.TimeSpan)dgTimePayment[f, 0] ;( (ndt.Hours != odt.Hours+odt.Days*24) || (ndt.Minutes != odt.Minutes) )
{.Text = "ошибка в строке " + (f+1) ;false;
}
}.TimeSpan bdt = (System.TimeSpan)dgTimePayment[0, 0] ;.TimeSpan edt = (System.TimeSpan)dgTimePayment[f-1, 1] ;= edt.Subtract(bdt) ;.TimeSpan rts = new System.TimeSpan(23, 59, 59) ;= rts.Subtract(edt) ;.Text = rts.ToString() ; // rts.Hour + ":" + rts.Minute ;true ;
}bool CalculateWeekEndPayment()
{( !chbTimePayment.Checked) return true ;( WeekEndPaymentTable.Rows.Count == 0 ) return true ;f = 1 ;( ; f < WeekEndPaymentTable.Rows.Count ; f++)
{( (dgWeekEndPayment[f-1, 1].ToString() == "") || // == System.Convert.DBNul
(dgWeekEndPayment[f, 0].ToString() == "") )
{.Text = "заполните строку " + (f+1) ;false ;
}.TimeSpan odt = (System.TimeSpan)dgWeekEndPayment[f-1, 1] ;.TimeSpan ndt = (System.TimeSpan)dgWeekEndPayment[f, 0] ;( (ndt.Hours != odt.Hours+odt.Days*24) || (ndt.Minutes != odt.Minutes) )
{.Text = "ошибка в строке " + (f+1) ;false ;
}
}.TimeSpan bdt = (System.TimeSpan)dgWeekEndPayment[0, 0] ;.TimeSpan edt = (System.TimeSpan)dgWeekEndPayment[f-1, 1] ;= edt.Subtract(bdt) ;.TimeSpan rts = new System.TimeSpan(23, 59, 59) ;= rts.Subtract(edt) ;.Text = rts.ToString() ; // rts.Hour + ":" + rts.Minute ;true ;
}bool CheckTime(int bh, int bm, int eh, int em)
{errMsg = "&q