예제 #1
0
 public TaskCatalog GetWorkTasks()
 {
     if (workTasks == null)
     {
         TaskCatalog empty = new TaskCatalog();
         empty.AddTask(0, "Empty");
         return empty;
     }
     return workTasks;
 }
예제 #2
0
 public ControllerCatalog()
 {
     dbc = new DBController();
     ec = new EmployeeCatalog();
     tc = new TaskCatalog();
     oc = new OrderCatalog();
     cc = new CustomerCatalog();
     ofc = new OfferCatalog();
     ic = new ItemCatalog();
     xml = new XML();
 }
예제 #3
0
 /*SETTERS*/
 public void AddOffer(TaskCatalog TC)
 {
     ofc.AddOffer(TC);
 }
예제 #4
0
파일: XML.cs 프로젝트: Crampers/Raunstrup
        /*OrderDescription*/
        public void ReadOrderStatusXML()
        {
            //TODO: MAKE IT UPDATE DATABASE!
            int itemLineID = 0;
            int taskID = 0;
            int itemID = 0;
            int itemAmount = 0;
            int itemAmountExtra = 0;
            int orderID = 0;
            int offerID = 0;
            int itemIsCompleted = 0;

            TaskCatalog tc = new TaskCatalog();
            using (XmlReader reader = XmlReader.Create("Orderstatus.xml"))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "Order":
                                //Console.WriteLine("Start af Ordre");
                                break;
                            case "OrderID":
                                if (reader.Read())
                                {
                                    orderID = Convert.ToInt32(reader.Value.Trim());
                                }
                                //Console.WriteLine("OrderID = " + orderID);
                                break;
                            case "OfferID":
                                if (reader.Read())
                                {
                                    offerID = Convert.ToInt32(reader.Value.Trim());
                                }
                                break;
                            case "Task":
                                //Console.WriteLine("Start på Task");
                                break;
                            case "TaskID":
                                if (reader.Read())
                                {
                                    taskID = Convert.ToInt32(reader.Value.Trim());
                                }
                                //Console.WriteLine(taskID);
                                break;
                            case "Taskdescription":
                                string taskDesc = "";
                                if (reader.Read())
                                {
                                    taskDesc = reader.Value.Trim();
                                }
                                tc.AddTask(taskID, taskDesc);
                                //Console.WriteLine(taskDesc);
                                break;
                            case "Taskcomplete":
                                bool taskComplete = false;
                                if (reader.Read())
                                {
                                    taskComplete = Convert.ToBoolean(reader.Value.Trim());
                                }
                                tc.GetTask(taskID).SetStatus(taskComplete);
                                //Console.WriteLine(taskComplete);
                                break;
                          /*  case "ItemLine":
                                itemLineID += 1;
                                break;*/
                            case "itemID":
                                if (reader.Read())
                                {
                                    itemID = Convert.ToInt32(reader.Value.Trim());
                                }
                                //Console.WriteLine("   " + itemID);
                                break;
                            case "itemLineID":
                                if(reader.Read())
                                {
                                    itemLineID = Convert.ToInt32(reader.Value.Trim());
                                }
                                break;
                            /*case "itemDesc":
                                string itemDesc = "";
                                if (reader.Read())
                                {
                                    itemDesc = reader.Value.Trim();
                                }
                                //Console.WriteLine("   " + itemDesc);
                                break;*/
                            case "itemAmountExtra":
                                if (reader.Read())
                                {
                                    itemAmountExtra = Convert.ToInt32(reader.Value.Trim());
                                }
                                break;
                            case "itemAmount":
                                if (reader.Read())
                                {
                                    itemAmount = Convert.ToInt32(reader.Value.Trim());
                                }
                                //Console.WriteLine("   " + itemAmount);
                                dbc.OSDB.UpdateTaskEntry(itemAmountExtra, itemLineID);
                                tc.AddTaskItems(taskID, ic.GetItem(itemID), itemAmount, itemAmountExtra);
                                break;
                            case "itemIsCompleted":
                                if (reader.Read())
                                {
                                    itemIsCompleted = Convert.ToInt32(reader.Value.Trim());
                                }
                                if (itemIsCompleted != 0)
                                {
                                    tc.GetTask(taskID).GetItemLine(itemLineID).SetAmountCompleted(itemIsCompleted);
                                }
                                //Console.WriteLine("   " + itemIsCompleted);
                                break;
                            case "itemIsComplete":
                                bool itemIsComplete = false;
                                if (reader.Read())
                                {
                                    itemIsComplete = Convert.ToBoolean(reader.Value.Trim());
                                }
                                if (itemIsComplete != false)
                                {
                                    tc.GetTask(taskID).GetItemLine(itemLineID).setStatus(itemIsComplete);
                                }
                                //Console.WriteLine("   " + itemIsComplete);
                                break;
                        }
                    }
                }
            }

            OrderDescription ordre = new OrderDescription(orderID, new OfferDescription(offerID, tc));
        }
예제 #5
0
        public OrderDescription FindOrderStatus(int orderID)
        {
            String stringOfferID = "";
            String stringCustomerID = "";
            TaskCatalog orderTasks = new TaskCatalog();

            // find inquiry for OfferID
            string findInquiry = "select * from Inquiry where InquiryID = " + orderID;
            conn.Open();
            SqlCommand com = new SqlCommand(findInquiry, conn);
            SqlDataReader reader = com.ExecuteReader();
            while (reader.Read())
            {
                stringOfferID = reader["OfferID"].ToString();
            }
            conn.Close();

            //find offer for Customer ID
            string findOffer = "select * from Offer where OfferID = " + stringOfferID;
            conn.Open();
            com = new SqlCommand(findOffer, conn);
            reader = com.ExecuteReader();
            while (reader.Read())
            {
                stringCustomerID = reader["CustomerID"].ToString();
            }
            conn.Close();

            //find worktasks associated with offerID
            string findWorkTasks = "select * from Task where OfferID = " + stringOfferID;
            conn.Open();
            com = new SqlCommand(findWorkTasks, conn);
            reader = com.ExecuteReader();
            while (reader.Read())
            {
               String stringTaskID = reader["TaskID"].ToString();
               String taskDesc = reader["TaskDescription"].ToString();
               int taskID = Convert.ToInt32(stringTaskID);
               orderTasks.AddTask(taskID, taskDesc);
            }
            conn.Close();

            //add items to these worktasks
            foreach (TaskDescription task in orderTasks.GetTasks())
            {
                string findWorkTasksItems = "select * from TaskEntry where TaskID = " + task.GetId();
                com = new SqlCommand(findWorkTasksItems, conn);
                conn.Open();
                reader = com.ExecuteReader();
                while (reader.Read())
                {
                    String stringItemLineID = reader["TaskEntyID"].ToString();
                    int itemLineID = Convert.ToInt32(stringItemLineID);
                    String stringTaskID = reader["TaskID"].ToString();
                    int taskID = Convert.ToInt32(stringTaskID);
                    String stringItemID = reader["ItemID"].ToString();
                    int itemID = Convert.ToInt32(stringItemID);
                    String stringAmount = reader["Amount"].ToString();
                    int amount = Convert.ToInt32(stringAmount);
                    String stringAmountExtra = reader["AmountExtra"].ToString();
                    int amountExtra = Convert.ToInt32(stringAmountExtra);
                    task.AddItems(itemLineID, ic.GetItem(itemID), amount, amountExtra);
                }
                conn.Close();
            }
            int offerID = Convert.ToInt32(stringOfferID);
            OfferDescription offer = new OfferDescription(offerID, orderTasks);
            int customerID = Convert.ToInt32(stringCustomerID);
            offer.SetBuyer(custDB.FindCustomer(customerID));

            OrderDescription order = new OrderDescription(orderID, offer);
            return order;
        }
예제 #6
0
 public void SetWorkTasks(TaskCatalog tc)
 {
     workTasks = tc;
 }
예제 #7
0
 public OfferDescription(int id, TaskCatalog tc)
 {
     offerID = id;
     workTasks = tc;
 }