Пример #1
0
        public void SalesMainForm()
        {
            try
            {
                tabControlSales = xtraTabControlSalesContent;

                MainTabPageAddCustomer    = new XtraTabPage();
                MainTabPageUpdateCustomer = new XtraTabPage();
                MainTabPagePrintCustomer  = new XtraTabPage();

                EmpBranchId = UserControl.UserBranch(dbconnection);

                SpecialOrdersFunction();

                //Calculate the time of the actual work of the delegates
                timer.Interval = 1000 * 60;
                timer.Tick    += new EventHandler(GetNonRequestedSpecialOrders);
                timer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            dbconnection.Close();
        }
Пример #2
0
        //private void gridView1_RowStyle(object sender, RowStyleEventArgs e)
        //{
        //    try
        //    {
        //        GridView View = sender as GridView;
        //        if (e.RowHandle >= 0)
        //        {
        //            string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["Error"]);
        //            if (category == "1")
        //            {
        //                e.Appearance.BackColor = Color.Salmon;
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        MessageBox.Show(ex.Message);
        //    }
        //}

        //functions
        public void search()
        {
            PSloaded         = false;
            DelegateBranchID = UserControl.UserBranch(conn);
            //if (delegateID == -1)
            //{
            //    delegateID = -1;
            //}

            conn.Open();
            string           query = "select * from delegate where Branch_ID=" + DelegateBranchID;
            MySqlDataAdapter da    = new MySqlDataAdapter(query, conn);
            DataTable        dt    = new DataTable();

            da.Fill(dt);
            comDelegate.DataSource    = dt;
            comDelegate.DisplayMember = dt.Columns["Delegate_Name"].ToString();
            comDelegate.ValueMember   = dt.Columns["Delegate_ID"].ToString();
            //comDelegate.SelectedIndex = delegateID;

            comDelegate.SelectedValue = delegateID;
            txtBillNum.Text           = billNum.ToString();

            query = "select * from customer";
            da    = new MySqlDataAdapter(query, conn);
            dt    = new DataTable();
            da.Fill(dt);
            comCustomer.DataSource    = dt;
            comCustomer.DisplayMember = dt.Columns["Customer_Name"].ToString();
            comCustomer.ValueMember   = dt.Columns["Customer_ID"].ToString();
            conn.Close();

            loadFunc();

            PSloaded = true;
            //GridColumn colBillNumber = gridView1.Columns["Bill_Number"];
            //gridView1.BeginSort();
            //gridView1.ClearGrouping();
            //colBillNumber.GroupIndex = 0;
            //gridView1.EndSort();
        }
Пример #3
0
 private void Commitment_Report_Load(object sender, EventArgs e)
 {
     try
     {
         string query = "select * from delegate where Branch_ID=" + UserControl.UserBranch(conn) + " and Error=0";
         conn.Open();
         MySqlDataAdapter da = new MySqlDataAdapter(query, conn);
         DataTable dt = new DataTable();
         da.Fill(dt);
         comDelegate.DataSource = dt;
         comDelegate.DisplayMember = dt.Columns["Delegate_Name"].ToString();
         comDelegate.ValueMember = dt.Columns["Delegate_ID"].ToString();
         comDelegate.Text = "";
         conn.Close();
         loaded = true;
     }
     catch(Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #4
0
 private void CustomerReturnBill_Load(object sender, EventArgs e)
 {
     try
     {
         string           query = "select * from branch";
         MySqlDataAdapter da    = new MySqlDataAdapter(query, dbconnection);
         DataTable        dt    = new DataTable();
         da.Fill(dt);
         comBranch.DataSource    = dt;
         comBranch.DisplayMember = dt.Columns["Branch_Name"].ToString();
         comBranch.ValueMember   = dt.Columns["Branch_ID"].ToString();
         comBranch.Text          = "";
         txtBranchID.Text        = "";
         comBranchLoaded         = true;
         EmpBranchId             = UserControl.UserBranch(dbconnection);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #5
0
        public SpecialOrders_Report()
        {
            InitializeComponent();
            conn             = new MySqlConnection(connection.connectionString);
            MainTabControlPS = MainForm.tabControlSales;

            //panelAddCustomer = new Panel();
            //panelUpdateCustomer = new Panel();
            //panelPrintCustomer = new Panel();

            gridcontrol = gridControl1;

            EmpBranchId = UserControl.UserBranch(conn);

            //gridView1.PostEditor();
            //gridView1.UpdateCurrentRow();
            gridView1.OptionsBehavior.EditingMode          = DevExpress.XtraGrid.Views.Grid.GridEditingMode.EditFormInplace;
            gridView1.OptionsEditForm.CustomEditFormLayout = new AdvancedEditForm(EmpBranchId);
            //gridView1.ShowInplaceEditForm();
            //gridView1.OptionsBehavior.EditingMode = DevExpress.XtraGrid.Views.Grid.GridEditingMode.Default;
        }
Пример #6
0
        //review
        public void test(int DelegateId, int BillNum)
        {
            int          count = 0;
            string       query = "SELECT dash_details.Data_ID FROM dash_details INNER JOIN dash ON dash.Dash_ID = dash_details.Dash_ID where dash.Bill_Number=" + BillNum + " and dash.Branch_ID=" + UserControl.UserBranch(conn);
            MySqlCommand com   = new MySqlCommand(query, conn);

            conn.Open();
            MySqlDataReader dr = com.ExecuteReader();

            while (dr.Read())
            {
                count++;
            }
            labelNotify.Text = (count).ToString();
            if (Convert.ToInt16(labelNotify.Text) > 0)
            {
                labelNotify.Visible = true;
                //delegateID = DelegateId;
                //billNum = BillNum;
            }
            else
            {
                labelNotify.Visible = false;
                //delegateID = 0;
                //billNum = 0;
            }
            delegateID = DelegateId;
            billNum    = BillNum;
            dr.Close();
            conn.Close();
        }
Пример #7
0
        private void LoadGridData()
        {
            EmpBranchId = UserControl.UserBranch(dbconnection);
            //and delegate.Error=0
            dbconnection.Open();
            MySqlCommand adapter = new MySqlCommand("SELECT delegate.Delegate_ID,delegate.Delegate_Name FROM delegate where delegate.Branch_ID=" + EmpBranchId + "", dbconnection);

            dr = adapter.ExecuteReader();

            BindingList <GridData> lista = new BindingList <GridData>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    lista.Add(new GridData()
                    {
                        DelegateId = Convert.ToInt16(dr["Delegate_ID"].ToString()), DelegateName = dr["Delegate_Name"].ToString(), StatusID = "-1"
                    });
                }
                dr.Close();
            }
            gridControl1.DataSource = lista;
            dbconnection.Close();

            if (gridView1.IsLastVisibleRow)
            {
                gridView1.FocusedRowHandle = gridView1.RowCount - 1;
            }

            List <ComboData> lista_combo = new List <ComboData>();

            lista_combo.Add(new ComboData()
            {
                StatusId = 1, Status = "متاح"
            });
            lista_combo.Add(new ComboData()
            {
                StatusId = 2, Status = "مشغول"
            });
            lista_combo.Add(new ComboData()
            {
                StatusId = 3, Status = "استراحة"
            });
            lista_combo.Add(new ComboData()
            {
                StatusId = 4, Status = "انصراف"
            });

            repositoryItemLookUpEdit1.DataSource    = lista_combo;
            repositoryItemLookUpEdit1.DisplayMember = "Status";
            repositoryItemLookUpEdit1.ValueMember   = "StatusId";

            repositoryItemLookUpEdit1.Columns.Clear();
            repositoryItemLookUpEdit1.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo()
            {
                Caption = "الحالة", FieldName = "Status"
            });
            repositoryItemLookUpEdit1.EditValueChanged += repositoryItemLookUpEdit1_EditValueChanged;
            //repositoryItemLookUpEdit1.Closed += repositoryItemLookUpEdit1_Closed;

            gridView1.Columns[3].ColumnEdit = repositoryItemButtonEdit1;
        }
        public void search()
        {
            try
            {
                string query = "";
                if (comDelegate.Text != "")
                {
                    query = "SELECT dash.Delegate_Name as 'المندوب',dash.Bill_Number as 'الفاتورة',dash.Bill_Time as 'الوقت المستغرق' FROM dash where DATE_FORMAT(dash.Bill_Date,'%Y-%m-%d') between '" + this.dateTimePicker1.Value.ToString("yyyy-MM-dd") + "' and '" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd") + "' and dash.Delegate_ID=" + comDelegate.SelectedValue.ToString();
                }
                else
                {
                    query = "SELECT dash.Delegate_Name as 'المندوب',dash.Bill_Number as 'الفاتورة',dash.Bill_Time as 'الوقت المستغرق' FROM dash where DATE_FORMAT(dash.Bill_Date,'%Y-%m-%d') between '" + this.dateTimePicker1.Value.ToString("yyyy-MM-dd") + "' and '" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd") + "' and dash.Branch_ID=" + UserControl.UserBranch(conn);
                }

                conn.Open();
                MySqlDataAdapter adpt = new MySqlDataAdapter(query, conn);
                DataSet          dset = new DataSet();
                adpt.Fill(dset);
                gridControl1.DataSource = dset.Tables[0];
                //gridView1.Columns[0].Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conn.Close();
        }
Пример #9
0
        public void search()
        {
            try
            {
                string query = "";
                if (comDelegate.Text != "")
                {
                    query = "select Attendance_ID as 'التسلسل', Name as 'المندوب', Absence_Date as 'تاريخ الغياب' from attendance where DATE_FORMAT(Absence_Date,'%Y-%m-%d') between '" + this.dateTimePicker1.Value.ToString("yyyy-MM-dd") + "' and '" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd") + "' and Delegate_ID=" + comDelegate.SelectedValue.ToString() + " and Absence_Date is not null and Error=0";
                }
                else
                {
                    query = "select Attendance_ID as 'التسلسل', Name as 'المندوب', Absence_Date as 'تاريخ الغياب' from attendance INNER JOIN delegate ON attendance.Delegate_ID = delegate.Delegate_ID where DATE_FORMAT(Absence_Date,'%Y-%m-%d') between '" + this.dateTimePicker1.Value.ToString("yyyy-MM-dd") + "' and '" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd") + "' and delegate.Branch_ID=" + UserControl.UserBranch(conn) + " and Absence_Date is not null and attendance.Error=0";
                }

                conn.Open();
                MySqlDataAdapter adpt = new MySqlDataAdapter(query, conn);
                DataSet          dset = new DataSet();
                adpt.Fill(dset);
                gridControl1.DataSource      = dset.Tables[0];
                gridView1.Columns[0].Visible = false;

                txtSum.Visible = true;
                label4.Visible = true;
                txtSum.Text    = "";
                txtSum.Text    = (gridView1.RowCount).ToString();
                //btnDelete.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conn.Close();
        }
        public void search()
        {
            string query = "SELECT dash_delegate_bill.Delegate_ID,dash_delegate_bill.Delegate_Name as 'المندوب',dash_delegate_bill.Bill_Number as 'الفاتورة' FROM dash_delegate_bill where dash_delegate_bill.Branch_ID=" + UserControl.UserBranch(conn);

            conn.Open();
            MySqlDataAdapter adpt = new MySqlDataAdapter(query, conn);
            DataSet          dset = new DataSet();

            adpt.Fill(dset);
            gridControl1.DataSource      = dset.Tables[0];
            gridView1.Columns[0].Visible = false;
            conn.Close();
        }