Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session[Constants.PWAS_SESSION_ID] == null)
            {
                Session.Abandon();
                Response.Redirect("login.aspx");
            }

            IPrintRunRepository PrintRunRepository = RepositoryFactory.Get <IPrintRunRepository>();

            var query = from p
                        in PrintRunRepository.PrintRuns
                        select p;;

            foreach (var pr in query)
            {
                TableCell cellView   = new TableCell();
                TableCell cellstatus = new TableCell();
                TableCell cellaction = new TableCell();
                TableCell cellID     = new TableCell();
                TableCell cellName   = new TableCell();

                cellView.Controls.Add(getViewControl(pr));
                cellstatus.Controls.Add(getStatusControl(pr));
                cellaction.Controls.Add(getActionControl(pr));
                cellID.Text   = pr.runID.ToString();
                cellName.Text = pr.run_name.ToString();

                //----
                cellView.HorizontalAlign   = HorizontalAlign.Center;
                cellstatus.HorizontalAlign = HorizontalAlign.Center;
                cellaction.HorizontalAlign = HorizontalAlign.Center;
                cellID.HorizontalAlign     = HorizontalAlign.Center;

                //----
                cellID.Width     = Unit.Pixel(150);
                cellName.Width   = Unit.Pixel(200);
                cellstatus.Width = Unit.Pixel(200);
                cellaction.Width = Unit.Pixel(100);


                TableRow prrow = new TableRow();

                prrow.Cells.Add(cellView);
                prrow.Cells.Add(cellID);
                prrow.Cells.Add(cellName);
                prrow.Cells.Add(cellstatus);
                prrow.Cells.Add(cellaction);

                prrow.CssClass = "orderRow";
                PrintRunTable.Rows.Add(prrow);
            }
        }
        private void loadPrintRunList()
        {
            if (runList.Items.Count == 0)
            {
                IPrintRunRepository prRepo = RepositoryFactory.Get <IPrintRunRepository>();
                List <PrintRun>     prList = prRepo.PrintRuns.Where(p => p.run_status == OrderConstants.ORDER_STATUS_CREATED).ToList <PrintRun>();

                ListItem tempItem;

                foreach (PrintRun pr in prList)
                {
                    tempItem       = new ListItem("Run " + pr.runID + " - " + pr.run_name, pr.runID.ToString());
                    tempItem.Value = pr.runID.ToString();
                    runList.Items.Add(tempItem);
                }
            }
        }
        protected void doSubmit(object sender, EventArgs e)
        {
            int  i = 0;
            bool somethingSelected = false;

            List <TableRow> toDelete = new List <TableRow>();

            foreach (TableRow row in tableCreatedOrders.Rows)
            {
                if (i > 0)//skip the first row, since it's the header row
                {
                    TableCell tempCell = row.Cells[0];
                    if (((CheckBox)tempCell.Controls[0]).Checked)
                    {
                        somethingSelected = true;
                        IOrderRepository orderRepo = RepositoryFactory.Get <IOrderRepository>();
                        orderRepo.UpdateOrderStatus(Int32.Parse(row.Cells[1].Text), OrderConstants.ORDER_STATUS_PROCESSING);
                        orderRepo.UpdateOrderRunId(Int32.Parse(row.Cells[1].Text), Int32.Parse(runList.SelectedValue));
                        toDelete.Add(row);
                    }
                }

                i++;
            }

            if (somethingSelected)
            {
                IPrintRunRepository prRepo = RepositoryFactory.Get <IPrintRunRepository>();
                prRepo.UpdatePrintRunStatus(Int32.Parse(runList.SelectedValue), OrderConstants.ORDER_STATUS_PREPRINTING);

                //1.delete the selected rows from "tableCreatedOrders"
                //2.delete the selected print run from the drop down "runList"

                foreach (TableRow row in toDelete)
                {
                    tableCreatedOrders.Rows.Remove(row);
                }

                runList.Items.Remove(runList.SelectedItem);

                messageNotify.Text      = "Your orders have been added to the print run successfully.";
                messageNotify.ForeColor = System.Drawing.Color.Green;
                messageNotify.Visible   = true;
            }
        }
Exemple #4
0
        public void UpdateOrderStatus_PrintRun(int printRundId, int statusID)
        {
            IPrintRunRepository printRepo = RepositoryFactory.Get <IPrintRunRepository>();
            IOrderRepository    orderRepo = RepositoryFactory.Get <IOrderRepository>();


            PrintRun printRun = printRepo.GetById(printRundId);

            var orders = from p
                         in orderRepo.Orders
                         where p.PrintRun.runID == printRundId
                         select p;

            foreach (var cur_Order in orders)
            {
                orderRepo.UpdateOrderStatus(cur_Order.orderID, statusID);
            }
        }
Exemple #5
0
        public void createPrintRun(object sender, EventArgs e)
        {
            IPrintRunRepository prRepo = RepositoryFactory.Get <IPrintRunRepository>();
            PrintRun            newRun;

            if (validateFields())
            {
                newRun              = new PrintRun();
                newRun.height       = Int32.Parse(runHeight.Text);
                newRun.width        = Int32.Parse(runWidth.Text);
                newRun.quantity     = Int32.Parse(runQuantity.Text);
                newRun.stock_finish = runFinish.SelectedValue;
                newRun.stock_weight = runWeight.SelectedValue;
                newRun.run_name     = runName.Text;

                prRepo.AddPrintRun(newRun);
                prRepo.SubmitChanges();

                notifyMsg.Text      = "Print Run Created Sucessfully";
                notifyMsg.ForeColor = System.Drawing.Color.Green;
                notifyMsg.Visible   = true;
            }
        }
Exemple #6
0
        private void func_update(object sender, CommandEventArgs e)
        {
            IStatusRepository   statusRepo = RepositoryFactory.Get <IStatusRepository>();
            IPrintRunRepository printRun   = RepositoryFactory.Get <IPrintRunRepository>();

            int runID = System.Int32.Parse(e.CommandArgument.ToString());

            if (ViewState[runID.ToString()] != null)
            {
                string statusName    = ViewState[runID.ToString()].ToString();
                Status currentStatus = statusRepo.Statuses.Single(x => x.statusName == statusName);
                printRun.UpdatePrintRunStatus(runID, currentStatus.statusId);

                if (OrderConstants.ORDER_STATUS_CLOSED == currentStatus.statusId)
                {
                    UpdateOrderStatus_PrintRun(runID, OrderConstants.ORDER_STATUS_SHIPPED);
                }
            }
            else
            {
                Response.Redirect("index.aspx");
            }
        }