protected void Page_Load(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); fundCode = bcContent.FundCode.ToString(); branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); fundCodeTextBox.Text = fundCode.ToString(); branchCodeTextBox.Text = branchCode.ToString(); CDSStatus = bcContent.CDS.ToString().ToUpper(); if (!IsPostBack) { incomeTaxFYDropDownList.DataSource = reportObj.getDtFY(fundCode); incomeTaxFYDropDownList.DataTextField = "F_YEAR"; incomeTaxFYDropDownList.DataValueField = "DIVI_NO"; incomeTaxFYDropDownList.DataBind(); fyPartDropDownList.DataSource = reportObj.getDtFYPart(fundCode); fyPartDropDownList.DataTextField = "FY_PART"; fyPartDropDownList.DataValueField = "FY_PART"; fyPartDropDownList.DataBind(); } }
public override List <SelectListItem> GetSelectList() { ItemVersion getVsn = VersionManager.Instance.CurrentVersion.Overlay(AllowedVersionsOverlay); VersionManager.Instance.PushState(VersioningMode.Specific, getVsn); try { var summaries = Collator.Instance.Get <Summary, object>(AssignableContentTypes, iq => iq); var slis = summaries.Select(s => new SelectListItem { Text = IsContentType ? s.Title : s.Title + " (" + BaseContent.ContentClassDisplayName(s.Type) + ")", Value = s.ItemVersionedId.Mask(AllowedVersionsOverlay).ToString(), Selected = (s.Id.ToString() == this.Id && s.Type == this.Type && s.Version.Mask(AllowedVersionsOverlay) == this.Version) }).OrderBy(sli => sli.Text).ToList(); bool noneSelected = !slis.Any(sli => sli.Selected); slis.Insert(0, new SelectListItem { Text = "", Value = "", Selected = noneSelected }); return(slis); } finally { VersionManager.Instance.PopState(); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); fundCodeTextBox.Text = fundCode.ToString(); branchCodeTextBox.Text = branchCode.ToString(); // toRegDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); // fromRegDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); ; ///holderDateofBirthTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); if (!IsPostBack) { } }
protected void Page_Load(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); regNoTextBox.Focus(); //saleDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); // holderDateofBirthTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); if (!IsPostBack) { CashAmountTextBox.Enabled = false; MultiplePayTypeTextBox.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { string fundCode = ""; string branchCode = ""; if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; fundCode = bcContent.FundCode.ToString(); branchCode = bcContent.BranchCode.ToString(); if (!IsPostBack) { fundNameDropDownList.DataSource = opendMFDAO.dtFundList(); fundNameDropDownList.DataTextField = "FUND_NM"; fundNameDropDownList.DataValueField = "FUND_CD"; fundNameDropDownList.DataBind(); branchNameDropDownList.DataSource = opendMFDAO.dtBranchList(); branchNameDropDownList.DataTextField = "BR_NM"; branchNameDropDownList.DataValueField = "BR_CD"; branchNameDropDownList.DataBind(); // assignBalance(fundCode); } }
private async Task RefreshCommandEvent() { try { List <SavedReport> reports = new List <SavedReport>(); bool permissionGranted = await AskForPermission(new Permissions.StorageRead()); if (permissionGranted) { string folderpath = DependencyService.Get <IFileHelper>().GetLocalFilePath(""); if (Directory.Exists(folderpath)) { string[] files = Directory.GetFiles(folderpath, "*.csv"); foreach (var file in files) { SavedReport savedReport = new SavedReport() { FilePath = file, FileName = Path.GetFileName(file), FileCreatedOn = File.GetCreationTime(file), }; reports.Add(savedReport); } Reports = reports.OrderByDescending(r => r.FileCreatedOn).ToList(); } } } catch (Exception ex) { await BaseContent.DisplayAlert("Error", ex.Message, "Ok"); } }
public static BaseContent GetContentObject(object contentOwner) { BaseContent contentObj = null; if (contentOwner is TextSection) { contentObj = new TextSectionContent(); } else if (contentOwner is ImageSection) { contentObj = new ImageSectionContent(); } else if (contentOwner is AudioSection || contentOwner is VideoSection || contentOwner is EmbeddedHtmlSection || contentOwner is GifSection) { contentObj = new TitleCaptionSectionContent(); } else if (contentOwner is ChatNode) { contentObj = new NodeContent(); } else if (contentOwner is Button) { contentObj = new ButtonContent(); } return(contentObj); }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); if (!IsPostBack) { fundNameDropDownList.DataSource = opendMFDAO.dtFundList(); fundNameDropDownList.DataTextField = "FUND_NM"; fundNameDropDownList.DataValueField = "FUND_CD"; fundNameDropDownList.DataBind(); DataTable dtChequeData = unitRepBLObj.dtGetChequePaymentData(" AND A.AUDITED_BY IS NULL"); SurrenderListGridView.DataSource = dtChequeData; SurrenderListGridView.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); FundCodeTextBox.Text = fundCode.ToString(); BranchCodeTextBox.Text = branchCode.ToString(); RegNoTextBox.Focus(); if (!IsPostBack) { //UnitRepurchase unitRepObj = new UnitRepurchase(); //regObj.BranchCode = BranchCodeTextBox.Text.Trim().ToUpper().ToString(); //regObj.FundCode = FundCodeTextBox.Text.Trim().ToUpper().ToString(); //RepNoTextBox.Text = unitRepBLObj.getMaxRepurchaseNo(regObj).ToString(); //unitRepObj.RepurchaseNo = unitRepBLObj.getMaxRepurchaseNo(regObj) - 1; //RepDateTextBox.Text = unitRepBLObj.getLastRepDate(regObj, unitRepObj).ToString("dd-MMM-yyyy"); //RepRateTextBox.Text = unitRepBLObj.getLastRepRate(regObj, unitRepObj).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); fundCodeTextBox.Text = fundCode.ToString(); branchCodeTextBox.Text = branchCode.ToString(); regNoTextBox.Focus(); //saleDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); // holderDateofBirthTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); if (!IsPostBack) { regObj.FundCode = fundCode.ToString(); regObj.BranchCode = branchCode.ToString(); // renewalNumberTextBox.Text = opendMFDAO.GetMaxSaleNo(regObj).ToString(); // renewalDateTextBox.Text = opendMFDAO.getLastSaleDate(regObj).ToString("dd-MMM-yyyy"); // totalUnitsTextBox.Text = opendMFDAO.getLastSaleRate(regObj).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); fundCodeTextBox.Text = fundCode.ToString(); branchCodeTextBox.Text = branchCode.ToString(); saleNumberTextBox.Focus(); //saleDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); // holderDateofBirthTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); if (!IsPostBack) { bankNameDropDownList.DataSource = opendMFDAO.dtFillBankName(" CATE_CODE=1 "); bankNameDropDownList.DataTextField = "BANK_NAME"; bankNameDropDownList.DataValueField = "BANK_CODE"; bankNameDropDownList.DataBind(); CashAmountTextBox.Enabled = false; MultiplePayTypeTextBox.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); fundCodeTextBox.Text = fundCode.ToString(); branchCodeTextBox.Text = branchCode.ToString(); if (!IsPostBack) { DataTable dtOccupationList = opendMFDAO.dtOccopationList(); nomiOccupationDropDownList.DataSource = dtOccupationList; nomiOccupationDropDownList.DataTextField = "DESCR"; nomiOccupationDropDownList.DataValueField = "CODE"; nomiOccupationDropDownList.DataBind(); } }
public static BaseContent GetContentObjectV2(object contentOwner) { BaseContent contentObj = null; if (contentOwner is Section sec) { switch (sec.SectionType) { case SectionTypeEnum.Image: contentObj = new ImageSectionContent(); break; case SectionTypeEnum.Text: contentObj = new TextSectionContent(); break; default: contentObj = new TitleCaptionSectionContent(); break; } } else if (contentOwner is ChatNode) { contentObj = new NodeContent(); } else if (contentOwner is Button) { contentObj = new ButtonContent(); } return(contentObj); }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); regNoTextBox.Focus(); if (!IsPostBack) { fundCodeDDL.DataSource = reportObj.dtFundCodeList(); fundCodeDDL.DataTextField = "NAME"; fundCodeDDL.DataValueField = "ID"; fundCodeDDL.SelectedValue = fundCode.ToString(); fundCodeDDL.DataBind(); branchCodeDDL.DataSource = reportObj.dtBranchCodeList(); branchCodeDDL.DataTextField = "NAME"; branchCodeDDL.DataValueField = "ID"; branchCodeDDL.SelectedValue = branchCode.ToString(); branchCodeDDL.DataBind(); dateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); FundCodeTextBox.Text = fundCode.ToString(); BranchCodeTextBox.Text = branchCode.ToString(); if (!IsPostBack) { regObj.FundCode = fundCode.ToString(); regObj.BranchCode = branchCode.ToString(); moneyReceipDropDownList.DataSource = unitSaleBLObj.dtMoneyRecieptforDDL(" AND REG_BK = '" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR = '" + regObj.BranchCode.ToString().ToUpper() + "'AND RECEIPT_TYPE = 'REP' AND SL_REP_TR_RN_NO IS NULL ORDER BY RECEIPT_NO DESC "); moneyReceipDropDownList.DataTextField = "RECEIPT_NO"; moneyReceipDropDownList.DataValueField = "ID"; moneyReceipDropDownList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); fundCodeTextBox.Text = fundCode.ToString(); branchCodeTextBox.Text = branchCode.ToString(); // toRegDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); // fromRegDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); ; ///holderDateofBirthTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); if (!IsPostBack) { LienbankNameDropDownList.DataSource = opendMFDAO.dtFillBankName(); LienbankNameDropDownList.DataTextField = "BANK_NAME"; LienbankNameDropDownList.DataValueField = "BANK_CODE"; LienbankNameDropDownList.DataBind(); } else { } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); //spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); if (!IsPostBack) { fundNameDropDownList.DataSource = opendMFDAO.dtFundList(); fundNameDropDownList.DataTextField = "FUND_NM"; fundNameDropDownList.DataValueField = "FUND_CD"; fundNameDropDownList.DataBind(); BEFTNDateDropDownList.DataSource = unitRepBLObj.dtBEFTNDateList("0"); BEFTNDateDropDownList.DataTextField = "NAME"; BEFTNDateDropDownList.DataValueField = "ID"; BEFTNDateDropDownList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); // spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); // fundCodeTextBox.Text = fundCode.ToString(); // branchCodeTextBox.Text = branchCode.ToString(); if (!IsPostBack) { fundNameDropDownList.DataSource = opendMFDAO.dtFundList(); fundNameDropDownList.DataTextField = "FUND_NM"; fundNameDropDownList.DataValueField = "FUND_CD"; fundNameDropDownList.DataBind(); branchNameDropDownList.DataSource = opendMFDAO.dtBranchList(); branchNameDropDownList.DataTextField = "BR_NM"; branchNameDropDownList.DataValueField = "BR_CD"; branchNameDropDownList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); fundCode = bcContent.FundCode.ToString(); branchCode = bcContent.BranchCode.ToString(); // spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); FundCodeTextBox.Text = fundCode.ToString(); BranchCodeTextBox.Text = branchCode.ToString(); RegNoTextBox.Focus(); if (!IsPostBack) { LienbankNameDropDownList.DataSource = opendMFDAO.dtFillBankName(); LienbankNameDropDownList.DataTextField = "BANK_NAME"; LienbankNameDropDownList.DataValueField = "BANK_CODE"; LienbankNameDropDownList.DataBind(); SignatoryDropDownList.DataSource = reportObj.dtFillSignatory(); SignatoryDropDownList.DataTextField = "NAME"; SignatoryDropDownList.DataValueField = "ID"; SignatoryDropDownList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; DataTable dtReportStatement = (DataTable)Session["dtPriceInfo"]; string fundCode = (string)Session["fundCode"]; if (dtReportStatement.Rows.Count > 0) { // dtReportStatement.WriteXmlSchema(@"D:\Project\Web\AMCL.OPENMF\AMCL.REPORT\XMLSCHEMAS\dtPriceRefixation.xsd"); CR_PRICE.Refresh(); CR_PRICE.SetDataSource(dtReportStatement); CR_PRICE.SetParameterValue("fudnName", opendMFDAO.GetFundName(fundCode.ToString())); CrystalReportViewer1.ReportSource = CR_PRICE; } else { Response.Write("No data found"); } }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); string fundCode = bcContent.FundCode.ToString(); string branchCode = bcContent.BranchCode.ToString(); spanFundName.InnerText = opendMFDAO.GetFundName(fundCode.ToString()); tferorFundCodeTextBox.Text = fundCode.ToString(); tferorBranchCodeTextBox.Text = branchCode.ToString(); tfereeFundCodeTextBox.Text = fundCode.ToString(); tfereeBranhCodeTextBox.Text = branchCode.ToString(); if (!IsPostBack) { tferorRegNoTextBox.Focus(); transferDateTextBox.Text = DateTime.Today.ToString("dd-MMM-yyyy"); } }
protected void Page_Load(object sender, EventArgs e) { UnitHolderRegistration regObj = new UnitHolderRegistration(); if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; userObj.UserID = bcContent.LoginID.ToString(); if (!IsPostBack) { fundNameDropDownList.DataSource = opendMFDAO.dtFundList(); fundNameDropDownList.DataTextField = "FUND_NM"; fundNameDropDownList.DataValueField = "FUND_CD"; fundNameDropDownList.DataBind(); refixationDateFromDropDownList.DataSource = reportObj.dtFillFixationDate(" "); refixationDateFromDropDownList.DataTextField = "NAME"; refixationDateFromDropDownList.DataValueField = "ID"; refixationDateFromDropDownList.SelectedValue = "0"; refixationDateFromDropDownList.DataBind(); refixationDateToDropDownList.DataSource = reportObj.dtFillFixationDate(" "); refixationDateToDropDownList.DataTextField = "NAME"; refixationDateToDropDownList.DataValueField = "ID"; refixationDateToDropDownList.SelectedValue = "0"; refixationDateToDropDownList.DataBind(); effectiveDateFromDropDownList.DataSource = reportObj.dtFillFixationDate(" "); effectiveDateFromDropDownList.DataTextField = "NAME"; effectiveDateFromDropDownList.DataValueField = "ID"; effectiveDateFromDropDownList.SelectedValue = "0"; effectiveDateFromDropDownList.DataBind(); effectiveDateToDropDownList.DataSource = reportObj.dtFillFixationDate(" "); effectiveDateToDropDownList.DataTextField = "NAME"; effectiveDateToDropDownList.DataValueField = "ID"; effectiveDateToDropDownList.SelectedValue = "0"; effectiveDateToDropDownList.DataBind(); DataTable dtFundInfoDetails = reportObj.dtFundInfoDetails(" "); DataTable dtPriceDetails = dtPriceDetails = reportObj.dtPriceDetails(" AND FUND_CD='" + dtFundInfoDetails.Rows[0]["FUND_CD"].ToString().ToUpper() + "' AND REFIX_DT=(SELECT MAX (REFIX_DT) FROM PRICE_REFIX WHERE FUND_CD='" + dtFundInfoDetails.Rows[0]["FUND_CD"].ToString().ToUpper() + "') "); for (int looper = 1; looper < dtFundInfoDetails.Rows.Count; looper++) { DataTable dtprice = reportObj.dtPriceDetails(" AND FUND_CD='" + dtFundInfoDetails.Rows[looper]["FUND_CD"].ToString().ToUpper() + "' AND REFIX_DT=(SELECT MAX (REFIX_DT) FROM PRICE_REFIX WHERE FUND_CD='" + dtFundInfoDetails.Rows[looper]["FUND_CD"].ToString().ToUpper() + "') "); dtPriceDetails.Merge(dtprice); } dvGridSurrender.Visible = true; SurrenderListGridView.DataSource = dtPriceDetails; SurrenderListGridView.DataBind(); } }
protected static BaseContent Biodata() { if (_Biodata == null) { _Biodata = new Biodata(); } return(_Biodata); }
protected static BaseContent Courses() { if (_Courses == null) { _Courses = new Courses(); } return(_Courses); }
public static string GetContentFullUrl(this BaseContent model) { var parents = model.Parents.Select(b => b.Url).ToList(); parents.Reverse(); parents.Add(model.Url); return(String.Join("/", parents)); }
protected static BaseContent Attendance() { if (_Attendance == null) { _Attendance = new Attendance(); } return(_Attendance); }
protected static BaseContent ucEvents() { if (_ucEvent == null) { _ucEvent = new ucEvent(); } return(_ucEvent); }
private void ContentItemAdded(BaseContent item) { if (item == null) { return; } MongoHelper.Current.Contents.Add(item as BaseContent); }
protected void Page_Load(object sender, EventArgs e) { if (BaseContent.IsSessionExpired()) { Response.Redirect("../Default.aspx"); return; } bcContent = (BaseClass)Session["BCContent"]; }
public void ContentItemAddExternal(BaseContent item) { if (item == null) { return; } PreProccessAddingItem(item); Items.Add(item); ContentItemAdded(item); }
/// <summary> /// Compute the desired result based on the formula /// </summary> /// <param name="poi"></param> /// <param name="sqlInputParameters"></param> /// <param name="updateMathFormula">If true, forces to re-evaluate the math formula.</param> /// <returns></returns> public double ComputeDesiredResult(BaseContent poi, List<SqlInputParameter> sqlInputParameters, bool updateMathFormula = false) { if (updateMathFormula) currentMathFormula = null; var mathFormula = MathFormula(sqlInputParameters); return CalculateResult(poi, mathFormula); }
/// <summary> /// Calculate the results using the created formula. /// Note that you can have up to 8 parameters. /// </summary> /// <param name="bc"></param> /// <param name="mathFormula"></param> /// <returns>The computed result.</returns> private double CalculateResult(BaseContent bc, object mathFormula) { var parameters = new double[inputParameters.Count]; for (var i = 0; i < parameters.Length; i++) { var sqlInputParameter = inputParameters[i]; switch (sqlInputParameter.Type) { case SqlParameterTypes.Label: parameters[i] = bc.LabelToDouble(sqlInputParameter.LabelName); break; case SqlParameterTypes.Sensor: parameters[i] = GetSensorValue(bc, sqlInputParameter.LabelName); break; } } var result = 0d; switch (parameters.Length) { case 2: { var formula = mathFormula as Func<double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1]); break; } case 3: { var formula = mathFormula as Func<double, double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2]); break; } case 4: { var formula = mathFormula as Func<double, double, double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3]); break; } case 5: { var formula = mathFormula as Func<double, double, double, double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4]); break; } case 6: { var formula = mathFormula as Func<double, double, double, double, double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5]); break; } case 7: { var formula = mathFormula as Func<double, double, double, double, double, double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6]); break; } case 8: { var formula = mathFormula as Func<double, double, double, double, double, double, double, double, double>; result = formula == null ? 0 : formula(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4], parameters[5], parameters[6], parameters[7]); break; } } if (string.IsNullOrEmpty(DesiredResultLabel)) return result; bc.Labels[DesiredResultLabel] = result.ToString(CultureInfo.InvariantCulture); Caliburn.Micro.Execute.OnUIThread(() => bc.TriggerLabelChanged(DesiredResultLabel)); return result; }
///// <summary> ///// Try to parse the label to a double using either the invariant or the Dutch culture. ///// </summary> ///// <param name="bc"></param> ///// <param name="key"></param> ///// <returns></returns> //private static double ParseLabelToDouble(BaseContent bc, string key) //{ // if (!bc.Labels.ContainsKey(key)) return 0; // double fvalue; // if (double.TryParse(bc.Labels[key], NumberStyles.Any, CultureInfo.InvariantCulture, out fvalue)) return fvalue; // double.TryParse(bc.Labels[key], NumberStyles.Any, new CultureInfo("NL-nl"), out fvalue); // return fvalue; //} private static double GetSensorValue(BaseContent bc, string key) { var fvalue = 0d; if (bc.Sensors.Count > 0 && bc.Sensors.ContainsKey(key)) fvalue = bc.Sensors[key].FocusValue; return fvalue; }
private void AddOutputsAsLabel(BaseContent refPoi, IDataRecord dr) { foreach (var output in OutputParameters.Where(p => p.OutputType == SqlOutputType.Label)) { var oldValue = refPoi.Labels.ContainsKey(output.Name) ? refPoi.Labels[output.Name] : string.Empty; var strings = dr[output.Name] as string[]; if (strings != null) { refPoi.Labels[output.Name] = string.Join("\r\n", strings); //refPoi.Labels[output.Name] = ""; //foreach (var str in strings) // refPoi.Labels[output.Name] += str + "\r\n"; } else if (dr[output.Name] == null) return; else refPoi.Labels[output.Name] = dr[output.Name].ToString(); var name = output.Name; if (!string.Equals(oldValue, refPoi.Labels[output.Name])) Caliburn.Micro.Execute.OnUIThread(() => refPoi.TriggerLabelChanged(name)); } }