public void ValidateCRecordIfPatientDataIsNull() { //Arrange _target = new CRecordLogic(); CRecord cRecordRaw = new CRecord { ClaimId = "1.04.2", Sex = 1, FromDate = DateTime.Parse("09/12/2019"), ThruDate = DateTime.Parse("10/20/2019"), ConditionCodes = new List <string> { "20", "21", "22", "23", "24", "25", "26" }, BillType = "331", Npi = string.Empty, Oscar = string.Empty, PatientStatus = "1", OppsFlag = 1, OccurrenceCodes = null, PatientFirstName = "ANUPAMA", PatientLastName = "SAIRAM", PatientMiddleInitial = "A", BeneAmount = 50.35, BloodPint = 2, PatientData = null }; const string expected = ""; //Act string actual = _target.GetCRecordLine(cRecordRaw); //Assert Assert.AreEqual(actual, expected); }
public override bool UpdateGame() { for (int i = 0; i < CSettings.MaxNumPlayer; i++) { CRecord.AnalyzeBuffer(i); } _UpdateTextColors(); _SetEditVisibility(_PlayerEditActive); if (_DelayTest.Running) { _DelayTest.Update(); for (int p = 0; p < CSettings.MaxNumPlayer; ++p) { _Texts[_TextDelayPlayer[p]].Text = (_DelayTest.Delays[p] == 0) ? "––– ms" : _DelayTest.Delays[p].ToString("000") + " ms"; } } for (int p = 0; p < CSettings.MaxNumPlayer; ++p) { _ChannelEnergy[p] = CRecord.GetMaxVolume(p); _Equalizers[_EqualizerPlayer[p]].Update(CRecord.ToneWeigth(p), CRecord.GetMaxVolume(p)); } bool showWarning = !_CheckMicConfig(); _Statics[_StaticWarning].Visible = showWarning; _Texts[_TextWarning].Visible = showWarning; return(true); }
public IntelHex(TextReader tr) { List <CRecord> _list_records = new List <CRecord>(); string _record_string; uint _offset = 0; _address_min = uint.MaxValue; while ((_record_string = tr.ReadLine()) != null) { CRecord _record = new CRecord(_record_string); _list_records.Add(_record); if (_record.Type == EType.Data) { uint _amin = _record.Offset, _amax = _amin + _record.Length; if (_address_min > _amin) { _address_min = _amin; } if (_address_max < _amax) { _address_max = _amax; } } } _records = _list_records.ToArray(); }
private void _SaveMicConfig() { if (_Devices == null) { return; } CRecord.Stop(); if (_CheckMicConfig()) { for (int p = 0; p < CConfig.Config.Record.MicConfig.Length; p++) { CConfig.Config.Record.MicConfig[p].Channel = 0; } foreach (CRecordDevice device in _Devices) { for (int ch = 0; ch < (uint)device.Channels; ++ch) { if (device.PlayerChannel[ch] > 0) { CConfig.Config.Record.MicConfig[device.PlayerChannel[ch] - 1].Channel = ch + 1; CConfig.Config.Record.MicConfig[device.PlayerChannel[ch] - 1].DeviceName = device.Name; CConfig.Config.Record.MicConfig[device.PlayerChannel[ch] - 1].DeviceDriver = device.Driver; } } } CConfig.SaveConfig(); } CRecord.Start(); }
public override void OnClose() { base.OnClose(); CRecord.Stop(); _DelayTest.Reset(); }
protected void update_MetaContent() { _MetaContent = new ContentEditorDataHelper(); _MetaContent.load_Xml(Session["METADATA"].ToString()); this.txtMetaContentID.Text = _MetaContent.MetaContentID.ToString(); this.txtMetaContentAlias.Text = _MetaContent.Alias; if (_MetaContent.MetaContentID > 0) { int iCategoryId = _MetaContent.CategoryID; int iSectionId = (int)LegoWebAdmin.BusLogic.Categories.get_CATEGORY_BY_ID(iCategoryId).Tables[0].Rows[0]["SECTION_ID"]; load_Sections(iSectionId); load_Categories(iSectionId); dropCategories.SelectedValue = iCategoryId.ToString(); } DataTable marcTable = _MetaContent.get_MarcDatafieldTable(); CRecord labelRec = new CRecord(); labelRec.load_File(FileTemplateDataProvider.get_LabelTemplateFile(LegoWebAdmin.BusLogic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(dropCategories.SelectedValue.ToString())))); _MetaContent.set_DataTableLabel(ref marcTable, labelRec); repeater_DataBind(marcTable); this.radioRecordStatus.SelectedValue = _MetaContent.RecordStatus.ToString(); this.txtLocalCode.Text = _MetaContent.LocalCode; this.labelEntryDate.Text = _MetaContent.EntryDate; this.labelCreator.Text = _MetaContent.Creator; this.labelModifyDate.Text = _MetaContent.ModifyDate; this.labelModifier.Text = _MetaContent.Modifier; this.dropLanguages.SelectedValue = _MetaContent.LangCode; this.dropAccessLevels.SelectedValue = _MetaContent.AccessLevel.ToString(); this.dropImportantLevels.SelectedValue = _MetaContent.ImportantLevel.ToString(); if (_MetaContent.AccessLevel >= 2)//special permission { cblRoles.Visible = true; //get roles in formation string[] accessRoles = LegoWebAdmin.BusLogic.MetaContents.get_ACCESS_ROLES(_MetaContent.MetaContentID); if (accessRoles != null && accessRoles.Length > 0) { for (int i = 0; i < accessRoles.Length; i++) { for (int j = 0; j < cblRoles.Items.Count; j++) { if (cblRoles.Items[j].Value == accessRoles[i]) { cblRoles.Items[j].Selected = true; } } } } } else { cblRoles.Visible = false; } load_listAddTag(); this.txtAddValue.Attributes.Add("onClick", "changeInputID('" + this.txtAddValue.ClientID.ToString() + "'); return false;"); Session["METADATA"] = _MetaContent.OuterXml; }
//load workform for new record protected void create_NewMetaContent() { _MetaContent = new ContentEditorDataHelper(); _MetaContent.load_File(FileTemplateDataProvider.get_WorkformTemplateFile(LegoWebAdmin.BusLogic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(dropCategories.SelectedValue.ToString())))); _MetaContent.MetaContentID = 0; this.txtMetaContentAlias.Text = ""; this.radioRecordStatus.SelectedValue = _MetaContent.RecordStatus.ToString(); this.txtLocalCode.Text = _MetaContent.LocalCode; this.labelEntryDate.Text = DateTime.Now.ToString("dd-MMM-yyyy"); this.labelCreator.Text = this.Page.User.Identity.Name; this.labelModifyDate.Text = ""; this.labelModifier.Text = ""; this.dropLanguages.SelectedValue = _MetaContent.LangCode; this.dropAccessLevels.SelectedValue = _MetaContent.AccessLevel.ToString(); this.dropImportantLevels.SelectedValue = _MetaContent.ImportantLevel.ToString(); DataTable marcTable = _MetaContent.get_MarcDatafieldTable(); CRecord labelRec = new CRecord(); labelRec.load_File(FileTemplateDataProvider.get_LabelTemplateFile(LegoWebAdmin.BusLogic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(dropCategories.SelectedValue.ToString())))); _MetaContent.set_DataTableLabel(ref marcTable, labelRec); repeater_DataBind(marcTable); load_listAddTag(); this.txtAddValue.Attributes.Add("onClick", "changeInputID('" + this.txtAddValue.ClientID.ToString() + "'); return false;"); Session["METADATA"] = _MetaContent.OuterXml; }
private static void _CloseProgram() { // Unloading in reverse order try { CController.Close(); CVocaluxeServer.Close(); CGraphics.Close(); CThemes.Close(); CCover.Close(); CFonts.Close(); CBackgroundMusic.Close(); CWebcam.Close(); CDataBase.Close(); CVideo.Close(); CRecord.Close(); CSound.Close(); CDraw.Close(); } catch (Exception e) { CLog.LogError("Error during shutdown!", false, false, e); } GC.Collect(); // Do a GC run here before we close logs to have finalizers run try { CLog.Close(); // Do this last, so we get all log entries! } catch (Exception) {} Environment.Exit(Environment.ExitCode); }
public void BuildCRecordStringNotNullTest() { CRecord cRecordRaw = new CRecord { ClaimId = "1.04.2", Sex = 1, FromDate = DateTime.Parse("09/12/2019"), ThruDate = DateTime.Parse("10/20/2019"), ConditionCodes = new List <string> { "9", "10" }, BillType = "331", Npi = string.Empty, Oscar = string.Empty, PatientStatus = "1", OppsFlag = 1, OccurrenceCodes = new List <string> { "AB", "CD" }, PatientFirstName = "ANUPAMA", PatientLastName = "SAIRAM", PatientMiddleInitial = "A", BeneAmount = 50.35, BloodPint = 2 }; // cRecordRaw.ConditionCodes = new List<string> { "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "AB", "CD", "EF" }; // cRecordRaw.OccurrenceCodes = new List<string> { "AB", "CD", "EF", "GH", "IJ", "KL", "MN", "AB", "CD", "EF" }; // const string expected = "C1.04.2 01412019091220191020910 331 011ABCD SAIRAM ANUPAMA A00050352 "; string actual = CRecordLogic.BuildCRecordString(cRecordRaw); Assert.IsNotNull(actual); }
/// <summary> /// Demo code. /// You see, we can use natural C# obj.field syntax to access each CSV field, /// no need to touch any ugly/verbose/redundant number for csv column index. /// What a breeze! /// </summary> static void Demo_CsvLiner() { string headerline = CsvLiner <CRecord> .HeaderLine(); Console.WriteLine(headerline); CsvLiner <CRecord> .VerifyHeaderLine("FOOD,PRICE,QTY"); string csvinput1 = "Apple,1.5,100"; CRecord rec1 = CsvLiner <CRecord> .Get(csvinput1); string csvoutput1 = CsvLiner <CRecord> .Put(rec1); if (csvoutput1 == csvinput1) { Console.WriteLine(rec1.FOOD); Console.WriteLine(rec1.PRICE); Console.WriteLine(rec1.QTY); Console.WriteLine("OK. Match."); } string[] strcols = { "QTY", "PRICE", "FOOD" }; int[] idxcols = CsvLiner <CRecord> .Idx(strcols); Debug.Assert(idxcols[0] == 2 && idxcols[1] == 1 && idxcols[2] == 0); // If you are a freak insisting on existing symbols... string[] strcols2 = new string[] { CsvLiner <CRecord> .uso.QTY, CsvLiner <CRecord> .uso.PRICE, CsvLiner <CRecord> .uso.FOOD, }; int[] idxcols2 = CsvLiner <CRecord> .Idx(strcols2); Debug.Assert(idxcols2[0] == 2 && idxcols2[1] == 1 && idxcols2[2] == 0); CRecord r2 = CsvLiner <CRecord> .Get("10,Pear", new int[] { 2, 0 }); Debug.Assert(r2.FOOD == "Pear" && r2.PRICE == "" && r2.QTY == "10"); string s2 = CsvLiner <CRecord> .Put(r2, new int[] { 2, 0 }); Debug.Assert(s2 == "10,Pear"); // // Simplify typing a bit like this: // var cc = new CsvLiner <CRecordB>(); CRecordB rec2 = cc.get(csvinput1); string csvoutput2 = cc.put(rec2); Debug.Assert(csvoutput2 == csvinput1); Debug.Assert(cc.headerLine == headerline); Debug.Assert(cc.columns == CsvLiner <CRecord> .Columns()); }
private void _UpdateEqualizers() { for (int i = 0; i < CGame.NumPlayers; i++) { CRecord.AnalyzeBuffer(i); _Equalizers[_PlayerEqualizer[i]].Update(CRecord.ToneWeigth(i), CRecord.GetMaxVolume(i)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!String.IsNullOrEmpty(_box_css_name)) { if (_box_css_name.IndexOf("-title-") > 0) { string sBoxTop = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title)); string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>"; this.litBoxTop.Text = sBoxTop; this.litBoxBottom.Text = sBoxBottom; } else { string sBoxTop = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name); string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>"; this.litBoxTop.Text = sBoxTop; this.litBoxBottom.Text = sBoxBottom; } } DataTable cntData = LegoWebSite.Buslgic.MetaContents.get_MOST_READ_CONTENTS(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower()); if (cntData.Rows.Count > 0) { CRecord myRec = new CRecord(); CSubfield Sf = new CSubfield(); string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name); UrlQuery myPost = new UrlQuery(); if (!String.IsNullOrEmpty(_default_post_page)) { myPost = new UrlQuery(_default_post_page); } CRecords outRecs = new CRecords(); for (int i = 0; i < cntData.Rows.Count; i++) { int meta_content_id = (int)cntData.Rows[i]["META_CONTENT_ID"]; myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(meta_content_id, 0)); if (myRec.Datafields.Datafield("245").Subfields.get_Subfield("n", ref Sf)) { Sf.Value = cntData.Rows[i]["READ_COUNT"].ToString(); } else { Sf.ReConstruct(); Sf.Code = "n"; Sf.Value = cntData.Rows[i]["READ_COUNT"].ToString(); myRec.Datafields.Datafield("245").Subfields.Add(Sf); } myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString()); myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri; outRecs.Add(myRec); } this.litContent.Text = outRecs.XsltFile_Transform(sTemplateFileName); } } }
public override void OnShow() { base.OnShow(); CRecord.Start(); _NameSelections[_NameSelection].Init(); _LoadProfiles(); _SelectElement(_Buttons[_ButtonStart]); }
private void Answer_Click(object sender, EventArgs e) { TransitionManager.BeginDelayedTransition((ViewGroup)rootView, new ChangeText().SetChangeBehavior(ChangeText.ChangeBehaviorOutIn)); FButton btn = sender as FButton; if (btn.Text.Equals(correctAnswer.ToString())) { numberOfCorrectAnswers++; int colorFrom = Resources.GetColor(Resource.Color.transparent); int colorTo = Resources.GetColor(Resource.Color.fbutton_color_green_sea); ValueAnimator colorAnim = ObjectAnimator.OfInt(questionLayout, "backgroundColor", (int)colorFrom, (int)colorTo); colorAnim.SetDuration(500); colorAnim.SetEvaluator(new ArgbEvaluator()); colorAnim.RepeatCount = 1; colorAnim.RepeatMode = ValueAnimatorRepeatMode.Reverse; colorAnim.Start(); } else { int colorFrom = Resources.GetColor(Resource.Color.transparent); int colorTo = Resources.GetColor(Android.Resource.Color.HoloRedDark); ValueAnimator colorAnim = ObjectAnimator.OfInt(questionLayout, "backgroundColor", (int)colorFrom, (int)colorTo); colorAnim.SetDuration(500); colorAnim.SetEvaluator(new ArgbEvaluator()); colorAnim.RepeatCount = 1; colorAnim.RepeatMode = ValueAnimatorRepeatMode.Reverse; colorAnim.Start(); } if (question == 10) { timer.Stop(); startLayout.Visibility = ViewStates.Visible; igrajPonovoLayout.Visibility = ViewStates.Visible; brojTacnihNaKraju.Text = numberOfCorrectAnswers.ToString(); vremeNaKraju.Text = vremeResavanja.ToString(); CRecord record = new CRecord(); record.GameId = App.MathWithAnswersCode + (int)operacija; record.Result = numberOfCorrectAnswers; record.Time = vremeResavanja; App.db.InsertRecord(record); return; } SetValues(); question++; redniBrojZadatka.Text = question.ToString(); tacnihOdgovoraTW.Text = numberOfCorrectAnswers.ToString(); }
public void OnChange(CRecord entity, UpdateOperations operation) { switch (operation) { case UpdateOperations.Add: case UpdateOperations.Change: entity.ChangedDate = DateTime.Now; break; } }
private void LoadDictionary(string FileName) { _dic.ReadFile(@"Program Files\DictionaryForPPC\" + FileName); cmbWord.Items.Clear(); for (int count = 0; count < Math.Min(5, _dic.Count); count++) { CRecord rec = _dic[count]; cmbWord.Items.Add(rec.Word); } }
private void comboBox1_TextChanged(object sender, EventArgs e) { ComboBox cmb = (ComboBox)sender; int index = dic.FindWord(cmb.Text); if (index >= 0) { CRecord rec = dic[index]; textBox1.Text = rec.Meaning; } }
static void Main(string[] args) { var ctx = new ConcurrencyTestDataContext(); var entityA = new ARecord { Value = "[0] created payload" }; ctx.ARecords.Add(entityA); ctx.SaveChanges(); entityA.Value = string.Format("[1] updated payload at {0}", DateTime.Now); ctx.SaveChanges(); entityA.Value = string.Format("[2] updated payload at {0}", DateTime.Now); ctx.SaveChanges(); var entityB = new BRecord { Value = "[0] created payload" }; ctx.BRecords.Add(entityB); ctx.SaveChanges(); entityB.Value = string.Format("[1] updated payload at {0}", DateTime.Now); ctx.SaveChanges(); entityB.Value = string.Format("[2] updated payload at {0}", DateTime.Now); ctx.SaveChanges(); var entityC = new CRecord { Value = "[0] created payload" }; ctx.CRecords.Add(entityC); ctx.SaveChanges(); entityC.Value = string.Format("[1] updated payload at {0}", DateTime.Now); ctx.SaveChanges(); entityC.Value = string.Format("[2] updated payload at {0}", DateTime.Now); ctx.SaveChanges(); var newContext = new ConcurrencyTestDataContext(); entityC.Value = string.Format("[3] updated payload at {0} via new data context", DateTime.Now); newContext.Attach(entityC); newContext.SaveChanges(); }
public void BuildCRecordStringReturnsException() { //Arrange CRecord cRecordDataRaw = new CRecord { Sex = 1, OppsFlag = 1, BloodPint = 1, Dob = DateTime.Now.AddYears(-1).AddDays(1), ThruDate = DateTime.Now }; //Act string actual = CRecordLogic.BuildCRecordString(cRecordDataRaw); //Assert Assert.IsTrue(actual.Length > 0); }
public override bool UpdateGame() { for (int i = 0; i < CSettings.MaxNumPlayer; i++) { CRecord.AnalyzeBuffer(i); } if (_DelayTest.Running) { _DelayTest.Update(); for (int p = 0; p < CSettings.MaxNumPlayer; ++p) { _Texts[_TextDelayPlayer[p]].Text = (_DelayTest.Delays[p] == 0) ? "??? ms" : _DelayTest.Delays[p].ToString("000") + " ms"; } } if (_CheckMicConfig()) { for (int p = 0; p < CSettings.MaxNumPlayer; ++p) { if (_SelectSlides[_SelectSlideRecordPlayer[p]].Selection > 0) { _ChannelEnergy[p] = CRecord.GetMaxVolume(p); _Equalizers[_EqualizerPlayer[p]].Update(CRecord.ToneWeigth(p), CRecord.GetMaxVolume(p)); } else { _ChannelEnergy[p] = 0f; _Equalizers[_EqualizerPlayer[p]].Reset(); } } } else { for (int i = 0; i < _ChannelEnergy.Length; i++) { _ChannelEnergy[i] = 0f; } for (int p = 0; p < CSettings.MaxNumPlayer; ++p) { _Equalizers[_EqualizerPlayer[p]].Reset(); } } bool showWarning = !_CheckMicConfig(); _Statics[_StaticWarning].Visible = showWarning; _Texts[_TextWarning].Visible = showWarning; return(true); }
public static CRecord get_DataRecord(String sCategory, string sID) { CRecords myRecs = new CRecords(); String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml"; if (File.Exists(dataFileName)) { myRecs.load_File(dataFileName); } else { myRecs.Save(dataFileName); } if (myRecs.Count > 0) { switch (sID.ToLower()) { case "first": return(myRecs.Record(0)); break; case "last": return(myRecs.Record(myRecs.Count - 1)); break; default: int iID = int.Parse("0" + sID); myRecs.Filter("001", sID, true); if (myRecs.Count > 0) { return(myRecs.Record(0)); } else { CRecord myRec = new CRecord(); myRec.load_File(FileTemplateDataProvider.get_WorkformTemplateFile(sCategory)); return(myRec); } break; } } else { CRecord myRec1 = new CRecord(); myRec1.load_File(FileTemplateDataProvider.get_WorkformTemplateFile(sCategory)); return(myRec1); } }
public override bool UpdateGame() { if (_ProfilesChanged || _AvatarsChanged) { _LoadProfiles(); } for (int i = 1; i <= CGame.NumPlayers; i++) { CRecord.AnalyzeBuffer(i - 1); _Equalizers["EqualizerPlayer" + i].Update(CRecord.ToneWeigth(i - 1), CRecord.GetMaxVolume(i - 1)); } return(true); }
public void set_DataTableLabel(ref DataTable marcTable, CRecord labelRec) { for (int i = 0; i < marcTable.Rows.Count; i++) { if (int.Parse(marcTable.Rows[i]["TAG"].ToString()) < 10) { marcTable.Rows[i]["SUBFIELD_LABEL"] = labelRec.Controlfields.Controlfield(marcTable.Rows[i]["TAG"].ToString()).Value; } else { marcTable.Rows[i]["SUBFIELD_LABEL"] = labelRec.Datafields.Datafield(marcTable.Rows[i]["TAG"].ToString()).Subfields.Subfield(marcTable.Rows[i]["SUBFIELD_CODE"].ToString()).Value; } } }
protected void load_listAddTag() { string sWorkformName = LegoWebAdmin.BusLogic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(dropCategories.SelectedValue.ToString())); CRecord labelRec = new CRecord(); string labelFileName = FileTemplateDataProvider.get_LabelTemplateFile(sWorkformName); labelRec.load_File(labelFileName); listAddTag.Items.Clear(); for (int i = 0; i < labelRec.Datafields.Count; i++) { listAddTag.Items.Add(new ListItem(labelRec.Datafields.Datafield(i).Tag, labelRec.Datafields.Datafield(i).Tag)); } listAddTag.SelectedIndex = 0; listAddTag_SelectedIndexChanged(null, null); }
/// <summary> /// This Method is called for getting C Line values from DB /// </summary> private string GetCRecordLine(CRecord cRecordDataRaw) { if (cRecordDataRaw != null) { //We assume that cRecordDataRaw does not have any null properties. If the db returns null, the data access //layer will be replacing the nulls with string.Empty or 0. //REVIEW-MARCH This method has dependencies. Need to use DI. CRecordLogic cRecordLogic = new CRecordLogic(); if (cRecordLogic.ValidateCRecord(cRecordDataRaw)) { return(cRecordLogic.BuildCRecordString(cRecordDataRaw)); } } return(string.Empty); }
private void _Stop() { if (!Running) { return; } Running = false; _CloseStream(); foreach (SDelayChannel delay in _DelaysChannel) { if (delay.Channel >= 0) { CRecord.SetVolumeThreshold(delay.Channel, delay.OrigThreshold); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!String.IsNullOrEmpty(_box_css_name)) { if (_box_css_name.IndexOf("-title-") > 0) { DataTable catData = LegoWebSite.Buslgic.Categories.get_CATEGORY_BY_ID(_category_id).Tables[0]; if (catData.Rows.Count > 0) { this.Title = catData.Rows[0]["CATEGORY_" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToUpper() + "_TITLE"].ToString(); } string sBoxTop = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\"><a href=\"contentnavigator.aspx?catid={1}\">{2}</a></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, _category_id.ToString(), this.Title); string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>"; this.litBoxTop.Text = sBoxTop; this.litBoxBottom.Text = sBoxBottom; } else { string sBoxTop = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name); string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>"; this.litBoxTop.Text = sBoxTop; this.litBoxBottom.Text = sBoxBottom; } } DataTable cntData = LegoWebSite.Buslgic.MetaContents.get_TOP_CONTENTS_OF_CATEGORY(_category_id, _number_of_record, System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.ToLower()); UrlQuery myPost = new UrlQuery(); if (!String.IsNullOrEmpty(_default_post_page)) { myPost = new UrlQuery(_default_post_page); } string sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name); CRecords ouRecs = new CRecords(); for (int i = 0; i < cntData.Rows.Count; i++) { CRecord myRec = new CRecord(); myRec.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML((int)cntData.Rows[i]["META_CONTENT_ID"], 0)); myPost.Set("contentid", cntData.Rows[i]["META_CONTENT_ID"].ToString()); myRec.Controlfields.Controlfield("001").Value = myPost.AbsoluteUri; ouRecs.Add(myRec); } this.litContent.Text = ouRecs.XsltFile_Transform(sTemplateFileName); } }
protected void Page_Load(object sender, EventArgs e) { int metacontentid = 0; if (!IsPostBack) { if (!String.IsNullOrEmpty(_box_css_name)) { if (_box_css_name.IndexOf("-title-") > 0) { string sBoxTop = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title)); string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>"; this.litBoxTop.Text = sBoxTop; this.litBoxBottom.Text = sBoxBottom; } else { string sBoxTop = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name); string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>"; this.litBoxTop.Text = sBoxTop; this.litBoxBottom.Text = sBoxBottom; } } metacontentid = discover_content_id(); if (metacontentid == 0 || (metacontentid > 0 && !LegoWebSite.Buslgic.MetaContents.is_META_CONTENTS_EXIST(metacontentid))) { this.litContent.Text = "<H3>No suitable data!</H3>"; return; } CRecord myRec = new CRecord(); string sMetaXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(metacontentid, 1); myRec.load_Xml(sMetaXml); string sTemplateFileName; if (!string.IsNullOrEmpty(_template_name)) { sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(_template_name); } else { sTemplateFileName = LegoWebSite.DataProvider.FileTemplateDataProvider.get_XsltTemplateFile(LegoWebSite.Buslgic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(myRec.Controlfields.Controlfield("002").Value))); } string sOutHTML = myRec.XsltFile_Transform(sTemplateFileName); this.litContent.Text = sOutHTML; } }
public static void save_DataRecord(String sCategory, CRecord saveRecord) { saveRecord.Controlfields.Controlfield("005").Value = DateTime.Now.ToLongDateString(); CRecords myRecs = new CRecords(); String dataFileName = System.Configuration.ConfigurationManager.AppSettings["LegoWebFilesPhysicalPath"].ToString() + "File/Data/" + System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName + "\\" + sCategory + ".xml"; if (File.Exists(dataFileName)) { myRecs.load_File(dataFileName); } else { myRecs.Save(dataFileName); } CControlfield Cf = new CControlfield(); String sID = "0"; if (saveRecord.Controlfields.get_Controlfield("001", ref Cf)) { if (Cf.Value == "") { Cf.Value = "0"; } sID = Cf.Value; } else { Cf = new CControlfield(); Cf.Tag = "001"; Cf.Value = "0"; saveRecord.Controlfields.Add(Cf); } myRecs.Filter("001", sID, true); if (myRecs.Count > 0) { CRecord ptOldRec = myRecs.Record(0); myRecs.Replace(ref ptOldRec, ref saveRecord); } else { myRecs.Add(saveRecord); } myRecs.Save(dataFileName); }
/// <summary> /// Gets the c record line. /// </summary> /// <param name="cRecordDataRaw">The c record data raw.</param> /// <returns></returns> public string GetCRecordLine(CRecord cRecordDataRaw) { //We assume that cRecordDataRaw does not have any null properties. If the db returns null, the data access //layer will be replacing the nulls with string.Empty or 0. string cRecord; // Validating the C record ValidationErrors = ValidateCRecord(cRecordDataRaw); if (cRecordDataRaw != null && string.IsNullOrEmpty(ValidationErrors.Trim())) { cRecord = BuildCRecordString(cRecordDataRaw); } else { cRecord = string.Empty; } return(cRecord); }