private bool CheckLoopBind(string masterFlowCode, string slaveFlowCode) { bool isLoop = false; while (slaveFlowCode != string.Empty) { if (masterFlowCode == slaveFlowCode) { isLoop = true; break; } else { List <FlowBinding> flowBindingList = (List <FlowBinding>)TheFlowBindingMgr.GetFlowBinding(slaveFlowCode); foreach (FlowBinding flowBinding in flowBindingList) { slaveFlowCode = flowBinding.SlaveFlow != null ? flowBinding.SlaveFlow.Code : string.Empty; isLoop = CheckLoopBind(masterFlowCode, slaveFlowCode); } slaveFlowCode = string.Empty; } } return(isLoop); }
protected void lbtnDelete_Click(object sender, EventArgs e) { int id = int.Parse(((LinkButton)sender).CommandArgument); TheFlowBindingMgr.DeleteFlowBinding(id); ShowSuccessMessage("MasterData.Flow.Binding.DeleteBinding.Successfully", id.ToString()); UpdateView(); }
protected void CheckSlaveFlow(object source, ServerValidateEventArgs args) { String masterFlowCode = ((Label)this.FV_FlowBinding.FindControl("lblMasterFlowValue")).Text; String slaveFlowCode = ((Controls_TextBox)this.FV_FlowBinding.FindControl("tbSlaveFlow")).Text; CustomValidator cvSlaveFlowCheck = ((CustomValidator)this.FV_FlowBinding.FindControl("cvSlaveFlowCheck")); if (TheFlowBindingMgr.LoadFlowBinding(masterFlowCode, slaveFlowCode) != null) { args.IsValid = false; ShowErrorMessage("MasterData.Flow.Binding.SlaveFlow.Exists"); } if (CheckLoopBind(masterFlowCode, slaveFlowCode)) { args.IsValid = false; ShowErrorMessage("MasterData.Flow.Binding.SlaveFlow.LoopBind"); } }
protected void FV_FlowBinding_DataBound(object sender, EventArgs e) { FlowBinding flowBinding = TheFlowBindingMgr.LoadFlowBinding(FlowBindingId); Label lblMasterFlowTypeValue = (Label)this.FV_FlowBinding.FindControl("lblMasterFlowTypeValue"); Label lblMasterFlowValue = (Label)this.FV_FlowBinding.FindControl("lblMasterFlowValue"); Controls_TextBox tbSlaveFlow = (Controls_TextBox)this.FV_FlowBinding.FindControl("tbSlaveFlow"); com.Sconit.Control.CodeMstrDropDownList ddlBindingType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowBinding.FindControl("ddlBindingType"); tbSlaveFlow.ServiceParameter = "string:" + this.CurrentUser.Code; tbSlaveFlow.DataBind(); lblMasterFlowTypeValue.Text = flowBinding.MasterFlow.Type; lblMasterFlowValue.Text = flowBinding.MasterFlow.Code; tbSlaveFlow.Text = flowBinding.SlaveFlow.Code; ddlBindingType.Text = flowBinding.BindingType; }
protected void ODS_FlowBinding_Updating(object sender, ObjectDataSourceMethodEventArgs e) { FlowBinding flowBinding = (FlowBinding)e.InputParameters[0]; FlowBinding oldFlowBinding = TheFlowBindingMgr.LoadFlowBinding(FlowBindingId); flowBinding.MasterFlow = oldFlowBinding.MasterFlow; Controls_TextBox tbSlaveFlow = (Controls_TextBox)this.FV_FlowBinding.FindControl("tbSlaveFlow"); com.Sconit.Control.CodeMstrDropDownList ddlBindingType = (com.Sconit.Control.CodeMstrDropDownList) this.FV_FlowBinding.FindControl("ddlBindingType"); if (tbSlaveFlow != null && tbSlaveFlow.Text.Trim() != string.Empty) { flowBinding.SlaveFlow = TheFlowMgr.LoadFlow(tbSlaveFlow.Text); } if (ddlBindingType.SelectedIndex != -1) { flowBinding.BindingType = ddlBindingType.SelectedValue; } }