/// <summary>
        /// Handler, deletes a record.
        /// </summary>
        public IActionResult OnGetRemove(int id)
        {
            WorkflowMaster WorkflowMaster = WorkflowMaster.SelectByPrimaryKey(id);

            WorkflowMaster.Delete(id);
            return(new JsonResult(true));
        }
        public void LoadPage(int id, string returnUrl)
        {
            // select a record by primary key(s)
            StudentEnquiryAPI.BusinessObject.WorkflowMaster objWorkflowMaster = WorkflowMaster.SelectByPrimaryKey(id);

            // assign values to the model
            WorkflowMaster objWorkflowMasterTemp = new WorkflowMaster();

            objWorkflowMasterTemp.WorkflowId       = objWorkflowMaster.WorkflowId;
            objWorkflowMasterTemp.WorkflowName     = objWorkflowMaster.WorkflowName;
            objWorkflowMasterTemp.LevelOfApprovals = objWorkflowMaster.LevelOfApprovals;

            if (objWorkflowMaster.LevelOfApprovals.HasValue)
            {
                objWorkflowMasterTemp.LevelOfApprovalsHidden = objWorkflowMaster.LevelOfApprovals.Value.ToString();
            }
            else
            {
                objWorkflowMasterTemp.LevelOfApprovalsHidden = null;
            }

            objWorkflowMasterTemp.CreatedBy = objWorkflowMaster.CreatedBy;
            objWorkflowMasterTemp.CreatedOn = objWorkflowMaster.CreatedOn;
            objWorkflowMasterTemp.Updatedby = objWorkflowMaster.Updatedby;
            objWorkflowMasterTemp.Updatedon = objWorkflowMaster.Updatedon;

            // assign values to this page's bound property
            WorkflowMaster = objWorkflowMasterTemp;

            // assign the return url
            ReturnUrl = returnUrl;
        }
        /// <summary>
        /// Used when adding or updating a record.
        /// </summary>
        internal static void AddOrEdit(WorkflowMaster model, CrudOperation operation, bool isForListInline = false)
        {
            WorkflowMaster objWorkflowMaster;
            WorkflowMaster objWorkflowMasterOld = new WorkflowMaster();
            decimal        id = 0;

            if (operation == CrudOperation.Add)
            {
                objWorkflowMaster = new WorkflowMaster();
            }
            else
            {
                objWorkflowMaster    = WorkflowMaster.SelectByPrimaryKey(model.WorkflowId);
                objWorkflowMasterOld = objWorkflowMaster.ShallowCopy();
            }

            objWorkflowMaster.WorkflowId   = model.WorkflowId;
            objWorkflowMaster.WorkflowName = model.WorkflowName;
            objWorkflowMaster.CreatedBy    = model.CreatedBy;
            objWorkflowMaster.CreatedOn    = model.CreatedOn;
            objWorkflowMaster.Updatedby    = model.Updatedby;
            objWorkflowMaster.Updatedon    = model.Updatedon;

            if (isForListInline)
            {
                objWorkflowMaster.LevelOfApprovals = model.LevelOfApprovals;
            }
            else
            {
                if (!String.IsNullOrEmpty(model.LevelOfApprovalsHidden))
                {
                    objWorkflowMaster.LevelOfApprovals = Convert.ToInt32(model.LevelOfApprovalsHidden);
                }
                else
                {
                    objWorkflowMaster.LevelOfApprovals = null;
                }
            }

            if (operation == CrudOperation.Add)
            {
                id = objWorkflowMaster.Insert();
            }
            else
            {
                objWorkflowMaster.Update();
            }
        }
    /// <summary>
    /// Shows how to Select a record by Primary Key.  It also shows how to retrieve Lazily-loaded related Objects.  Related Objects are assigned for each Foreign Key.
    /// </summary>
    private void SelectByPrimaryKey()
    {
        int workflowIdSample = 1;

        // select a record by primary key(s)

        WorkflowMaster objWorkflowMaster = WorkflowMaster.SelectByPrimaryKey(workflowIdSample);

        if (objWorkflowMaster != null)
        {
            // if record is found, a record is returned
            int      workflowId       = objWorkflowMaster.WorkflowId;
            string   workflowName     = objWorkflowMaster.WorkflowName;
            int?     levelOfApprovals = objWorkflowMaster.LevelOfApprovals;
            string   createdBy        = objWorkflowMaster.CreatedBy;
            DateTime createdOn        = objWorkflowMaster.CreatedOn;
            string   updatedby        = objWorkflowMaster.Updatedby;
            DateTime updatedon        = objWorkflowMaster.Updatedon;
        }
    }
Пример #5
0
        public PageResult LoadPage(int id, string returnUrl)
        {
            // select a record by primary key(s)
            StudentEnquiryAPI.BusinessObject.WorkflowMaster objWorkflowMaster = WorkflowMaster.SelectByPrimaryKey(id);

            // assign values to the model
            WorkflowMaster objWorkflowMasterTemp = new WorkflowMaster();

            objWorkflowMasterTemp.WorkflowId       = objWorkflowMaster.WorkflowId;
            objWorkflowMasterTemp.WorkflowName     = objWorkflowMaster.WorkflowName;
            objWorkflowMasterTemp.LevelOfApprovals = objWorkflowMaster.LevelOfApprovals;

            if (objWorkflowMaster.LevelOfApprovals.HasValue)
            {
                objWorkflowMasterTemp.LevelOfApprovalsHidden = objWorkflowMaster.LevelOfApprovals.Value.ToString();
            }
            else
            {
                objWorkflowMasterTemp.LevelOfApprovalsHidden = null;
            }

            objWorkflowMasterTemp.CreatedBy = objWorkflowMaster.CreatedBy;
            objWorkflowMasterTemp.CreatedOn = objWorkflowMaster.CreatedOn;
            objWorkflowMasterTemp.Updatedby = objWorkflowMaster.Updatedby;
            objWorkflowMasterTemp.Updatedon = objWorkflowMaster.Updatedon;
            // create the model used by the partial page
            AddEditWorkflowMasterPartialModel model = new AddEditWorkflowMasterPartialModel();

            model.Operation      = CrudOperation.Update;
            model.ReturnUrl      = returnUrl;
            model.WorkflowMaster = objWorkflowMasterTemp;

            // assign values to the model used by this page
            PartialModel = model;

            // assign the return url
            ReturnUrl = returnUrl;

            return(Page());
        }