public void SetUser(Int32 number)
 {
     if (number != 0)
     {
         mySQLconnect = MySQLConnector.GetInstance();
         DataTable info = mySQLconnect.SelectAgreementInfo(number);
         if (info != null)
         {
             DataRow user = info.Rows[0];
             DateTime.TryParse(dateRebuild(user[1].ToString().Substring(0, 10)), out depoStart);
             DateTime.TryParse(dateRebuild(user[2].ToString().Substring(0, 10)), out depoEnd);
             DateTime.TryParse(dateRebuild(user[3].ToString().Substring(0, 10)), out agrEnd);
             numTBox.Text = user[0].ToString(); //номер договора
             dateTimePicker1.MinDate = depoStart;
             dateTimePicker1.Value = depoStart;
             //label5.Text = "Date selected: " + depoStart.ToString();
             label8.Text = "Date of end: " + dateRebuild(depoEnd.ToString());
             dateTimePicker2.MinDate = agrEnd.AddDays(-1);
             dateTimePicker2.Value = agrEnd.AddDays(-1);
             summTBox.Text = user[4].ToString();//сумма вклада
             for (int i = 5; i <= 7; i++)
                 clientTBox.Text += user[i].ToString() + " ";
             this.ShowDialog();
             return;
         }
     }
 }
Beispiel #2
0
 public void SetUser(Int32 number)
 {
     if (number != 0)
     {
         mySQLconnect = MySQLConnector.GetInstance();
         DataTable info = mySQLconnect.SelectAgreementInfo(number);
         if (info != null)
         {
             DataRow user = info.Rows[0];
             DateTime.TryParse(dateRebuild(user[1].ToString().Substring(0, 10)), out depoStart);
             DateTime.TryParse(dateRebuild(user[2].ToString().Substring(0, 10)), out depoEnd);
             DateTime.TryParse(dateRebuild(user[3].ToString().Substring(0, 10)), out agrEnd);
             numTBox.Text            = user[0].ToString(); //номер договора
             dateTimePicker1.MinDate = depoStart;
             dateTimePicker1.Value   = depoStart;
             //label5.Text = "Date selected: " + depoStart.ToString();
             label8.Text             = "Date of end: " + dateRebuild(depoEnd.ToString());
             dateTimePicker2.MinDate = agrEnd.AddDays(-1);
             dateTimePicker2.Value   = agrEnd.AddDays(-1);
             summTBox.Text           = user[4].ToString();//сумма вклада
             for (int i = 5; i <= 7; i++)
             {
                 clientTBox.Text += user[i].ToString() + " ";
             }
             this.ShowDialog();
             return;
         }
     }
 }
Beispiel #3
0
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     //using (MySQLConnector msc = new MySQLConnector())
     MySQLConnector msc = MySQLConnector.GetInstance();
     {
         try
         {
             if (msc.IfExists(Info[0], Info[1], Info[2]) == false && msc.IfExistsPassport(Info[6], Info[7]) == false)
             {
                 msc.AddInformation(Info);
                 this.Close();
                 //msc.UpdateInfo(id, CheckDifferences(), Info);
             }
             else
             {
                 MessageBox.Show("Already Exists");
             }
             //msc.AddInformation(Info);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
     //this.Close();
 }
Beispiel #4
0
 public static MySQLConnector GetInstance()
 {
     if (instance == null)
     {
         instance = new MySQLConnector();
     }
     return(instance);
 }
 public AddDepoForm(Type _type)
 {
     InitializeComponent();
     mySQLconnect = MySQLConnector.GetInstance();
     depoTypeCBox.DataSource = mySQLconnect.SelectDepoInfo();
     depoTypeCBox.DisplayMember = "Type_name";
     numTBox.Text = SetAgreementNumber(mySQLconnect.SelectLastAgreement()).ToString();
     type = _type;
     dateTimePicker1.Value = DateTime.Today;
     dateTimePicker1.MinDate = DateTime.Today;
 }
Beispiel #6
0
 public AddDepoForm(Type _type)
 {
     InitializeComponent();
     mySQLconnect               = MySQLConnector.GetInstance();
     depoTypeCBox.DataSource    = mySQLconnect.SelectDepoInfo();
     depoTypeCBox.DisplayMember = "Type_name";
     numTBox.Text               = SetAgreementNumber(mySQLconnect.SelectLastAgreement()).ToString();
     type = _type;
     dateTimePicker1.Value   = DateTime.Today;
     dateTimePicker1.MinDate = DateTime.Today;
 }
Beispiel #7
0
        private void DelBtn_Click(object sender, EventArgs e)
        {
            Int32  i = InfoDataGrid.CurrentRow.Index;
            String selectedString = InfoDataGrid[0, i].Value.ToString();    //get selected user ID

            Console.WriteLine(selectedString);
            MySQLConnector msc = MySQLConnector.GetInstance();

            {
                MessageBox.Show(msc.DeleteInfo(selectedString));
            }
            InfoDataGrid.Rows.RemoveAt(i);
        }
 private void srchBtn_Click(object sender, EventArgs e)
 {
     using (MySQLConnector connector = new MySQLConnector())
     {
         if (type == Type.Users)
             parent.ShowSearch(connector.SelectInformation(fnameTBox.Text.Trim(),
                 snameTBox.Text.Trim(), fatNameTBox.Text.Trim()));
         else
             if (snameTBox.Text.Length>0)
                 if (!Int32.TryParse(snameTBox.Text, out num))
                     num = 0;
     }
     this.Close();
 }
Beispiel #9
0
 private void ShowInfoBtn_Click(object sender, EventArgs e)
 {
     MySQLConnector msc = MySQLConnector.GetInstance();
     {
         try
         {
             InfoDataGrid.DataSource         = msc.SelectInformation();
             InfoDataGrid.Columns[0].Visible = false;
         }
         catch (Exception)
         {
             MessageBox.Show("Empty base");
         }
     }
 }
Beispiel #10
0
        private void updBtn_Click(object sender, EventArgs e)
        {
            //using (MySQLConnector msc = new MySQLConnector())
            MySQLConnector msc = MySQLConnector.GetInstance();

            {
                try
                {
                    //CheckDifferences();
                    msc.UpdateInfo(id, CheckDifferences(), Info);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
            this.Close();
        }
Beispiel #11
0
        private void AddForm_Shown(object sender, EventArgs e)
        {
            //using (MySQLConnector con = new MySQLConnector())
            MySQLConnector msc = MySQLConnector.GetInstance();

            {
                curTownComBox.DataSource    = msc.SelectInformation(0);
                curTownComBox.DisplayMember = "town_Name";
                offTownComBox.DataSource    = msc.SelectInformation(0);
                offTownComBox.DisplayMember = "town_Name";
                familyComBox.DataSource     = msc.SelectInformation(1);
                familyComBox.DisplayMember  = "condition";
                citizenComBox.DataSource    = msc.SelectInformation(3);
                citizenComBox.DisplayMember = "countries";
                invalidComBox.DataSource    = msc.SelectInformation(2);
                invalidComBox.DisplayMember = "invalid_cond";
            }
            fnameBox.Focus();
        }
 private void srchBtn_Click(object sender, EventArgs e)
 {
     using (MySQLConnector connector = new MySQLConnector())
     {
         if (type == Type.Users)
         {
             parent.ShowSearch(connector.SelectInformation(fnameTBox.Text.Trim(),
                                                           snameTBox.Text.Trim(), fatNameTBox.Text.Trim()));
         }
         else
         if (snameTBox.Text.Length > 0)
         {
             if (!Int32.TryParse(snameTBox.Text, out num))
             {
                 num = 0;
             }
         }
     }
     this.Close();
 }
 public static MySQLConnector GetInstance()
 {
     if (instance == null) instance = new MySQLConnector();
     return instance;
 }