Exemplo n.º 1
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("Пользователь не найден!");
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
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();
        }
Exemplo n.º 7
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("Ошибка авторизации");
     }
 }