Ejemplo n.º 1
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         textBox1.Text  = (dataGridView1.CurrentRow.Cells[1].Value.ToString() + ' ' + dataGridView1.CurrentRow.Cells[2].Value.ToString() + ' ' + dataGridView1.CurrentRow.Cells[3].Value.ToString());
         comboBox3.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
         comboBox4.Text = dataGridView1.CurrentRow.Cells[5].Value.ToString();
         //textBox7.Text = dataGridView1.CurrentRow.Cells[6].Value.ToString();
         //textBox4.Text = "";
         //textBox5.Text = "";
         //textBox7.Text = "";
         //textBox8.Text = "";
         //listBox1.SelectedValue = Convert.ToInt32(dataGridView1.CurrentRow.Cells[8].Value.ToString());
         //switch (Convert.ToInt32(dataGridView1.CurrentRow.Cells[7].Value.ToString()))
         //{
         //    case 0:
         //        comboBox1.SelectedIndex = 0;
         //        break;
         //    case 1:
         //        comboBox1.SelectedIndex = 1;
         //        break;
         //    case 2:
         //        comboBox1.SelectedIndex = 2;
         //        break;
         //}
     }
     catch
     {
         Reg_Info _RI = new Reg_Info();
         _RI.Connection.Close();
         MessageBox.Show("Выберите строку, содержащую данные!", "Учет времени!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Ejemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     _RI = new Reg_Info();
     _RI.Register_set(comboBox1.Text, comboBox2.Text, textBox1.Text, textBox2.Text);
     panel1.Visible           = false;
     toolStripButton1.Enabled = true;
 }
Ejemplo n.º 3
0
        public void Autentification(string us_pas)
        {
            try
            {
                _RI = new Reg_Info();
                _RI.Set_Connection();
                _CmdSql = new SqlCommand(us_id_qr + us_pas + "'", _RI.Connection);
                _RI.Connection.Open();
                Program.UID = Convert.ToInt32(_CmdSql.ExecuteScalar().ToString());
                switch (Program.UID)
                {
                case (0):
                    MessageBox.Show("Вас нет в системе! Повторите ввод пароля!");
                    break;

                case (1):
                    Program.authorized = true;
                    break;
                    //default:
                    //    _RI = new Reg_Info();
                    //    _CmdSql = new SqlCommand(sy_access + Program.UID, _RI.Connection);
                    //    _RI.Set_Connection();
                    //    _RI.Connection.Open();
                    //    Program.SYACCSS = Convert.ToInt32(_CmdSql.ExecuteScalar().ToString());
                    //    switch (Program.SYACCSS)
                    //    {
                    //        case (0):
                    //            MessageBox.Show("У вас нет прав доступа к системе!");
                    //            break;
                    //        case (1):
                    //            _RI = new Reg_Info();
                    //            _RI.Set_Connection();
                    //            _RI.Connection.Open();
                    //            SqlCommand SAccssCmd = new SqlCommand(sl_access + Program.UID, _RI.Connection);
                    //            SqlCommand TNSAccssCmd = new SqlCommand(tv_skld_access + Program.UID, _RI.Connection);
                    //            SqlCommand MAccssCmd = new SqlCommand(m_access + Program.UID, _RI.Connection);
                    //            Program.SACCSS = Convert.ToInt32(SAccssCmd.ExecuteScalar().ToString());
                    //            Program.TNSACCSS = Convert.ToInt32(TNSAccssCmd.ExecuteScalar().ToString());
                    //            Program.MACCSS = Convert.ToInt32(MAccssCmd.ExecuteScalar().ToString());
                    //            Program.Value = true;
                    //            _RI.Connection.Close();
                    //            break;
                    //    }
                    //    _RI.Connection.Close();
                    //    break;
                }
                _RI.Connection.Close();
            }
            catch
            {
                MessageBox.Show("Пользователь не найден!");
            }
        }
Ejemplo n.º 4
0
        //public string main_accss_value = "select [dbo].[role_list].[main_access] from [dbo].[role_list] where [naim_role]='";
        //public string sale_accss_value = "select [dbo].[role_list].[sale_access] from [dbo].[role_list] where [naim_role]='";
        //public string tov_skld_accss_value = "select [dbo].[role_list].[tovar_sklad_access] from [dbo].[role_list] where [naim_role]='";
        //public void View_Price_void(DataGridView valueTable)
        //{
        //    _RI = new Reg_Info();
        //    _RI.Set_Connection();
        //    SqlCommand View_Price_Select = new SqlCommand("select * from [dbo].[AllTovar]", _RI.Connection);
        //    _RI.Connection.Open();
        //    SqlDataReader tableReader = View_Price_Select.ExecuteReader();
        //    DataTable dataValue = new DataTable();
        //    dataValue.Load(tableReader);
        //    valueTable.DataSource = dataValue;
        //    valueTable.Columns[0].Visible = true;
        //    valueTable.Columns[1].Visible = true;
        //    valueTable.Columns[2].Visible = true;
        //    valueTable.Columns[0].Width = 300;
        //    valueTable.Columns[1].Width = 400;
        //    valueTable.Columns[2].Width = 400;
        //    valueTable.ReadOnly = true;
        //    _RI.Connection.Close();
        //}
        public decimal price(int tovar)
        {
            _RI = new Reg_Info();
            _RI.Set_Connection();
            _RI.Connection.Open();
            SqlCommand Cmd = new SqlCommand("Select [cena_tovara] from [dbo].[tovar_na_sklade] inner join [dbo].[tovar] on [dbo].[tovar_na_sklade].[tovar_id] = " +
                                            "[dbo].[tovar].[id_tovar] inner join [dbo].[sklad] on [dbo].[tovar_na_sklade].[sklad_id] = [dbo].[sklad].[id_sklad] " +
                                            "where [id_tovar_na_sklade] = " + tovar.ToString(), _RI.Connection);
            decimal a = Convert.ToDecimal(Cmd.ExecuteScalar().ToString());

            _RI.Connection.Close();
            return(a);
        }
Ejemplo n.º 5
0
 private void button6_Click(object sender, EventArgs e)
 {
     try
     {
         _BD.Polz_edit_void(Convert.ToInt32(dataGridView2.CurrentRow.Cells[0].Value.ToString()), textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, comboBox2.Text);
         Grid_Load();
     }
     catch (Exception ex)
     {
         Reg_Info _RI = new Reg_Info();
         _RI.Connection.Close();
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
        public void polz_void()
        {
            _RI = new Reg_Info();
            _RI.Set_Connection();
            _RI.Connection.Open();
            SqlCommand PLZ = new SqlCommand("select [id_Polzovatel], [F_Polz], [I_Polz], [O_Polz], [password_Polz], [Pravo_id] " +
                                            "from [Rabochee_Vremya].[dbo].[Polzovatel]", _RI.Connection);
            SqlDataReader tableReader = PLZ.ExecuteReader();
            DataTable     Table       = new DataTable();

            Table.Load(tableReader);
            Program.PLZ = Table;
            _RI.Connection.Close();
        }
Ejemplo n.º 7
0
        public void sotr_void()
        {
            _RI = new Reg_Info();
            _RI.Set_Connection();
            _RI.Connection.Open();
            SqlCommand STR = new SqlCommand("select [id_sotr], [F_sotr], [I_sotr], [O_sotr], [Prihod], [Uxod] " +
                                            "from [Rabochee_Vremya].[dbo].[sotr]", _RI.Connection);
            SqlDataReader tableReader = STR.ExecuteReader();
            DataTable     Table       = new DataTable();

            Table.Load(tableReader);
            Program.STR = Table;
            _RI.Connection.Close();
        }
Ejemplo n.º 8
0
 public void Connection_State()
 {
     _RI = new Reg_Info();
     _RI.Register_get();
     try
     {
         _RI.Connection.Open();
         Status(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         Status(false);
     }
 }
Ejemplo n.º 9
0
 private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         textBox1.Text  = dataGridView2.CurrentRow.Cells[1].Value.ToString();
         textBox2.Text  = dataGridView2.CurrentRow.Cells[2].Value.ToString();
         textBox3.Text  = dataGridView2.CurrentRow.Cells[3].Value.ToString();
         textBox4.Text  = dataGridView2.CurrentRow.Cells[4].Value.ToString();
         comboBox2.Text = dataGridView2.CurrentRow.Cells[5].Value.ToString();
     }
     catch
     {
         Reg_Info _RI = new Reg_Info();
         _RI.Connection.Close();
         MessageBox.Show("Выберите строку, содержащую данные!", "Учет времени!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Ejemplo n.º 10
0
        public void Polz_edit_void(int ID, string FV, string IV, string OV, string PW, string PO)
        {
            _RI = new Reg_Info();
            _RI.Set_Connection();
            _RI.Connection.Open();
            SqlCommand StrPrc = new SqlCommand("Polzovatel_edit", _RI.Connection);

            StrPrc.CommandType = CommandType.StoredProcedure;
            StrPrc.Parameters.AddWithValue("@id_Polzovatel", ID);
            StrPrc.Parameters.AddWithValue("@F_Polz", FV);
            StrPrc.Parameters.AddWithValue("@I_Polz", IV);
            StrPrc.Parameters.AddWithValue("@O_Polz", OV);
            StrPrc.Parameters.AddWithValue("@password_Polz", PW);
            StrPrc.Parameters.AddWithValue("@Pravo_id", PO);
            StrPrc.ExecuteNonQuery();
            _RI.Connection.Close();
        }
Ejemplo n.º 11
0
        public void Sotr_edit_void(int ID, string FV, string IV, string OV, string PR, string UX)
        {
            _RI = new Reg_Info();
            _RI.Set_Connection();
            _RI.Connection.Open();
            SqlCommand StrPrc = new SqlCommand("Sotr_edit", _RI.Connection);

            StrPrc.CommandType = CommandType.StoredProcedure;
            StrPrc.Parameters.AddWithValue("@id_Sotr", ID);
            StrPrc.Parameters.AddWithValue("@f_Sotr", FV);
            StrPrc.Parameters.AddWithValue("@i_Sotr", IV);
            StrPrc.Parameters.AddWithValue("@o_Sotr", OV);
            StrPrc.Parameters.AddWithValue("@Prihod", PR);
            StrPrc.Parameters.AddWithValue("@Uxod", UX);
            StrPrc.ExecuteNonQuery();
            _RI.Connection.Close();
        }
Ejemplo n.º 12
0
 public void Autorization(string user_password)
 {
     try
     {
         _RI = new Reg_Info();
         _RI.Set_Connection();
         //_CmdSql = new SqlCommand(sy_access, _RI.Connection);
         //Program.SYSACCESS = Convert.ToInt32(_CmdSql.ExecuteScalar().ToString());
         _CmdSql = new SqlCommand(find_user + user_password + "'", _RI.Connection);
         _RI.Connection.Open();
         Program.AUTH = Convert.ToInt32(_CmdSql.ExecuteScalar().ToString());
         _RI.Connection.Close();
     }
     catch
     {
         MessageBox.Show("Ошибка авторизации");
     }
 }
Ejemplo n.º 13
0
 public void Get_Base_List()
 {
     _RI = new Reg_Info();
     try
     {
         SqlConnection GDtBsLstCn = new SqlConnection("Data Source = " + Reg_Info.DS + "; Initial Catalog = master; " +
                                                      "Persist Security Info=True; User ID = " + Reg_Info.UN +
                                                      ";Password=\"" + Reg_Info.UP + "\"");
         GDtBsLstCn.Open();
         SqlDataAdapter BsAdpt = new SqlDataAdapter("exec sp_helpdb", GDtBsLstCn);
         DataSet        BDst   = new DataSet();
         BsAdpt.Fill(BDst, "db");
         List_Dbs(BDst);
         _RI.Connection.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }