示例#1
0
        private void ApplyStrategy(string identifier, string line)
        {
            switch (identifier)
            {
            case "001":
                _contextStrategy.SetStrategy(new SalesmanStrategy());
                var salesman = (Salesman)_contextStrategy.ApplyStrategy(line);
                SalesmanList.Add(salesman);
                Output.SalesmanQuantityUpdate(1);
                break;

            case "002":
                Output.CustomerQuantityUpdate(1);
                break;

            case "003":
                _contextStrategy.SetStrategy(new SaleStrategy());
                var sale = (Sale)_contextStrategy.ApplyStrategy(line);
                SaleList.Add(sale);
                break;

            default:
                break;
            }
        }
示例#2
0
        public void LoadCustomerList(SalesmanList list)
        {
            string sql = "SELECT [SLSMCODE],[SLSMNAME],[SLSMADDRESS],[SLSMTELP],[SLSMSUPV],[SLSMPHOTO],[STAT] FROM [OTF_Invoice].[dbo].[SALESMAN]";

            DataSet dataSet = DataProvider.GetDataSet(sql);

            //Creaete variable for dataSet table
            DataTable customerTabel = dataSet.Tables[0];

            SalesmanItem nextCustomer = null;

            foreach (DataRow parentRow in customerTabel.Rows)
            {
                nextCustomer = new SalesmanItem();

                nextCustomer.SlsmCode    = parentRow["SLSMCODE"].ToString();
                nextCustomer.SlsmName    = parentRow["SLSMNAME"].ToString();
                nextCustomer.SlsmAddress = parentRow["SLSMADDRESS"].ToString();
                nextCustomer.SlsmTelp    = parentRow["SLSMTELP"].ToString();
                nextCustomer.SlsmSupv    = parentRow["SLSMSUPV"].ToString();
                nextCustomer.SlsmPhoto   = parentRow["SLSMPHOTO"].ToString();
                nextCustomer.Stat        = Convert.ToBoolean(parentRow["STAT"]);

                list.Add(nextCustomer);
            }

            dataSet.Dispose();
        }