Esempio n. 1
1
 public SquadForm(DbConnect postgreConnect, DataSet globalDS, int squadID = -1)
 {
     InitializeComponent();
     cbColumn = new DataGridViewCheckBoxColumn();
     cbColumn.HeaderText = "Является сотрудником отряда";
     cbColumn.DataPropertyName = "is_in_squad";
     cbColumn.FillWeight = 40;
     cbColumn.ReadOnly = false;
     dataSet1 = globalDS;
     postgreConnection = postgreConnect;
     squadSelectBS.DataSource = dataSet1.Tables["squad"];
     listBox1.DataSource = dataSet1.Tables["squad"];
     listBox1.DisplayMember = "name";
     listBox1.ValueMember = "id";
     initEnd = true;
     if (listBox1.SelectedValue != null)
         ChangeSelectedSquad(int.Parse(listBox1.SelectedValue.ToString()));
     else
         DeactivateAllButtons();
     SetButtonPermissions();
     if (squadID != -1)
         listBox1.SelectedValue = squadID;
     bindingNavigator2.BindingSource = selectionsDataBS;
     bindingNavigator1.BindingSource = employeesAddBS;
     dataGridView1.DataSource = selectionsDataBS;
 }
Esempio n. 2
0
        public CustomerForm(DbConnect postgreConnection, DataSet globalDS, int selectedCustID=-1)
        {
            isStart = true;
            InitializeComponent();
            dataSet1 = globalDS;
            this.postgreConnection = postgreConnection;
            listBoxBS.DataSource = dataSet1.Tables["customer"];
            listBox1.DataSource = listBoxBS;
            listBox1.ValueMember = "id";
            listBox1.DisplayMember = "name";
            bindingNavigator1.BindingSource = ordersBS;
            dataGridView1.DataSource = ordersBS;
            isStart = false;

            if (selectedCustID != -1)
                listBox1.SelectedValue = selectedCustID;
            else
                if (listBox1.Items.Count > 0)
                    listBox1.SelectedIndex = 0;
            listBox1_SelectedIndexChanged(null, null);
            bindingNavigator2.BindingSource = avWork;
            listBox2.DataSource = avWork;
            listBox3.DataSource = avSquads;

            bindingNavigator3.BindingSource = avSquads;
        }
Esempio n. 3
0
 public void DrawNew(string formName, DbConnect postgreConnection,string what,string from,string args, string chartTitle, string yAxisTitle)
 {
     chart1.Legends.Clear();
     chart1.Series.Clear();
     chart1.Titles.Clear();
     GenerateData(formName, postgreConnection, what, from, args, chartTitle, yAxisTitle);
 }
Esempio n. 4
0
 public DbUserListForm(DbConnect pgc)
 {
     InitializeComponent();
     postgreConnection = pgc;
     dataGridView1.DataSource = bs;
     bindingNavigator1.BindingSource = bs;
     DrawData();
 }
Esempio n. 5
0
 public OrderSelectionForm(DbConnect postgreConnection,DataSet gds)
 {
     InitializeComponent();
     pgc = postgreConnection;
     bindingNavigator1.BindingSource = bs;
     dataGridView1.DataSource = bs;
     this.gds = gds;
     DrawAllOrders();
 }
Esempio n. 6
0
 public SquadSelectionForm(string formName, DbConnect postgreConnection, DataSet globalDS)
 {
     InitializeComponent();
     bindingNavigator1.BindingSource = dataSourceBind;
     dataGridView1.DataSource = dataSourceBind;
     this.postgreConnection = postgreConnection;
     radioButton1.Checked = true;
     dataSet1 = globalDS;
 }
Esempio n. 7
0
 public OrderChartForm(DbConnect postgreConnection, string from="orders order by work_end_date",string formName="Доход/Расход")
 {
     InitializeComponent();
     comboBox1.SelectedIndex = 0;
     chart1.Titles.Add("График доходов/расходов на заказы");
     if (formName == "Доход/Расход")
         button3.Enabled = false;
     DrawData(-1, -1, postgreConnection, from);
     postGreConn = postgreConnection;
     this.Text = formName;
 }
Esempio n. 8
0
 public PositionsForm(DbConnect pgc, DataSet globalDS)
 {
     InitializeComponent();
     dataSet1 = globalDS;
     postgreConnection = pgc;
     bs.DataSource = dataSet1.Tables["position"];
     bindingNavigator1.BindingSource = bs;
     dataGridView1.DataSource = bs;
     FunctionsClass.TranslateDataGridViewHeaderTexts(dataGridView1);
     FunctionsClass.GenerateComboBoxItems(toolStripComboBox1, dataGridView1);
 }
Esempio n. 9
0
 public EmployeeTableForm(DbConnect postgreConnection, DataSet globalDS)
 {
     InitializeComponent();
     data = globalDS;
     bindingNavigator1.BindingSource = bs;
     dataGridView1.DataSource = bs;
     this.postgreConnection = postgreConnection;
     RefreshBS();
     FunctionsClass.TranslateDataGridViewHeaderTexts(dataGridView1);
     FunctionsClass.GenerateComboBoxItems(toolStripComboBox1, dataGridView1);
 }
Esempio n. 10
0
 //true = cust 1-last 2-current 3- future
 public MyOrdersForm(DbConnect pgc,int empID,int dataType, bool empType)
 {
     InitializeComponent();
     this.postgreConnection = pgc;
     this.empID = empID;
     this.empType = empType;
     this.dataType = dataType;
     bindingNavigator2.BindingSource = bs;
     dataGridView1.DataSource = bs;
     DrawData();
 }
Esempio n. 11
0
 public EmployeeForm(DbConnect pgc, DataSet ds)
 {
     InitializeComponent();
     postgreConnection = pgc;
     data = ds;
     bindingNavigator1.BindingSource = bs;
     bindingNavigator2.BindingSource = squadBs;
     RefreshEmployeeList();
     listBox1.DataSource = empBs;
     listBox1.DisplayMember = "data";
     listBox1.ValueMember = "id";
     dataGridView1.DataSource = bs;
 }
Esempio n. 12
0
        public MainForm(LoginForm parentForm,ref DbConnect init)
        {
            InitializeComponent();
            this.parentForm = parentForm;
            securedFuncs = new List<toolStripMenuItemWithAccessLevel>();
            postgreConnection = init;
            ChangeAccess();
            try
            {
                globalDS = postgreConnection.GetDBData();
            }
            catch
            {

            }
        }
Esempio n. 13
0
 public AddDbUserForm(DbConnect dbc)
 {
     InitializeComponent();
     for (int i =access_level_start_index;i<=dbc.CurrUser.AccessLevel;i++)
     {
         this.comboBox1.Items.Add(i);
     }
     if(comboBox1.Items.Count>0)
         comboBox1.SelectedIndex=0;
     if (comboBoxWithInputCheck1.Items.Count > 0)
         comboBoxWithInputCheck1.SelectedIndex = 0;
     dbc.SelectFrom("*", "employee_customer_selection", dt);
     comboBoxWithInputCheck1.DataSource = dt;
     comboBoxWithInputCheck1.ValueMember = "id";
     comboBoxWithInputCheck1.DisplayMember = "data";
     this.postgreConnection = dbc;
 }
Esempio n. 14
0
 public OrderForm(DbConnect postgreConnection, DataSet globalDS, int selectedOrderID=-1)
 {
     isStart = true;
     InitializeComponent();
     dataSet1 = globalDS;
     this.postgreConnection = postgreConnection;
     listBoxBS.DataSource = dataSet1.Tables["orders"];
     listBox1.DataSource = listBoxBS;
     listBox1.ValueMember = "id";
     listBox1.DisplayMember = "caption";
     isStart = false;
     if (selectedOrderID != -1)
         listBox1.SelectedValue = selectedOrderID;
     else
         if (listBox1.Items.Count > 0)
             listBox1.SelectedIndex = 0;
     listBox1_SelectedIndexChanged(null, null);
 }
Esempio n. 15
0
 private void GenerateData(string formName, DbConnect postgreConnection, string what, string from, string args, string chartTitle, string yAxisTitle)
 {
     DataTable dt = new DataTable();
     this.Text = formName;
     int currSerial = 0;
     chart1.ChartAreas[0].RecalculateAxesScale();
     chart1.ChartAreas[0].AxisY.Title = yAxisTitle;
     postgreConnection.SelectFromFunc(what, from, args, dt);
     chart1.Titles.Add(chartTitle);
     chart1.ChartAreas[0].AxisX.LabelStyle.Enabled = false;
     foreach (DataRow dr in dt.Rows)
     {
         chart1.Legends.Add(dr.ItemArray[0].ToString());
         chart1.Series.Add(dr.ItemArray[0].ToString());
         chart1.Series[currSerial].Points.AddY(dr.ItemArray[1]);
         currSerial++;
     }
 }
Esempio n. 16
0
 public WorkForm(DbConnect pgc, DataSet globalDS, int workID=-1)
 {
     InitializeComponent();
     this.postgreConnection = pgc;
     dataSet1 = globalDS;
     workBS.DataSource = dataSet1.Tables["work"];
     ordersBindingNavigator.BindingSource = ordersListBS;
     ordersDataGridView.DataSource = ordersListBS;
     addMaterialDataGridView.DataSource = addMaterialBS;
     addMaterialBindingNavigator.BindingSource = addMaterialBS;
     listBox1.DataSource = workBS;
     listBox1.DisplayMember = "name";
     listBox1.ValueMember = "id";
     if(workID!=-1)
     {
         listBox1.SelectedValue = workID;
     }
 }
Esempio n. 17
0
        public void DrawData(int oper, double number, DbConnect pgc, string from,string formName =null)
        {
            if (formName != null)
            {
                this.Text = formName;
                button3.Enabled = true;
            }
            bool compRes = false;
            chart1.Series.Clear();
            Series sIncome = new Series(), sExpenses = new Series();
            sIncome.ChartType = sExpenses.ChartType = SeriesChartType.Line;
            DataTable dt = new DataTable();
            DataPoint dp = new DataPoint();
            DataTable ordersTable = new DataTable();
            pgc.SelectFrom("*", from, ordersTable);
            sIncome.LegendText = "Доход";
            sIncome.Color = Color.Blue;
            sExpenses.Color = Color.Red;
            sExpenses.LegendText = "Расход";
            foreach (DataRow dr in ordersTable.Rows)
            {
                dp = new DataPoint();
                dp.Color = Color.Blue;
                dp.MarkerSize = 5;
                dp.MarkerColor = Color.Blue;
                dp.MarkerStyle = MarkerStyle.Circle;
                dp.IsEmpty = false;
                pgc.SelectFromFunc("*", "order_expenses_income", dr.ItemArray[0].ToString(), dt);
                if (oper != -1 && number > 0)
                    if (Compare(oper, number, dt.Rows[0].ItemArray[0]) && Compare(oper, number, dt.Rows[0].ItemArray[1]))
                        compRes = true;
                    else
                        compRes = false;
                if ((compRes) || (oper == -1 && number ==-1))
                {
                    try
                    {
                        dp.SetValueXY(DateTime.Parse(dr.ItemArray[6].ToString()), dt.Rows[0].ItemArray[0]);
                        dp.Label = DateTime.Parse(dr.ItemArray[6].ToString()).ToShortDateString() + " " + dr.ItemArray[9].ToString();
                        sIncome.Points.Add(dp);
                    }
                    catch
                    {

                    }
                    dp = new DataPoint();
                    dp.Color = Color.Red;
                    dp.MarkerSize = 5;
                    dp.MarkerColor = Color.Red;
                    dp.MarkerStyle = MarkerStyle.Circle;
                    dp.IsEmpty = false;
                    dp.SetValueXY(DateTime.Parse(dr.ItemArray[6].ToString()), dt.Rows[0].ItemArray[1]);
                    dp.Label = DateTime.Parse(dr.ItemArray[6].ToString()).ToShortDateString() + " " + dr.ItemArray[9].ToString();
                    sExpenses.Points.Add(dp);
                }
                dt.Clear();
            }
            sExpenses.XValueType = ChartValueType.Date;
            sIncome.XValueType = ChartValueType.Date;
            //chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, 10);
            chart1.Series.Add(sExpenses);
            chart1.Series.Add(sIncome);
            chart1.ChartAreas[0].RecalculateAxesScale();
        }
Esempio n. 18
0
 /// <summary>
 /// data = [series] [value]
 /// </summary>
 /// <param name="formName"></param>
 /// <param name="data"></param>
 public ChartForm(string formName, DbConnect postgreConnection,string what,string from,string args, string chartTitle, string yAxisTitle)
 {
     InitializeComponent();
     GenerateData(formName, postgreConnection, what, from, args, chartTitle, yAxisTitle);
 }
Esempio n. 19
0
 public LoginForm()
 {
     InitializeComponent();
     FunctionsClass.Initialize();
     postgreConnection = new DbConnect();
 }