Beispiel #1
0
        public void FillWorkOrderList()
        {
            List <string[]> lineItemData = DataLayer.GetTableData("WorkOrder");

            string[]        columns       = { "WorkOrder_ID", "dateRequired", "Customer_customer_ID", "Quantity" };
            List <string[]> workOrderData = DataLayer.GetTableData("WorkOrder", columns);

            foreach (String[] row in workOrderData)
            {
                string[] columns1 = { "STLProduct_STLProduct_ID" };
                DataLayer.RemoveCriteria();
                DataLayer.SetCriteria("WorkOrder_WorkOrder_ID", row[0]);
                List <string[]> workOrderData1 = DataLayer.GetTableData("WorkOrder_has_STLProduct", "WorkOrder", columns1);

                foreach (String[] row1 in workOrderData1)
                {
                    Guid uid = Guid.NewGuid();
                    GenericFactory <IWorkOrder> .Register(uid, () => new WorkOrder(Convert.ToInt16(row[0]), Convert.ToInt16(row[2]), Convert.ToInt16(row1[0]), Convert.ToInt16(row[3]), DateTime.ParseExact(row[1], "dd/MM/yyyy", null)));

                    IWorkOrder workOrder = GenericFactory <IWorkOrder> .Create(uid);

                    workOrderList.Add(workOrder);
                }
            }
        }
Beispiel #2
0
        public void FillProductList()
        {
            int             i           = 0;
            List <string[]> productData = DataLayer.GetTableData("STLProduct");

            foreach (String[] row in productData)
            {
                Guid uid = Guid.NewGuid();
                DataLayer.RemoveCriteria();
                DataLayer.SetCriteria("RawMaterial_ID", "RawMaterial_RawMaterial_ID");
                DataLayer.SetCriteria("STLProduct_STLProduct_ID", row[0]);
                List <string[]> rawMaterials = DataLayer.GetTableData("STLProduct_has_RawMaterial", "RawMaterial", new string[] { "materialName", "Quantity" });
                string[,] materials = new string[rawMaterials.Count, 2];
                foreach (String[] mat in rawMaterials)
                {
                    materials[i, 0] = mat[0];
                    materials[i, 1] = mat[1];
                    i++;
                }
                GenericFactory <IProduct> .Register(uid, () => new Product(Convert.ToInt16(row[0]), row[1], row[2], Convert.ToDouble(row[3]), Convert.ToDouble(row[4]), materials));

                IProduct product = GenericFactory <IProduct> .Create(uid);

                ProductList.Add(product);
                i = 0;
            }
        }
Beispiel #3
0
        public static void AddLineItem(int lineid, int qty, double unitPrice, double linePrice, double vat, int productID)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <ILineItem> .Register(uid, () => new LineItem( lineid, qty, unitPrice, linePrice, vat, productID));

            ILineItem line = GenericFactory <ILineItem> .Create(uid);

            _data.AddRow("STL_LineItem", new string[] { "Quantity", "UnitPrice", "LinePrice", "VAT", "STLProduct_ID" }, new string[] { qty.ToString(), unitPrice.ToString(), linePrice.ToString(), vat.ToString(), productID.ToString() });
            model.FillLineItemList();
        }
Beispiel #4
0
        public static void AddProduct(int prodID, string prodName, string prodInstructions, double price, double vat)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <IProduct> .Register(uid, () => new Product(prodID, prodName, prodInstructions, price, vat));

            ILineItem line = GenericFactory <ILineItem> .Create(uid);

            _data.AddRow("STLProduct", new string[] { "STLProduct_ID", "productName", "manufacturingInstructions", "productPrice", "VAT" }, new string[] { prodID.ToString(), prodName, prodInstructions, price.ToString(), vat.ToString() });
            model.FillProductList();
        }
Beispiel #5
0
        public static void AddCustomProduct(int prodId, string productName, string productDescription, int quantity, int rfqId)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <IProduct> .Register(uid, () => new Product(prodId, productName, productDescription, quantity, rfqId));

            IProduct prod = GenericFactory <IProduct> .Create(uid);

            _data.AddRow("CustomProduct", new string[] { "CustomProduct_ID", "productName", "description", "quantity", "Rfq_ID" }, new string[] { prodId.ToString(), productName, productDescription, quantity.ToString(), rfqId.ToString() });
            model.FillUserList();
        }
        public static void AddMaterial(int MatID, string MatName, string MatDescription)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <IMaterial> .Register(uid, () => new Material(MatID, MatName, MatDescription));

            IMaterial mat = GenericFactory <IMaterial> .Create(uid);

            _data.AddRow("RawMaterial", new string[] { "RawMaterial_ID", "materialName", "materialDescription" }, new string[] { MatID.ToString(), MatName, MatDescription });
            model.FillMaterialsList();
        }
Beispiel #7
0
        public static void AddCustomer(int customer_ID, string custFirstName, string custLastName, string custCompanyName, string custPhoneNum, string[] custAddress)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <ICustomer> .Register(uid, () => new Customer(customer_ID, custFirstName, custLastName, custCompanyName, custPhoneNum, custAddress));

            ICustomer cus = GenericFactory <ICustomer> .Create(uid);

            _data.AddRow("Customer", new string[] { "customer_ID", "custFirstName", "custLastName", "custCompanyName", "custPhoneNum", "custAddress", "custAddLine2", "custCounty" }, new string[] { customer_ID.ToString(), custFirstName, custLastName, custCompanyName, custPhoneNum, custAddress[0], custAddress[1], custAddress[2] });
            model.FillCustomerList();
        }
Beispiel #8
0
        public static void AddEmployee(int employeeID, string firstName, string lastName, string phoneNum, int deptId, int userId)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <IEmployee> .Register(uid, () => new Employee(employeeID, firstName, lastName, phoneNum, deptId, userId));

            IEmployee emp = GenericFactory <IEmployee> .Create(uid);

            _data.AddRow("Employee", new string[] { "employee_ID", "empFirstName", "empLastName", "empPhoneNum", "department_ID", "User_user_ID" }, new string[] { employeeID.ToString(), firstName, lastName, phoneNum, deptId.ToString(), userId.ToString() });
            model.FillEmployeeList();
        }
Beispiel #9
0
        public static void AddUser(int userId, string username, string password)
        {
            Guid uid = Guid.NewGuid();

            GenericFactory <IUser> .Register(uid, () => new User(userId, username, password));

            IUser user = GenericFactory <IUser> .Create(uid);

            _data.AddRow("Users", new string[] { "user_ID", "userName", "password" }, new string[] { userId.ToString(), username, password });
            model.FillUserList();
        }
Beispiel #10
0
        public void FillCustomProductList()
        {
            List <string[]> customProductData = DataLayer.GetTableData("CustomProduct");

            foreach (String[] row in customProductData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <IProduct> .Register(uid, () => new Product(Convert.ToInt16(row[0]), row[1], row[2], Convert.ToInt16(row[3]), Convert.ToInt16(row[4])));

                IProduct customProduct = GenericFactory <IProduct> .Create(uid);

                customProductList.Add(customProduct);
            }
        }
Beispiel #11
0
        public void FillEmployeeList()
        {
            List <string[]> employeeData = DataLayer.GetTableData("employee");

            foreach (String[] row in employeeData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <IEmployee> .Register(uid, () => new Employee(Convert.ToInt16(row[0]), row[1], row[2], row[3], Convert.ToInt16(row[4]), Convert.ToInt16(row[5])));

                IEmployee emp = GenericFactory <IEmployee> .Create(uid);

                EmployeeList.Add(emp);
            }
        }
Beispiel #12
0
        public void FillLotTravellerList()
        {
            List <string[]> lotTravellerData = DataLayer.GetTableData("LotTraveller");

            foreach (String[] row in lotTravellerData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <ILotTraveller> .Register(uid, () => new LotTraveller(Convert.ToInt16(row[0]), row[1]));

                ILotTraveller lotTraveller = GenericFactory <ILotTraveller> .Create(uid);

                lotTravellerList.Add(lotTraveller);
            }
        }
Beispiel #13
0
        public void FillDocumentList(string table)
        {
            List <string[]> documentData = DataLayer.GetTableData(table);

            foreach (String[] row in documentData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <IDocument> .Register(uid, () => new Document(Convert.ToInt16(row[0]), row[1], DateTime.ParseExact(row[2], "dd/MM/yyyy", null)));

                IDocument doc = GenericFactory <IDocument> .Create(uid);

                DocumentList.Add(doc);
            }
        }
Beispiel #14
0
        public void FillLineItemList()
        {
            List <string[]> lineItemData = DataLayer.GetTableData("STL_LineItem");

            foreach (String[] row in lineItemData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <ILineItem> .Register(uid, () => new LineItem(Convert.ToInt16(row[0]), Convert.ToInt16(row[1]), Convert.ToDouble(row[2]), Convert.ToDouble(row[3]), Convert.ToDouble(row[4]), Convert.ToInt16(row[5])));

                ILineItem lineItem = GenericFactory <ILineItem> .Create(uid);

                LineItemList.Add(lineItem);
            }
        }
Beispiel #15
0
        public void FillUserList()
        {
            List <string[]> userData = DataLayer.GetTableData("users");

            foreach (String[] row in userData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <IUser> .Register(uid, () => new User(Convert.ToInt16(row[0]), row[1], row[2]));

                IUser user = GenericFactory <IUser> .Create(uid);

                UserList.Add(user);
            }
        }
Beispiel #16
0
        public void FillMaterialsList()
        {
            List <string[]> materialsData = DataLayer.GetTableData("RawMaterial");

            foreach (String[] row in materialsData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <IMaterial> .Register(uid, () => new Material(Convert.ToInt16(row[0]), row[1], row[2], Convert.ToInt16(row[3])));

                IMaterial material = GenericFactory <IMaterial> .Create(uid);

                materialsList.Add(material);
            }
        }
Beispiel #17
0
        public void FillCustomerList()
        {
            List <string[]> custData = DataLayer.GetTableData("Customer");

            foreach (String[] row in custData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <ICustomer> .Register(uid, () => new Customer(Convert.ToInt16(row[0]), row[1], row[2], row[3], row[4], new string[] { row[5], row[6], row[7] }));

                ICustomer customer = GenericFactory <ICustomer> .Create(uid);

                CustomerList.Add(customer);
            }
        }
Beispiel #18
0
        public void FillDocumentList(string table, bool criteria)
        {
            DataLayer.RemoveCriteria();
            DataLayer.SetCriteria("responded", criteria);
            List <string[]> documentData = DataLayer.GetTableData(table);

            foreach (String[] row in documentData)
            {
                Guid uid = Guid.NewGuid();
                GenericFactory <IDocument> .Register(uid, () => new Document(Convert.ToInt16(row[0]), row[1], DateTime.ParseExact(row[2], "dd/MM/yyyy", null), Convert.ToBoolean(row[3])));

                IDocument doc = GenericFactory <IDocument> .Create(uid);

                DocumentList.Add(doc);
            }
        }
Beispiel #19
0
        static void Main(string[] args)
        {
            ActivatorManager.CreateInstance <UserManager>();
            ActivatorManager.CreateInstanceWithConst <UserManager>();
            var userList = ActivatorManager.CreateInstanceGenericList <UserManager>();
            var user     = ActivatorManager.GetInstance <UserManager>();
            var user2    = ActivatorManager.GetInstanceConst <UserManager>();

            // GetInstanceWithGenericConstructer
            Family family = new Family {
                FatherName = "zafer", MotherName = "ayse"
            };
            var user3 = ActivatorManager.GetInstanceWithGenericConstructer <UserManager, Family>(family);

            //
            var factory = new GenericFactory <string, UserManager>();

            factory.Register("key", typeof(Family));
            UserManager newInstance = factory.Create("key", family);
        }