Пример #1
0
 public Session(string sessionDate, Space.RouteType route)
 {
     this.sessionDate = sessionDate;
     this.route = route;
     customerOrder = new List<CustomerOrder>();
     _customerOrder = null;
 }
Пример #2
0
        public CustomerEditorForm(Space.RouteType routeType)
        {
            InitializeComponent();

            dgvMinHeight = dgvGeneral.Height;
            dgvMinWidth = dgvGeneral.Width;
            txtMinWidth = txtInput.Width;
            btnAddHeighLoc = btnNewProduct.Location.Y;

            this.Text = "เดชาพาณิชย์ - ข้อมูลลูกค้า";
            this.routeType = routeType;

            DataGridViewImageColumn editColumn = new DataGridViewImageColumn();
            editColumn.Image = Image.FromFile("edit-icon.png");
            editColumn.HeaderText = "";
            editColumn.Name = "Edit";
            dgvGeneral.Columns.Add(editColumn);

            DataGridViewImageColumn deleteColumn = new DataGridViewImageColumn();
            deleteColumn.Image = Image.FromFile("delete-icon.png");
            deleteColumn.HeaderText = "";
            deleteColumn.Name = "Delete";
            dgvGeneral.Columns.Add(deleteColumn);

            DataGridViewImageColumn orderUpColumn = new DataGridViewImageColumn();
            orderUpColumn.Image = Image.FromFile("arrow_up.png");
            orderUpColumn.HeaderText = "";
            orderUpColumn.Name = "Up";
            dgvGeneral.Columns.Add(orderUpColumn);

            DataGridViewImageColumn orderDownColumn = new DataGridViewImageColumn();
            orderDownColumn.Image = Image.FromFile("arrow_down.png");
            orderDownColumn.HeaderText = "";
            orderDownColumn.Name = "Down";
            dgvGeneral.Columns.Add(orderDownColumn);

            dgvGeneral.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dgvGeneral.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.Columns[6].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.Columns[7].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvGeneral.RowTemplate.Height = 30;
            dgvGeneral.RowHeadersVisible = false;

            customerList = Space.GetCustomersByRoute(routeType);
            ListAllCustomers();
        }
Пример #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (cbOption.SelectedIndex == -1)
            {
                MessageBox.Show("กรุณาเลือกตัวเลือก ด้วยค่ะ");
                return;
            }

            if (isFirstOption)
            {
                switch (cbOption.SelectedIndex + 1)
                {
                    case (int)Space.RouteType.NgaoPhayao:
                        newRouteData = Space.RouteType.NgaoPhayao;
                        break;
                    case (int)Space.RouteType.SobprabThoen:
                        newRouteData = Space.RouteType.SobprabThoen;
                        break;
                    case (int)Space.RouteType.Jaehom:
                        newRouteData = Space.RouteType.Jaehom;
                        break;
                    case (int)Space.RouteType.Wanghnua:
                        newRouteData = Space.RouteType.Wanghnua;
                        break;
                    case (int)Space.RouteType.Local:
                        newRouteData = Space.RouteType.Local;
                        break;
                    case (int)Space.RouteType.BanFon:
                        newRouteData = Space.RouteType.BanFon;
                        break;
                    default:
                        newRouteData = Space.RouteType.None;
                        break;
                }

                if (isSessionAlreadyExist(newRouteData))
                {
                    MessageBox.Show("รอบบิลดังกล่าวได้ถูกเปิดไว้แล้ว\r\nกรุณากลับไปแก้ไขข้อมูลที่รอบบิลเก่า", "ไม่สามารถสร้างรอบบิลใหม่ได้");
                    return;
                }
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                selectedFile = historyFile[cbOption.SelectedItem.ToString()];
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }

            this.Close();
        }
Пример #4
0
 public SerialObject(Space.RouteType route, 
     List<CustomerInfo> customersList,
     List<Product> productsList,
     List<Product> productsListAmr,
     Session session,
     int defaultTab,
     string date)
 {
     this.route = route;
     this.customersList = customersList;
     this.productsList = productsList;
     this.productsListAmr = productsListAmr;
     this.session = session;
     this.defaultTab = defaultTab;
     this.date = date;
 }
Пример #5
0
        public OrderMakerForm(Space.RouteType route, Space.SessionCommand command, string note)
        {
            InitializeComponent();

            this.Text = "เดชาพาณิชย์";

            ImageList imageList = new ImageList();
            imageList.Images.Add(Bitmap.FromFile("shopping-cart-empty-icon.png"));
            imageList.Images.Add(Bitmap.FromFile("shopping-cart-icon.png"));
            imageList.Images.Add(Bitmap.FromFile("shopping-cart-skip-icon.png"));

            lvCustomerList.StateImageList = imageList;

            // lvCustomerList.FullRowSelect = true;
            // lvCustomerList.GridLines = true;
            lvCustomerList.Sorting = SortOrder.Ascending;
            lvCustomerList.MultiSelect = false;

            lvCustomerList.Items[0].StateImageIndex = 0;
            lvCustomerList.Items[1].StateImageIndex = 1;

            orderMakerFormMinHeight = this.Size.Height;
            orderMakerFormMinWidth = this.Size.Width;
            gbCustomerListMinHeight = gbCustomerList.Height;
            tbContainerMinHeight = tbContainer.Size.Height;
            tbContainerMinWidth = tbContainer.Size.Width;

            tpMinHeight = tpDcp.Size.Height;
            tpMinWidth = tpDcp.Size.Width;

            lbSuggestItemsMinHeight = this.lbMatchedItems.Height;
            lbSuggestItemsMinWidth = this.lbMatchedItems.Width;

            btnClearXLocation = btnClear.Location.X;

            tsDefaultMerchant.Items.Add("เรา");
            tsDefaultMerchant.Items.Add("อาม่า");
            tsDefaultMerchant.SelectedIndex = 0;
            defaultTab = 0;

            this.route = route;

            lbMatchedItems.SelectionMode = SelectionMode.One;

            ///// DCP
            dgvDcp.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvDcp.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvDcp.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvDcp.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            DataGridViewColumn dgvcPrice = new DataGridViewTextBoxColumn();
            dgvcPrice.Visible = false;
            dgvcPrice.Name = "Price";
            dgvcPrice.HeaderText = "Price";

            DataGridViewColumn dgvcMultiplier = new DataGridViewTextBoxColumn();
            dgvcMultiplier.Visible = false;
            dgvcMultiplier.Name = "Multiplier";
            dgvcMultiplier.HeaderText = "Multiplier";

            dgvDcp.Columns.Add(dgvcPrice);
            dgvDcp.Columns.Add(dgvcMultiplier);

            dgvDcp.RowTemplate.MinimumHeight = 30;

            ///// AMR
            dgvAmr.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvAmr.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvAmr.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvAmr.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            DataGridViewColumn dgvcPricedgvAmr = new DataGridViewTextBoxColumn();
            dgvcPricedgvAmr.Visible = false;
            dgvcPricedgvAmr.Name = "Price";
            dgvcPricedgvAmr.HeaderText = "Price";

            DataGridViewColumn dgvcMultiplierdgvAmr = new DataGridViewTextBoxColumn();
            dgvcMultiplierdgvAmr.Visible = false;
            dgvcMultiplierdgvAmr.Name = "Multiplier";
            dgvcMultiplierdgvAmr.HeaderText = "Multiplier";

            dgvAmr.Columns.Add(dgvcPricedgvAmr);
            dgvAmr.Columns.Add(dgvcMultiplierdgvAmr);

            dgvAmr.RowTemplate.MinimumHeight = 30;

            if (command == Space.SessionCommand.EditSession)
            {
                // Load data from session
                IFormatter formatter = new BinaryFormatter();
                Stream stream = new FileStream(note, FileMode.Open, FileAccess.Read, FileShare.Read);
                SerialObject serialObj = (SerialObject)formatter.Deserialize(stream);
                stream.Close();

                this.customersList = serialObj.CustomerList;
                this.productsList = serialObj.ProductList;
                this.productsListAmr = serialObj.ProductListAmr;
                this.session = serialObj.Session;
                this.defaultTab = serialObj.DefaultTab;
                this.route = serialObj.Route;

                ///// Set Topline information
                string[] routeName = Space.GetRouteOption();
                this.labelRouteName.Text = "สาย " + routeName[(int)this.route - 1];
                this.labelSessionDate.Text = serialObj.Date;

                ///// Restored Customer List
                lvCustomerList.Items.Clear();

                for (int i = 0; i < customersList.Count; i++)
                {
                    lvCustomerList.Items.Add(customersList[i].CustomerName, customersList[i].CustomerName, 0);
                    lvCustomerList.Items[i].StateImageIndex = 0;
                }
                gbCustomerList.Text = "รายชื่อ ลูกค้า " + string.Format("({0}/{1})", session.GetNumberOfCustomerWhoHaveOrdered(), customersList.Count);

                lvCustomerList.Items[0].Selected = true;

                UpdateEveryCustomerIcon();
            }
            else
            {
                setTopLineInfo();
                InitializeCustomerList();
                InitializeProductList();
                // Create a new seesion
                session = new Session(labelSessionDate.Text, route);
            }
        }