private void Btn_add_Click(object sender, EventArgs e) { if (cbm_en.SelectedIndex != -1) { if (Type == "NEW") { Class_SQL.Execute_Library_En(TypeNme, Type, 0, txt_name.Text, txt_uroven2.Text, txt_uroven3.Text, Convert.ToString(cb_active.Checked), FirstForm.UserName, Convert.ToDecimal(cbm_en.SelectedValue.ToString()), TID); //Form_library.Load_Lib_Dop_Operation(); this.Close(); } else if (Type == "EDIT") { Class_SQL.Execute_Library_En(TypeNme, Type, Key_id, txt_name.Text, txt_uroven2.Text, txt_uroven3.Text, Convert.ToString(cb_active.Checked), FirstForm.UserName, Convert.ToDecimal(cbm_en.SelectedValue.ToString()), TID); //Form_library.Load_Lib_Dop_Operation(); this.Close(); } else if (Type == "COPY") { Class_SQL.Execute_Library_En(TypeNme, Type, Key_id, txt_name.Text, txt_uroven2.Text, txt_uroven3.Text, Convert.ToString(cb_active.Checked), FirstForm.UserName, Convert.ToDecimal(cbm_en.SelectedValue.ToString()), TID); //Form_library.Load_Lib_Dop_Operation(); this.Close(); } } else { MessageBox.Show("Не указана Ед.измерения.", "ABS", MessageBoxButtons.OK); } }
private static string UserName() { Class_SQL.OpenConnection(); IIdentity identity = WindowsIdentity.GetCurrent(); string ManhUser = (identity.Name).Substring(((identity.Name)).IndexOf(@"\") + 1, (identity.Name).Length - (((identity.Name)).IndexOf(@"\") + 1)); return(ManhUser); }
public RegForm() { InitializeComponent(); ComboBox_Reg_Login.AutoCompleteMode = AutoCompleteMode.SuggestAppend; ComboBox_Reg_Login.AutoCompleteSource = AutoCompleteSource.ListItems; Class_SQL.OpenConnection(); this.ComboBox_Reg_Login.Focus(); Class_SQL.LoadComboBox(this.ComboBox_Reg_Login, "select user_name as 'ID', description as 'NAME' from bi.dbo.ABS_USER_PROFILE where active= 'Y' and DOSTUP_ABS = N'Y' order by description asc"); }
private static double ProverkaUser(string UserName) { double Result = 0; Result = Class_SQL.SelectFloat("select count(*) from bi.dbo.ABS_USER_PROFILE where active= 'Y' and user_name=N'" + UserName + "'"); Console.WriteLine("Уровень доступа = " + Result); return(Result); }
private void Form_Library_Add_Load(object sender, EventArgs e) { this.Text = TextForm + FormType; txt_name.Text = Names; txt_uroven2.Text = Uroven2; txt_uroven3.Text = Uroven3; cb_active.Checked = Act; Class_SQL.LoadComboBox(cbm_en, "select KEY_ID as ID ,NAME from bi.dbo.ABS_EN where ACTIVE ='Y' order by NAME"); if (TypeNme == "lib_en") { txt_uroven2.Visible = false; lab_uroven2.Visible = false; cbm_en.Visible = false; lab_en.Visible = false; } else if (TypeNme == "dop_uslugi") { txt_uroven3.Visible = true; lab_uroven3.Visible = true; } else if (TypeNme == "dop_meterial") { txt_uroven3.Visible = false; lab_uroven3.Visible = false; } else if (TypeNme == "dop_operation") { txt_uroven3.Visible = false; lab_uroven3.Visible = false; } if (Type == "NEW") { cbm_en.SelectedIndex = -1; } else { if (TypeNme != "lib_en") { //cbm_en.SelectedValue = EN; } } }
private void Load_Transaction(string Tid) { Console.WriteLine(" tid = " + Tid); Class_SQL.LoadGridDB(DGW_list, "select tid, add_date_time, messanger, USER_NAME from bi.dbo.ABS_TRANSACTION_HISTORY where hdr_tid = N'" + Tid + "' order by tid"); DGW_list.Columns["add_date_time"].HeaderText = "Дата и время изменения"; DGW_list.Columns["tid"].Visible = false; DGW_list.Columns["messanger"].Visible = false; DGW_list.Columns["USER_NAME"].Visible = false; DGW_list.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
public void Load_Lib_EN() { Class_SQL.OpenConnection(); Class_SQL.LoadGridDB(dataGrid_Library, "select KEY_ID as TID,NAME,ACTIVE from bi.dbo.ABS_EN "); Class_SQL.CloseConnection(); dataGrid_Library.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGrid_Library.Columns["NAME"].HeaderText = "Наименование"; dataGrid_Library.Columns["ACTIVE"].HeaderText = "Статус"; dataGrid_Library.Columns["TID"].Visible = false; }
private void Load_User() { if (this.ComboBox_Reg_Login.SelectedIndex != -1) { string stLogin = this.ComboBox_Reg_Login.SelectedValue.ToString().ToLower(); string stPassword = this.Reg_Textbox_Password.Text; if (!string.IsNullOrEmpty(stLogin)) { if (!string.IsNullOrEmpty(stPassword)) { double d = 0; string stPass = null; d = Class_SQL.SelectFloat("select count(*) from bi.dbo.ABS_USER_PROFILE where active= 'Y' and DOSTUP_ABS = N'Y' and USER_NAME = N'" + stLogin + "'"); stPass = Class_SQL.SelectString("select PASSWORD from bi.dbo.ABS_USER_PROFILE where active= 'Y' and DOSTUP_ABS = N'Y' and USER_NAME = N'" + stLogin + "'"); if (stPass == Class_SQL.SelectString("select SNT.dbo.svc_md5_ngen(N'" + stPassword + "')")) { this.Hide(); FirstForm f2 = new FirstForm(stLogin); f2.Show(); } else { MessageBox.Show("Не верно указан логин или пароль.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Reg_Textbox_Password.Focus(); } } else { MessageBox.Show("Поле Пароль не заполнено.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Reg_Textbox_Password.Focus(); } } else { MessageBox.Show("Поле Логин не заполнено.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Reg_Textbox_Password.Focus(); } } else { MessageBox.Show("Поле Логин не заполнено.", "АБС", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ComboBox_Reg_Login.Focus(); } }
public void Load_Lib_Dop_Operation() { Class_SQL.OpenConnection(); Class_SQL.LoadGridDB(dataGrid_Library, "select o.TID, o.NAME, o.DOP_NAME as UROVEN2,e.NAME as NAME_EN ,o.ACTIVE,e.KEY_ID from bi.dbo.ABS_OPERATION o join bi.dbo.ABS_EN e on o.KEY_EN=e.KEY_ID"); Class_SQL.CloseConnection(); dataGrid_Library.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGrid_Library.Columns["NAME"].HeaderText = "Наименование"; dataGrid_Library.Columns["UROVEN2"].HeaderText = " Уровень 2"; dataGrid_Library.Columns["NAME_EN"].HeaderText = "Ед Измерения"; dataGrid_Library.Columns["ACTIVE"].HeaderText = "Статус"; dataGrid_Library.Columns["TID"].Visible = false; dataGrid_Library.Columns["KEY_ID"].Visible = false; }
public void Load_Lib_Dop_Material() { Class_SQL.OpenConnection(); Class_SQL.LoadGridDB(dataGrid_Library, "select m.TID, m.name as NAME , POD_NAME as UROVEN2, e.NAME as NAME_EN,m.ACTIVE, e.KEY_ID from bi.dbo.ABS_MATERIAL m join bi.dbo.ABS_EN e on m.KEY_EN=e.KEY_ID"); Class_SQL.CloseConnection(); dataGrid_Library.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGrid_Library.Columns["NAME"].HeaderText = "Наименование"; dataGrid_Library.Columns["UROVEN2"].HeaderText = " Уровень 2"; dataGrid_Library.Columns["NAME_EN"].HeaderText = "Ед Измерения"; dataGrid_Library.Columns["ACTIVE"].HeaderText = "Статус"; dataGrid_Library.Columns["TID"].Visible = false; dataGrid_Library.Columns["KEY_ID"].Visible = false; }
// Проверка уровня Администратора для снятия ограничения блокировок по заявкам public static int DostupAdmin(string UserName) { int Result = 0; int IdGroup = 0; Class_SQL.OpenConnection(); IdGroup = Convert.ToInt32(Class_SQL.SelectString("select isnull(SECURITY_GROUP_ID,1) from aurora.ils.dbo.USER_PROFILE where USER_NAME = N'" + UserName + "'")); if ((Class_SQL.SelectString("select isnull(SECURITY_GROUP,'n/a' ) from aurora.ils.dbo.SECURITY_GROUP where OBJECT_ID=" + IdGroup)) == "Administrators") { Result = 1; } Class_SQL.CloseConnection(); return(Result); }
private void Button_Add_Service_Add_Click(object sender, EventArgs e) { if (ComboBox_Add_Service_Order_Type.SelectedIndex != -1) { if (ComboBox_Add_Service_Company.SelectedIndex != -1) { if (ComboBox_Add_Service_Warehouse.SelectedIndex != -1) { if (!string.IsNullOrEmpty(TextBox_Add_Service_Number.Text.ToString())) { Class_SQL.Insert_Service(ComboBox_Add_Service_Order_Type.SelectedItem.ToString(), TextBox_Add_Service_Number.Text, ComboBox_Add_Service_Company.SelectedValue.ToString(), ComboBox_Add_Service_Warehouse.SelectedValue.ToString(), TextBox_Add_Service_Osnovanie.Text, TextBox_Add_Service_Messanger.Text, Convert.ToString(DateTimePicker_Add_Service_Date.Value.ToString("yyyy-MM-dd")) + ' ' + DateTimePicker_Add_Service_Time.Text + ":00", FirstForm.UserName ); this.Close(); } else { MessageBox.Show("Поле Номер документа не заполнено.", "ABS : Добавление Сервисной Заявки", MessageBoxButtons.OK); } } else { MessageBox.Show("Поле Склад не заполнено.", "ABS : Добавление Сервисной Заявки", MessageBoxButtons.OK); } } else { MessageBox.Show("Поле Компания не заполнено.", "ABS : Добавление Сервисной Заявки", MessageBoxButtons.OK); } } else { MessageBox.Show("Поле Тип заявки не заполнено.", "ABS : Добавление Сервисной Заявки", MessageBoxButtons.OK); } }
private void Form_Service_Add_Load(object sender, EventArgs e) { Ordernumber = "00000000" + Convert.ToString(Class_SQL.SelectNextNumber()); Ordernumber = "SER-" + RightString(Ordernumber, 9); ComboBox_Add_Service_Order_Type.Items.Clear(); ComboBox_Add_Service_Order_Type.Items.Add("Сервисная заявка"); ComboBox_Add_Service_Order_Type.SelectedItem = "Сервисная заявка"; ComboBox_Add_Service_Order_Type.Enabled = false; TextBox_Add_Service_Number.Text = Ordernumber; DateTimePicker_Add_Service_Date.Value = DateTime.Now; DateTimePicker_Add_Service_Time.Text = "00:00:00"; Class_SQL.LoadComboBox(ComboBox_Add_Service_Company, "select COMPANY as 'ID', DESCRIPTION as 'NAME' from bi.dbo.ABS_COMPANY where ACTIVE='Y' and COMPANY in (" + Class_SQL.StringActivCompany(FirstForm.UserName) + ")"); ComboBox_Add_Service_Company.SelectedIndex = -1; Class_SQL.LoadComboBox(ComboBox_Add_Service_Warehouse, "select WAREHOUSE as 'ID', DESCRIPTION as 'NAME' from bi.dbo.ABS_WAREHOUSE where ACTIVE='Y' and WAREHOUSE in (" + Class_SQL.StringActivWarehouse(FirstForm.UserName) + ")"); ComboBox_Add_Service_Warehouse.SelectedIndex = -1; }
public void Close_form() { this.Close(); Class_SQL.CloseConnection(); }