Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
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");
            }
        }