/// <summary> /// Handler, deletes a record. /// </summary> public IActionResult OnGetRemove(int id) { WorkflowStepsMaster WorkflowStepsMaster = WorkflowStepsMaster.SelectByPrimaryKey(id); WorkflowStepsMaster.Delete(id); return(new JsonResult(true)); }
/// <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 stepIdSample = 12; // select a record by primary key(s) WorkflowStepsMaster objWorkflowStepsMaster = WorkflowStepsMaster.SelectByPrimaryKey(stepIdSample); if (objWorkflowStepsMaster != null) { // if record is found, a record is returned int stepId = objWorkflowStepsMaster.StepId; int? worKflowId = objWorkflowStepsMaster.WorKflowId; string approvalLevel = objWorkflowStepsMaster.ApprovalLevel; string description = objWorkflowStepsMaster.Description; string autoApprove = objWorkflowStepsMaster.AutoApprove; int? waitTime = objWorkflowStepsMaster.WaitTime; string createdBy = objWorkflowStepsMaster.CreatedBy; DateTime createdOn = objWorkflowStepsMaster.CreatedOn; string updatedBy = objWorkflowStepsMaster.UpdatedBy; DateTime updatedOn = objWorkflowStepsMaster.UpdatedOn; // get the WorkflowMaster related to WorKflowId. if (objWorkflowStepsMaster.WorKflowId != null) { WorkflowMaster objWorkflowMasterRelatedToWorKflowId = objWorkflowStepsMaster.WorKflowIdNavigation; } } }
/// <summary> /// Used when adding or updating a record. /// </summary> internal static void AddOrEdit(WorkflowStepsMaster model, CrudOperation operation, bool isForListInline = false) { WorkflowStepsMaster objWorkflowStepsMaster; WorkflowStepsMaster objWorkflowStepsMasterOld = new WorkflowStepsMaster(); decimal id = 0; if (operation == CrudOperation.Add) { objWorkflowStepsMaster = new WorkflowStepsMaster(); } else { objWorkflowStepsMaster = WorkflowStepsMaster.SelectByPrimaryKey(model.StepId); objWorkflowStepsMasterOld = objWorkflowStepsMaster.ShallowCopy(); } objWorkflowStepsMaster.StepId = model.StepId; objWorkflowStepsMaster.WorKflowId = model.WorKflowId; objWorkflowStepsMaster.ApprovalLevel = model.ApprovalLevel; objWorkflowStepsMaster.Description = model.Description; objWorkflowStepsMaster.AutoApprove = model.AutoApprove; objWorkflowStepsMaster.CreatedBy = model.CreatedBy; objWorkflowStepsMaster.CreatedOn = model.CreatedOn; objWorkflowStepsMaster.UpdatedBy = model.UpdatedBy; objWorkflowStepsMaster.UpdatedOn = model.UpdatedOn; if (isForListInline) { objWorkflowStepsMaster.WaitTime = model.WaitTime; } else { if (!String.IsNullOrEmpty(model.WaitTimeHidden)) { objWorkflowStepsMaster.WaitTime = Convert.ToInt32(model.WaitTimeHidden); } else { objWorkflowStepsMaster.WaitTime = null; } } if (operation == CrudOperation.Add) { id = objWorkflowStepsMaster.Insert(); } else { objWorkflowStepsMaster.Update(); } }
public PageResult LoadPage(int id, string returnUrl) { // select a record by primary key(s) StudentEnquiryAPI.BusinessObject.WorkflowStepsMaster objWorkflowStepsMaster = WorkflowStepsMaster.SelectByPrimaryKey(id); // assign values to the model WorkflowStepsMaster objWorkflowStepsMasterTemp = new WorkflowStepsMaster(); objWorkflowStepsMasterTemp.StepId = objWorkflowStepsMaster.StepId; objWorkflowStepsMasterTemp.WorKflowId = objWorkflowStepsMaster.WorKflowId; objWorkflowStepsMasterTemp.ApprovalLevel = objWorkflowStepsMaster.ApprovalLevel; objWorkflowStepsMasterTemp.Description = objWorkflowStepsMaster.Description; objWorkflowStepsMasterTemp.AutoApprove = objWorkflowStepsMaster.AutoApprove; objWorkflowStepsMasterTemp.WaitTime = objWorkflowStepsMaster.WaitTime; if (objWorkflowStepsMaster.WaitTime.HasValue) { objWorkflowStepsMasterTemp.WaitTimeHidden = objWorkflowStepsMaster.WaitTime.Value.ToString(); } else { objWorkflowStepsMasterTemp.WaitTimeHidden = null; } objWorkflowStepsMasterTemp.CreatedBy = objWorkflowStepsMaster.CreatedBy; objWorkflowStepsMasterTemp.CreatedOn = objWorkflowStepsMaster.CreatedOn; objWorkflowStepsMasterTemp.UpdatedBy = objWorkflowStepsMaster.UpdatedBy; objWorkflowStepsMasterTemp.UpdatedOn = objWorkflowStepsMaster.UpdatedOn; // create the model used by the partial page AddEditWorkflowStepsMasterPartialModel model = new AddEditWorkflowStepsMasterPartialModel(); model.WorkflowMasterDropDownListData = WorkflowMaster.SelectWorkflowMasterDropDownListData(); model.Operation = CrudOperation.Update; model.ReturnUrl = returnUrl; model.WorkflowStepsMaster = objWorkflowStepsMasterTemp; // assign values to the model used by this page PartialModel = model; // assign the return url ReturnUrl = returnUrl; return(Page()); }
public void LoadPage(int id, string returnUrl) { // select a record by primary key(s) CourseEnquiry1API.BusinessObject.WorkflowStepsMaster objWorkflowStepsMaster = WorkflowStepsMaster.SelectByPrimaryKey(id); // assign values to the model WorkflowStepsMaster objWorkflowStepsMasterTemp = new WorkflowStepsMaster(); objWorkflowStepsMasterTemp.StepId = objWorkflowStepsMaster.StepId; objWorkflowStepsMasterTemp.WorKflowId = objWorkflowStepsMaster.WorKflowId; objWorkflowStepsMasterTemp.ApprovalLevel = objWorkflowStepsMaster.ApprovalLevel; objWorkflowStepsMasterTemp.Description = objWorkflowStepsMaster.Description; objWorkflowStepsMasterTemp.AutoApprove = objWorkflowStepsMaster.AutoApprove; objWorkflowStepsMasterTemp.WaitTime = objWorkflowStepsMaster.WaitTime; if (objWorkflowStepsMaster.WaitTime.HasValue) { objWorkflowStepsMasterTemp.WaitTimeHidden = objWorkflowStepsMaster.WaitTime.Value.ToString(); } else { objWorkflowStepsMasterTemp.WaitTimeHidden = null; } objWorkflowStepsMasterTemp.CreatedBy = objWorkflowStepsMaster.CreatedBy; objWorkflowStepsMasterTemp.CreatedOn = objWorkflowStepsMaster.CreatedOn; objWorkflowStepsMasterTemp.UpdatedBy = objWorkflowStepsMaster.UpdatedBy; objWorkflowStepsMasterTemp.UpdatedOn = objWorkflowStepsMaster.UpdatedOn; // assign values to this page's bound property WorkflowStepsMaster = objWorkflowStepsMasterTemp; // assign the return url ReturnUrl = returnUrl; }