Подсистема автоматизированной тарификации биллинговой системы "Отик-интернет"
Дипломная работа - Компьютеры, программирование
Другие дипломы по предмету Компьютеры, программирование
>{.tbUsername = new System.Windows.Forms.TextBox();.tbPassword = new System.Windows.Forms.TextBox();.label1 = new System.Windows.Forms.Label();.label2 = new System.Windows.Forms.Label();.button1 = new System.Windows.Forms.Button();.button2 = new System.Windows.Forms.Button();.SuspendLayout();
.tbUsername.Location = new System.Drawing.Point(108, 20);.tbUsername.Name = "tbUsername";.tbUsername.Size = new System.Drawing.Size(152, 20);.tbUsername.TabIndex = 0;.tbUsername.Text = "";
.tbPassword.Location = new System.Drawing.Point(108, 44);.tbPassword.Name = "tbPassword";.tbPassword.PasswordChar = '*';.tbPassword.Size = new System.Drawing.Size(152, 20);.tbPassword.TabIndex = 1;.tbPassword.Text = "";
.label1.AutoSize = true;.label1.Location = new System.Drawing.Point(16, 22);.label1.Name = "label1";.label1.Size = new System.Drawing.Size(82, 16);.label1.TabIndex = 2;.label1.Text = "Пользователь:";
.label2.AutoSize = true;.label2.Location = new System.Drawing.Point(50, 46);.label2.Name = "label2";.label2.Size = new System.Drawing.Size(47, 16);.label2.TabIndex = 3;.label2.Text = "Пароль:";
.button1.Location = new System.Drawing.Point(108, 76);.button1.Name = "button1";.button1.TabIndex = 4;.button1.Text = "Войти";.button1.Click += new System.EventHandler(this.button1_Click);
.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;.button2.Location = new System.Drawing.Point(186, 76);.button2.Name = "button2";.button2.TabIndex = 5;.button2.Text = "Отмена";
.AutoScaleBaseSize = new System.Drawing.Size(5, 13);.CancelButton = this.button2;.ClientSize = new System.Drawing.Size(266, 103);.Controls.Add(this.button2);.Controls.Add(this.button1);.Controls.Add(this.label2);.Controls.Add(this.label1);.Controls.Add(this.tbPassword);.Controls.Add(this.tbUsername);.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;.MaximizeBox = false;.MinimizeBox = false;.Name = "LoginForm";.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;.Text = "LoginForm";.ResumeLayout(false);
}
#endregionvoid button1_Click(object sender, System.EventArgs e)
{= this.tbUsername.Text ;= this.tbPassword.Text ;.DialogResult = System.Windows.Forms.DialogResult.OK ;
this.Close() ;
}
}
}
//=====================================================
// Основная форма работы с тарифами
//=====================================================
…MainForm(System.Data.Odbc.OdbcConnection cnt)
{();= cnt ;= panelDescrTarif.Height ;
{() ;() ;
}(Exception ex)
{.Show(ex.Message) ;
}.fmPayment = new PaymentForm(cnt) ;.fmHelp = new HelpForm() ;.fmTables = new ViewAllForm(cnt) ;
}override void Dispose( bool disposing )
{( disposing )
{(components != null)
{.Dispose();
}
}.Dispose( disposing );
}
//
//работа с БД
//void InitializeSQLDataBase()
{= new System.Data.DataTable("name_tarif") ;= new System.Data.Odbc.OdbcDataAdapter("SELECT NameTarif, AbonPay FROM name_tarif", TarifConnection) ;= new System.Data.Odbc.OdbcCommandBuilder(NameTarifTableAdapter) ;.Fill(NameTarifTable) ;= new System.Data.DataTable("time_payment") ;= new System.Data.DataTable("weekend_payment") ;.DataSource = NameTarifTable ;.Windows.Forms.DataGridTableStyle ts = new System.Windows.Forms.DataGridTableStyle();.Windows.Forms.DataGridTextBoxColumn cs1 = new System.Windows.Forms.DataGridTextBoxColumn();.Windows.Forms.DataGridTextBoxColumn cs2 = new System.Windows.Forms.DataGridTextBoxColumn();.Width = 350 ;.HeaderText = "Название тарифа" ;.MappingName = "NameTarif" ;.HeaderText = "Абонентская плата" ;.Width = 150 ;.MappingName = "AbonPay" ;.GridColumnStyles.Add(cs1) ;.GridColumnStyles.Add(cs2) ;.MappingName = "name_tarif" ;.TableStyles.Add(ts) ;
} void UpdateNameTarif()
{.Clear() ;.Fill(NameTarifTable) ;.Refresh() ;() ;
} void CalculateTraficSize()
{i = 0 ;(Object s in cbTraficType.Items)
{(cbTraficType.Text.Equals(s.ToString())) break ;+= 10 ;
} scale = System.Math.Pow(2, i) ;size = System.Convert.ToDouble(tbTraficSize.Tag.ToString()) ;.Text = System.Convert.ToString( (System.UInt64)((size / scale))) ;
} void BindDataToControls()
{
{NameTarif = dgNameTarif[dgNameTarif.CurrentRowIndex, 0].ToString() ;.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 )return ;IdSinglePayment = TarifTable.Rows[0]["IdSinglePayment"].ToString() ;IdTimePayment = TarifTable.Rows[0]["IdTimePayment"].ToString() ;IdWeekEndPayment = TarifTable.Rows[0]["IdWeekEndPayment"].ToString() ;.Tag = TarifTable.Rows[0]["FreeFavour"].ToString() ;() ;.Data.Odbc.OdbcDataAdapter SelectSinglePayment = new System.Data.Odbc.OdbcDataAdapter(
"SELECT WithEquipment, WithoutEquipment, MinPayment FROM single_payment WHERE IdSinglePayment="+IdSinglePayment, TarifConnection) ;.Data.Odbc.OdbcDataAdapter SelectTimePayment = new System.Data.Odbc.OdbcDataAdapter(
"SELECT TimeBegin, TimeEnd, Price, PriceOut FROM time_payment WHERE IdTimePayment="+IdTimePayment, TarifConnection) ;.Data.Odbc.OdbcDataAdapter SelectWeekEndPayment = new System.Data.Odbc.OdbcDataAdapter(
"SELECT TimeBegin, TimeEnd, Price, PriceOut FROM time_payment WHERE IdTimePayment="+IdWeekEndPayment, TarifConnection) ;.Data.DataTable SinglePaymentTable = new System.Data.DataTable() ;.Fill(SinglePaymentTable) ;( SinglePaymentTable.Rows.Count > 0 )
{.Text = SinglePaymentTable.Rows[0]["WithEquipment"].ToString() ;.Text = SinglePaymentTable.Rows[0]["WithoutEquipment"].ToString() ;.Text = SinglePaymentTable.Rows[0]["MinPayment"].ToString() ;
}.Clear() ;.Clear() ;.Fill(TimePaymentTable) ;.Fill(WeekEndPaymentTable) ;.DataSource = TimePaymentTable ;.DataSource = WeekEndPaymentTable ;
}(Exception ex)
{.Show(ex.Message) ;
}
}
[STAThread]void Main()
{login = false ;fmLogin = new LoginForm() ;.Data.Odbc.OdbcConnection MySqlConnection = new System.Data.Odbc.OdbcConnection() ;(!login)
{
{.ShowDialog() ;( fmLogin.DialogResult != System.Windows.Forms.DialogResult.OK ) return ;connectstr = "DRIVER={MySQL ODBC 3.51 Driver};"+
"SERVER=localhost;"+
"UID="+fmLogin.username+";"+
"PASSWORD="+fmLogin.password+";"+
"DATABASE=tarif";.ConnectionString = connectstr ;.Open() ;= true ;
}(Exception ex)
{
MessageBox.Show("В доступе отказано") ;
}
}.Run(new MainForm(MySqlConnection));.Close() ;
}void btAppend_Click(object sender, System.EventArgs e)
{.OpenedForChanging = false ;.NameTarif = dgNameTarif[dgNameTarif.CurrentRowIndex, 0].ToString() ;.ShowDialog(this) ;() ;
}void btChange_Click(object sender, System.EventArgs e)
{.OpenedForChanging = true ;.NameTarif = dgNameTarif[dgNameTarif.CurrentRowIndex, 0].ToString() ;.ShowDialog(this) ;() ;
}void btExit_Click(object sender, System.EventArgs e)
{.Close() ;
}void btDelete_Click(object sender, System.EventArgs e)
{( MessageBox.Show(this, "Подтверждаете удаление?", "Confirm",.Windows.Forms.MessageBoxButtons.YesNo,.Windows.Forms.MessageBoxIcon.Question) ==.Windows.Forms.DialogResult.Yes )
{
{NameTarif = dgNameTarif[dgNameTarif.CurrentRowIndex, 0].ToString() ;.Data.Odbc.OdbcCommand killCmd = new System.Data.Odbc.OdbcCommand(
"DELETE FROM name_tarif WHERE NameTarif='"+NameTarif+"'", TarifConnection) ;.ExecuteNonQuery() ;() ;
}(Exception ex)
{.Show(ex.Message) ;
}
}
}void btHelp_Click(object sender, System.EventArgs e)
{.ShowDialog() ;
}void btUpdate_Click(object sender, System.EventArgs e)
{() ;
}void btShowTable_Click(object sender, System.EventArgs e)
{.ShowDialog() ;
}void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs ce)
{
{.Close() ;
}(Exception ex)
{.Show(ex.Message) ;
}
}void dgNameTarif_CurrentCellChanged(object sender, EventArgs e)
{() ;
}void btDescription_Click(object sender, System.EventArgs e)
{(panelDescrTarif.Height == 0)
{.Height = dpHeight ;.Height += dpHeight ;
}
{.Height = 0 ;.Height -= dpHeight ;
}.panel1.Focus() ;
}void tbFind_TextChanged(object sender, System.EventArgs e)
{( int f=0 ; f<NameTarifTable.Rows.Count ; f++ )
{( dgNameTarif[f, 0].ToString().StartsWith(tbFind.Text) )
{.CurrentRowIndex = f ;() ;;
}
}
}void cbTraficType_SelectedIndexChanged(object sender, System.EventArgs e)
{() ;
}
}
}
…void chbTimePayment_CheckedChanged(object sender, System.EventArgs e)
{(chbTimePayment.Checked)
{= false ;.Enabled = true ;
}
{.Enabled = false ;
}
}void btWeekEnd_Click(object sender, System.EventArgs e)
{(panelWeekEnd.Height == 0)
{.Height = dpWEHei