Beispiel #1
0
        public OrderReviewForm(CustomerInfo custInfo, ref List<OrderedItem> custOrder)
        {
            InitializeComponent();

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

            this.custInfo = custInfo;
            this.custOrder = custOrder;

            this.dgvMinWidth = dataGridView1.Width;
            this.dgvMinHeight = dataGridView1.Height;
            this.btnRefreshDefaultY = buttonRecalculate.Location.Y;
            this.labelTotalDefaultY = labelGrandTotal.Location.Y;

            dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView1.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView1.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridView1.RowTemplate.Height = 30;
            dataGridView1.RowHeadersVisible = false;

            unitIndex = Space.GetUnitIndex();

            SortOrderedItem();
            UpdateDisplay();
            UpdateCalculation();
        }
Beispiel #2
0
 public CustomerOrder(CustomerInfo customer, List<OrderedItem> orderedItem, List<OrderedItem> orderedItemAmr, bool isNotOrder)
 {
     this.customer = customer;
     items = orderedItem;
     itemsAmr = orderedItemAmr;
     this.isNotOrder = isNotOrder;
 }
Beispiel #3
0
        public List<OrderedItem> GetCustomerOrderAmr(CustomerInfo custInfo)
        {
            if (customerOrder.Count == 0)
                return null;

            var res = customerOrder.Where(e => e.CustomerName == custInfo.CustomerName).SingleOrDefault();

            if (res == null)
                return null;

            return res.GetOrderedListAmr();
        }
        public CustomerInfoEditorForm(CustomerInfo custInfo)
        {
            InitializeComponent();

            cbCustType.Items.Add("เงินสด");
            cbCustType.Items.Add("เก่าไปใหม่มา");
            cbCustType.SelectedIndex = 0;

            isEditMode = true;

            txtCustName.Text = custInfo.CustomerName;
            txtCustContact.Text = custInfo.PhoneNumber;

            if (custInfo.PaymentType == "เงินสด")
                cbCustType.SelectedIndex = 0;
            else if (custInfo.PaymentType == "เก่าไปใหม่มา")
                cbCustType.SelectedIndex = 1;
            else
                throw new Exception("Shouldn't reach this area");
        }
Beispiel #5
0
        public bool GetCustomerSkipNotification(CustomerInfo custInfo)
        {
            if (customerOrder.Count == 0)
                return false;

            var res = customerOrder.Where(e => e.CustomerName == custInfo.CustomerName).SingleOrDefault();

            if (res == null)
                return false;

            return res.IsSkip;
        }
Beispiel #6
0
        public void SaveCustomerOrder(CustomerInfo custInfo, List<OrderedItem> orderedList, List<OrderedItem> orderedListAmr, bool isNotOrder)
        {
            CustomerOrder res = null;
            if (customerOrder.Count > 0)
                res = customerOrder.Where(e => e.CustomerName == custInfo.CustomerName).SingleOrDefault();

            // Check weather customer order of certain client already exist

            if (res != null)
            {
                // Customer have existing record
                int idx = customerOrder.IndexOf(res);
                customerOrder[idx].SetOrderedList(orderedList, orderedListAmr, isNotOrder);
            }
            else
            {
                customerOrder.Add(new CustomerOrder(custInfo, orderedList, orderedListAmr, isNotOrder));
            }
        }