Exemplo n.º 1
0
        /// <summary>
        /// Creates a job to manage the collection and delivery of the orders.
        /// </summary>
        private void CreateJob()
        {
            string userName = ((Entities.CustomPrincipal)Page.User).UserName;

            // Ensure the orders are all of the correct business type.
            Facade.IOrderGroup facOrderGroup = new Facade.Order();
            var businessTypeID = facOrderGroup.DetermineBusinessType(OrderGroup.OrderGroupID, false, userName);

            Facade.IJob           facJob = new Facade.Job();
            Entities.FacadeResult res    = facJob.CreateJobForOrderGroup(businessTypeID, this.OrderGroup, userName);

            if (res.Success)
            {
                int jobID = res.ObjectId;

                string jobDetailsRelativeURL = string.Format("~/Job/Job.aspx?wiz=true&jobID={0}", jobID);
                string jobDetailsURL         = Page.ResolveClientUrl(jobDetailsRelativeURL);
                string jobDetailsJS          = string.Format("openResizableDialogWithScrollbars('{0}' + getCSID(), 1220, 930);", jobDetailsURL);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "viewJob", jobDetailsJS, true);
            }
            else
            {
                this.DisplayInfringments(res);
            }

            // Update the UI of the page.
            RebindPage();
        }