protected void SaveButton_ServerClick(object sender, EventArgs e) { if (activity == null) // new { ActivityMaster currentActivityMaster = shemaMaster.GetActivityMaster(ActivityTypeList.SelectedValue); activity = currentActivityMaster.InstanceFactory.CreateInstance(); if (MainPlaceHolder.Controls.Count > 0) { MCDataSavedControl control = (MCDataSavedControl)MainPlaceHolder.Controls[0]; control.Save(activity); } object parentActivity = WorkflowActivityWrapper.GetActivityByName(rootActivity, ParentActivityName); WorkflowActivityWrapper.AddActivity(parentActivity, activity); } else // edit { if (MainPlaceHolder.Controls.Count > 0) { MCDataSavedControl control = (MCDataSavedControl)MainPlaceHolder.Controls[0]; control.Save(activity); } } // Save data instance.Xaml = McWorkflowSerializer.GetString(rootActivity); BusinessManager.Update(instance); // Close popup if (!String.IsNullOrEmpty(Request["closeFramePopup"])) { Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, string.Empty, true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script language='javascript'>" + "try {window.opener.location.href=window.opener.location.href;}" + "catch (e){} window.close();</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (InstanceId != PrimaryKeyId.Empty) { instance = (WorkflowInstanceEntity)BusinessManager.Load(WorkflowInstanceEntity.ClassName, InstanceId); shemaMaster = SchemaManager.GetShemaMaster(instance.SchemaId); rootActivity = McWorkflowSerializer.GetObject(instance.Xaml); if (!String.IsNullOrEmpty(ActivityName)) { activity = WorkflowActivityWrapper.GetActivityByName(rootActivity, ActivityName); } } if (!IsPostBack) { BindInfo(); BindData(); } LoadControlToPlaceHolder(!IsPostBack); }