public ActionResult AddFlow() { string _title = Request["title"] != null ? Request["title"].ToString() : string.Empty; string _serviceID = Request["serviceID"] != null ? Request["serviceID"].ToString() : string.Empty; string _flowID = Request["flowID"] != null ? Request["flowID"].ToString() : string.Empty; ServiceTemplateModel serviceModel = FlowInspectorApplication.GetServiceModelByString(_serviceID); if (serviceModel == null) { return(this.Json(new { status = false, message = "Internal error. COuld not load serviceModel by id:" + _serviceID })); } if (string.IsNullOrEmpty(_title)) { return(this.Json(new { strus = false, message = "Title is not set!" })); } if (string.IsNullOrEmpty(_serviceID)) { return(this.Json(new { status = false, message = "ServiceID is not set" })); } int flowID; if (!Int32.TryParse(_flowID, out flowID)) { return(this.Json(new { status = false, message = "FlowID is not set" })); } if (flowID == -1) { TemplateServiceFlow ts = new TemplateServiceFlow(flowID, serviceModel.ServiceData, _title, DateTime.Now, DateTime.Now); ts.Insert(); serviceModel.Flows.Add(ts); return(this.Json(new { status = true, message = "Inserted", id = ts.ID })); } else { TemplateServiceFlow ts = TemplateServiceFlow.CreateManager().Load(flowID); ts.Title = _title; ts.Update(); return(this.Json(new { status = true, message = "Updated!", id = ts.ID })); } }
public ServiceTemplateModel(Service s) { this._service = s; this._providerName = MobilePaywallDirect.Instance.LoadString(string.Format(@" SELECT pp.Name FROM MobilePaywall.core.ServiceOffer AS so LEFT OUTER JOIN MobilePaywall.core.PaymentConfiguration AS pc ON so.PaymentConfigurationID=pc.PaymentConfigurationID LEFT OUTER JOIN MObilePaywall.core.PaymentProvider AS pp ON pc.PaymentProviderID=pp.PaymentProviderID WHERE so.ServiceID={0};", s.ID)); this._templateServiceFlows = TemplateServiceFlow.CreateManager().Load(this._service); if (this._templateServiceFlows == null) { this._templateServiceFlows = new List <TemplateServiceFlow>(); } this._templateFlowEnties = TemplateServiceFlowEntry.CreateManager().Load(this._service); if (this._templateFlowEnties == null) { this._templateFlowEnties = new List <TemplateServiceFlowEntry>(); } }