public void bindData(BusinessRule businessRule) { int clientID = SessionHelper.getClientId(); IQueryable <AdjusterMaster> adjusters = null; adjusters = AdjusterManager.GetAll(clientID); ddlAdjuster.DataSource = adjusters.ToList(); ddlAdjuster.DataValueField = "AdjusterId"; ddlAdjuster.DataTextField = "adjusterName"; ddlAdjuster.DataBind(); ddlAdjuster.Items.Insert(0, new ListItem("--- Select ---", "0")); //CollectionManager.FillCollection(ddlAdjuster, "AdjusterId", "adjusterName", adjusters); ViewState["businessRuleID"] = businessRule.BusinessRuleID.ToString(); clearFields(); if (businessRule.BusinessRuleID == 0) { // for new rules only. cbxActive.Checked = true; } else { // edit XElement ruleXML = XElement.Parse(businessRule.RuleXML); cbxActive.Checked = businessRule.IsActive; cbxEmailAdjuster.Checked = businessRule.EmailAdjuster; cbxEmailSupervisor.Checked = businessRule.EmailSupervisor; txtDescription.Text = businessRule.Description; using (RuleHelper ruleHelper = new RuleHelper()) { XElement invoiceCondition = ruleHelper.GetElement(ruleXML, "Claim"); txtNumberOfClaims.Text = invoiceCondition.Element("value").Value; XElement adjusterCondition = ruleHelper.GetElement(ruleXML, "AdjusterID"); ddlAdjuster.SelectedValue = adjusterCondition.Element("value").Value; } //.Where(x => x.Element("property").Value == "Invoice").FirstOrDefault(); } }
public void bindData(BusinessRule businessRule) { int clientID = SessionHelper.getClientId(); List <Carrier> carriers = null; List <ExpenseType> expenseTypes = null; // load carriers carriers = CarrierManager.GetCarriers(clientID).ToList(); CollectionManager.FillCollection(ddlCarrier, "CarrierID", "CarrierName", carriers); // load expenses using (ExpenseTypeManager repository = new ExpenseTypeManager()) { expenseTypes = repository.GetAll(clientID).ToList(); } CollectionManager.FillCollection(ddlExpenseType, "ExpenseTypeID", "ExpenseName", expenseTypes); ViewState["businessRuleID"] = businessRule.BusinessRuleID.ToString(); clearFields(); if (businessRule.BusinessRuleID == 0) { // for new rules only. cbxActive.Checked = true; } else { // edit XElement ruleXML = XElement.Parse(businessRule.RuleXML); cbxActive.Checked = businessRule.IsActive; cbxEmailAdjuster.Checked = businessRule.EmailAdjuster; cbxEmailSupervisor.Checked = businessRule.EmailSupervisor; txtDescription.Text = businessRule.Description; using (RuleHelper ruleHelper = new RuleHelper()) { XElement conditionCarrier = ruleHelper.GetElement(ruleXML, "CarrierID"); setValue(ddlCarrier, conditionCarrier.Element("value").Value); XElement conditionAdjuster = ruleHelper.GetElement(ruleXML, "ExpenseTypeID"); setValue(ddlExpenseType, conditionAdjuster.Element("value").Value); } } }
public void bindData(BusinessRule businessRule) { int clientID = SessionHelper.getClientId(); IQueryable<AdjusterMaster> adjusters = null; adjusters = AdjusterManager.GetAll(clientID); ddlAdjuster.DataSource = adjusters.ToList(); ddlAdjuster.DataValueField = "AdjusterId"; ddlAdjuster.DataTextField = "adjusterName"; ddlAdjuster.DataBind(); ddlAdjuster.Items.Insert(0, new ListItem("--- Select ---", "0")); //CollectionManager.FillCollection(ddlAdjuster, "AdjusterId", "adjusterName", adjusters); ViewState["businessRuleID"] = businessRule.BusinessRuleID.ToString(); clearFields(); if (businessRule.BusinessRuleID == 0) { // for new rules only. cbxActive.Checked = true; } else { // edit XElement ruleXML = XElement.Parse(businessRule.RuleXML); cbxActive.Checked = businessRule.IsActive; cbxEmailAdjuster.Checked = businessRule.EmailAdjuster; cbxEmailSupervisor.Checked = businessRule.EmailSupervisor; txtDescription.Text = businessRule.Description; using (RuleHelper ruleHelper = new RuleHelper()) { XElement invoiceCondition = ruleHelper.GetElement(ruleXML, "Claim"); txtNumberOfClaims.Text = invoiceCondition.Element("value").Value; XElement adjusterCondition = ruleHelper.GetElement(ruleXML, "AdjusterID"); ddlAdjuster.SelectedValue = adjusterCondition.Element("value").Value; } //.Where(x => x.Element("property").Value == "Invoice").FirstOrDefault(); } }
public List <BusinessRule> getBusinessRuleId(int clientID, int ruleId) { List <BusinessRule> businessRuleArr = new List <BusinessRule>(); BusinessRuleManager businessRuleManager = new BusinessRuleManager(); businessRuleArr = businessRuleManager.GetBusinessRuleThread(clientID, ruleId); for (var i = 0; i < businessRuleArr.Count; i++) { XElement ruleXML = XElement.Parse(businessRuleArr[i].RuleXML.ToString()); using (RuleHelper ruleHelper = new RuleHelper()) { XElement conditionLapseTime = ruleHelper.GetElement(ruleXML, "LapseTime"); businessRuleArr[i].Description = conditionLapseTime.Element("value").Value; XElement conditionLapseTimeType = ruleHelper.GetElement(ruleXML, "LapseTimeType"); businessRuleArr[i].RuleXML = conditionLapseTimeType.Element("value").Value; } } return(businessRuleArr); }
public List<BusinessRule> getBusinessRuleId(int clientID, int ruleId) { List<BusinessRule> businessRuleArr = new List<BusinessRule>(); BusinessRuleManager businessRuleManager = new BusinessRuleManager(); businessRuleArr = businessRuleManager.GetBusinessRuleThread(clientID, ruleId); for (var i = 0; i < businessRuleArr.Count; i++) { XElement ruleXML = XElement.Parse(businessRuleArr[i].RuleXML.ToString()); using (RuleHelper ruleHelper = new RuleHelper()) { XElement conditionLapseTime = ruleHelper.GetElement(ruleXML, "LapseTime"); businessRuleArr[i].Description = conditionLapseTime.Element("value").Value; XElement conditionLapseTimeType = ruleHelper.GetElement(ruleXML, "LapseTimeType"); businessRuleArr[i].RuleXML = conditionLapseTimeType.Element("value").Value; } } return businessRuleArr; }
public void bindData(BusinessRule businessRule) { int clientID = SessionHelper.getClientId(); ViewState["businessRuleID"] = businessRule.BusinessRuleID.ToString(); clearFields(); if (businessRule.BusinessRuleID == 0) { // for new rules only. cbxActive.Checked = true; carriers = CarrierManager.GetCarriers(clientID).ToList(); CollectionManager.FillCollection(ddlCarrier, "CarrierID", "CarrierName", carriers); } else { // edit XElement ruleXML = XElement.Parse(businessRule.RuleXML); cbxActive.Checked = businessRule.IsActive; cbxEmailAdjuster.Checked = businessRule.EmailAdjuster; cbxEmailSupervisor.Checked = businessRule.EmailSupervisor; txtDescription.Text = businessRule.Description; carriers = CarrierManager.GetCarriers(clientID).ToList(); CollectionManager.FillCollection(ddlCarrier, "CarrierID", "CarrierName", carriers); string str_query = @"SELECT * FROM BusinessRule WHERE BusinessRuleID = @BusinessRuleId "; using (SqlConnection conn = new SqlConnection(connectionString)) using (SqlCommand cmd = new SqlCommand(str_query, conn)) { cmd.Parameters.AddWithValue("@BusinessRuleId", businessRule.BusinessRuleID); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { BusinessRule businessRuleObj = new BusinessRule(); businessRuleObj.BusinessRuleID = Convert.ToInt32(reader["BusinessRuleID"]); if (reader["CarrierId"] == DBNull.Value) { ddlCarrierId = 0; } else { ddlCarrierId = Convert.ToInt32(reader["CarrierId"]); } } conn.Close(); } ddlCarrier.SelectedValue = Convert.ToString(ddlCarrierId); using (RuleHelper ruleHelper = new RuleHelper()) { XElement conditionLapseTime = ruleHelper.GetElement(ruleXML, "LapseTime"); txtDayHours.Value = conditionLapseTime.Element("value").Value; XElement conditionLapseTimeType = ruleHelper.GetElement(ruleXML, "LapseTimeType"); setValue(this.ddlhourday, conditionLapseTimeType.Element("value").Value); } } }