Esempio n. 1
0
        public ActionResult UpdateExpinfo()
        {
            JobResumeExp er = new JobResumeExp();

            er.skills     = Request["skills"];
            er.minsalary  = Convert.ToInt32(Request["minsalary"]);
            er.expsummary = Request["expsum"];
            er.expyrs     = Request["expyrs"];
            er.cemployer  = Request["currentemp"];
            er.cdes       = Request["currentdes"];
            er.expcorg    = Request["exporg"];
            er.rescjob    = Request["respcjob"];
            er.userId     = uid;
            PreviousHistory ph = new PreviousHistory();

            ph.pemployer = Request["prevemp"];
            ph.pdes      = Request["prevdes"];
            ph.expporg   = Request["prevexporg"];
            ph.resppjob  = Request["respprevjob"];
            string date = Request["dolj"];

            ph.dateofleaving = Convert.ToDateTime(date);
            ph.userid        = uid;

            ExpInfo obj = new ExpInfo();

            obj.updateExpInfo(er, ph);
            getAllLists obj2 = new getAllLists();

            ViewBag.Cities     = obj2.getCities();
            ViewBag.Countaries = obj2.getCountaries();
            ViewBag.Degrees    = obj2.getDegrees();
            ViewBag.Institutes = obj2.getInstitutes();
            BasicInfo b  = new BasicInfo();
            ExpInfo   e1 = new ExpInfo();
            ExtraInfo e2 = new ExtraInfo();

            ViewBag.isBasicInfoExist = b.isBasicInfoFound(uid);
            if (ViewBag.isBasicInfoExist)
            {
                ViewBag.allBasicInfo = b.getBasicInfo(uid);
            }
            ViewBag.isExpInfoExist = e1.isExpInfoFound(uid);
            if (ViewBag.isExpInfoExist)
            {
                ViewBag.allExpInfo = e1.getExpInfo(uid);
                ViewBag.allPreExp  = e1.getPreviousHistory(uid);
            }
            ViewBag.isExtraInfoExist = e2.isExtraInfoFound(uid);
            if (ViewBag.isExtraInfoExist)
            {
                ViewBag.allExraInfo = e2.getExtraInfo(uid);
            }

            UserInfo u = new UserInfo();

            ViewBag.UserInfo = u.getUserInfo(uid);

            return(View("Update"));
        }
Esempio n. 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RequestId.Length != 0)
            {
                hash ^= RequestId.GetHashCode();
            }
            if (EventId.Length != 0)
            {
                hash ^= EventId.GetHashCode();
            }
            if (createTime_ != null)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (eventCase_ == EventOneofCase.JobEvent)
            {
                hash ^= JobEvent.GetHashCode();
            }
            if (eventCase_ == EventOneofCase.ProfileEvent)
            {
                hash ^= ProfileEvent.GetHashCode();
            }
            hash ^= ExtraInfo.GetHashCode();
            hash ^= (int)eventCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 3
0
        protected void HandleException_Click(object sender, EventArgs e)
        {
            var extra = new ExtraInfo
            {
                CheckBoxListFilterItem1 = MFilter1.Text,
                CheckBoxListFilterItem2 = MFilter2.Text,
                DropDownListFilterItem1 = SFilter1.Text,
                DropDownListFilterItem2 = SFilter2.Text,
                TextBoxFilterItem1      = TFilter1.Text,
                TextBoxFilterItem2      = TFilter2.Text,
            };
            Stopwatch sw = Stopwatch.StartNew();

            for (int i = 0; i < int.Parse(Count.Text); i++)
            {
                if (string.IsNullOrEmpty(InnerExceptionMessage.Text))
                {
                    new Exception(ExceptionMessage.Text).Handle(ModuleName.Text, Category.Text, SubCategory.Text, ExceptionDescription.Text, extra);
                }
                else
                {
                    new Exception(ExceptionMessage.Text, new NullReferenceException(InnerExceptionMessage.Text)).Handle(ModuleName.Text, Category.Text, SubCategory.Text, ExceptionDescription.Text, extra);
                }
            }
            Result.Text = sw.ElapsedMilliseconds.ToString();
        }
Esempio n. 4
0
        public ActionResult Update()
        {
            getAllLists obj = new getAllLists();

            ViewBag.Cities     = obj.getCities();
            ViewBag.Countaries = obj.getCountaries();
            ViewBag.Degrees    = obj.getDegrees();
            ViewBag.Institutes = obj.getInstitutes();
            BasicInfo b  = new BasicInfo();
            ExpInfo   e1 = new ExpInfo();
            ExtraInfo e2 = new ExtraInfo();

            ViewBag.isBasicInfoExist = b.isBasicInfoFound(uid);
            if (ViewBag.isBasicInfoExist)
            {
                ViewBag.allBasicInfo = b.getBasicInfo(uid);
            }
            ViewBag.isExpInfoExist = e1.isExpInfoFound(uid);
            if (ViewBag.isExpInfoExist)
            {
                ViewBag.allExpInfo = e1.getExpInfo(uid);
                ViewBag.allPreExp  = e1.getPreviousHistory(uid);
            }
            ViewBag.isExtraInfoExist = e2.isExtraInfoFound(uid);
            if (ViewBag.isExtraInfoExist)
            {
                ViewBag.allExraInfo = e2.getExtraInfo(uid);
            }

            UserInfo u = new UserInfo();

            ViewBag.UserInfo = u.getUserInfo(uid);

            return(View());
        }
Esempio n. 5
0
        /// <summary>Sets the Character's selected GameObject</summary>
        internal GameObject this[Character chr]
        {
            get { return(chr.ExtraInfo.SelectedGO); }
            set
            {
                ExtraInfo extraInfo = chr.ExtraInfo;
                Deselect(extraInfo);
                if (value == null)
                {
                    return;
                }
                GOSelection selection = new GOSelection(value);
                if (MarkerId != SpellId.None)
                {
                    DynamicObject marker = new DynamicObject(chr, MarkerId, MarkerRadius,
                                                             value.Map, value.Position);
                    selection.Marker = marker;
                    marker.CallPeriodically(2000, obj =>
                    {
                        if (chr.IsInWorld && chr.Map == marker.Map && (selection.GO != null && selection.GO.IsInWorld))
                        {
                            return;
                        }
                        marker.Delete();
                    });
                }

                extraInfo.m_goSelection = selection;
            }
        }
Esempio n. 6
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttribute(ATTR.format_version, FormatVersion.AsDouble());
            writer.WriteAttribute(ATTR.time_stamp, TimeStamp.ToUniversalTime().ToString(CultureInfo.InvariantCulture));
            writer.WriteAttribute(ATTR.user, User);

            writer.WriteAttribute(ATTR.insert_undo_redo, InsertUndoRedoIntoAllInfo);

            if (CountEntryType.HasValue)
            {
                writer.WriteAttribute(ATTR.count_type, CountEntryType);
            }

            if (!string.IsNullOrEmpty(Reason))
            {
                writer.WriteElementString(EL.reason, Reason);
            }

            if (!string.IsNullOrEmpty(ExtraInfo))
            {
                writer.WriteElementString(EL.extra_info, ExtraInfo.EscapeNonPrintableChars());
            }

            writer.WriteElement(EL.message, UndoRedo);
            writer.WriteElement(EL.message, Summary);

            var startIndex = InsertUndoRedoIntoAllInfo ? 1 : 0;

            for (var i = startIndex; i < _allInfo.Count; ++i)
            {
                writer.WriteElement(EL.message, _allInfo[i]);
            }
        }
Esempio n. 7
0
        public void StartPerformanceMeasure(string name, string categoryName, string subcategoryName, ExtraInfo extraInfo = null)
        {
            try
            {
                if (!AppInfoCenterConfiguration.GetConfig().PerformanceServiceConfig.PerformanceMeasureConfig.Enabled) return;
                if (HttpContext.Current == null) return;
                Dictionary<string, PerformanceInfo> info = HttpContext.Current.Items[AppInfoCenterConfiguration.Const.ContextPerformanceMeasureKey] as Dictionary<string, PerformanceInfo>;
                if (info == null) info = new Dictionary<string, PerformanceInfo>();

                if (!info.ContainsKey(name))
                {
                    info.Add(name, new PerformanceInfo
                    {
                        Name = name,
                        sw = Stopwatch.StartNew(),
                        threadTime = GetCurrentThreadTimes(),
                        PerformancePoints = new Dictionary<string, PerformancePoint>(),
                    });
                }
                HttpContext.Current.Items[AppInfoCenterConfiguration.Const.ContextPerformanceMeasureKey] = info;
            }
            catch (Exception ex)
            {
                ex.Handle(AppInfoCenterService.ModuleName, ServiceName, "StartPerformanceMeasure");
            }
        }
Esempio n. 8
0
    public IEnumerator Extra(int num, int amount, ExtraCallback callBack = null)
    {
        if (num <= 0 || isDrawing || amount <= 0)
        {
            yield return(null);
        }
        isDrawing = true;
        mResult   = null;
        string url = string.Format("{0}?num={1}&amount={2}", DrawExtraURL, num, amount);

        using (UnityWebRequest webReqest = UnityWebRequest.Get(url))
        {
            yield return(webReqest.SendWebRequest());

            if (webReqest.isNetworkError)
            {
                Debug.Log("网络连接错误");
            }
            isDrawing = false;
            string value = webReqest.downloadHandler.text;
            mResult = PersonInfo.ToPersionInfo(value);
            List <List <PersonInfo> > typeList = null;
            if (!mCurrentInfos.TryGetValue(EType.eExtra, out typeList))
            {
                typeList = new List <List <PersonInfo> >();
                typeList.Add(new List <PersonInfo>());
                mCurrentInfos.Add(EType.eExtra, typeList);
            }
            typeList[0].AddRange(mResult);
            callBack?.Invoke(mResult, ExtraInfo.FromString(value));
        }
    }
Esempio n. 9
0
        /// <summary>
        /// Asynchronous export item's properties
        /// </summary>
        /// <returns>An <see cref="ExportableCI"/> instance containing all relevant properties</returns>
        public async Task <ExportableFixtureCI> ExportAsync()
        {
            var scheduledTasks = ScheduledStartTimeChanges?.Select(async s => await((ScheduledStartTimeChange)s).ExportAsync().ConfigureAwait(false)).ToList();

            if (!scheduledTasks.IsNullOrEmpty())
            {
                await Task.WhenAll(scheduledTasks).ConfigureAwait(false);
            }
            var channelTasks = TvChannels?.Select(async c => await((TvChannel)c).ExportAsync().ConfigureAwait(false)).ToList();

            return(new ExportableFixtureCI
            {
                ExtraInfo = ExtraInfo?.ToDictionary(i => i.Key, i => i.Value),
                CoverageInfo = CoverageInfo != null?await((CoverageInfo)CoverageInfo).ExportAsync().ConfigureAwait(false) : null,
                                   ProductInfo = ProductInfo != null?await((ProductInfo)ProductInfo).ExportAsync().ConfigureAwait(false) : null,
                                                     ReplacedBy = ReplacedBy?.ToString(),
                                                     References = References?.References?.ToDictionary(r => r.Key, r => r.Value),
                                                     NextLiveTime = NextLiveTime,
                                                     StartTimeConfirmed = StartTimeConfirmed,
                                                     ScheduledStartTimeChanges = scheduledTasks.IsNullOrEmpty() ? null : scheduledTasks.Select(s => s.Result).ToList(),
                                                     StartTime = StartTime,
                                                     TvChannels = channelTasks.IsNullOrEmpty() ? null : channelTasks.Select(s => s.Result).ToList(),
                                                     StartTimeTBD = StartTimeTBD,
                                                     ParentStageId = ParentStageId?.ToString(),
                                                     AdditionalParentsIds = AdditionalParentsIds?.Select(s => s.ToString()).ToList()
            });
        }
Esempio n. 10
0
 private ExtraInfo OnImageInfo()
 {
     if (_extraInfo == null)
     {
         _extraInfo = new ExtraInfo();
     }
     return(_extraInfo);
 }
 ExtraInfo OnImageInfo()
 {
     if (extraInfo == null)
     {
         extraInfo = new ExtraInfo();
     }
     return(extraInfo);
 }
Esempio n. 12
0
        public ActionResult Summary(string table)
        {
            var m = ExtraInfo.CodeSummary(table);
            var c = DbUtil.Db.Content("StandardExtraValues2", "<Views />", ContentTypeCode.TypeText);

            ViewBag.EvSpecId = c.Id;
            return(View("Reports/Summary", m));
        }
Esempio n. 13
0
 public ClousotOutput(ProofOutcome?outcome, string msg, TextSpan span, Tuple <int, int> startPoint, ICodeAction action, ExtraInfo extraInfo)
 {
     this.outcome    = outcome;
     this.Message    = msg;
     this.Span       = span;
     this.startPoint = startPoint;
     this.action     = action;
     this.extraInfo  = extraInfo;
 }
        private async void Add_medicijn_btn_Click_1(object sender, EventArgs e)
        {
            SoundPlayer Popup = new SoundPlayer(Properties.Resources.Popup);

            Popup.Play();
            ToevoegenMessageBox CustomMB = new ToevoegenMessageBox();

            if (!masterPage.IsLightmode)
            {
                CustomMB.ForeColor = Color.White;
                CustomMB.BackColor = Color.FromArgb(75, 79, 78);
                CustomMB.SetButtonColors(Color.White, Color.FromArgb(75, 79, 78), Color.FromArgb(55, 58, 64));
                CustomMB.SetWarningLabel(Properties.Resources.AlertDark3);
            }
            CustomMB.StartPosition = FormStartPosition.CenterParent;
            CustomMB.ShowDialog();
            if (CustomMB.DialogResult == DialogResult.Yes)
            {
                CustomMB.Dispose();

                string New_medical     = Naam_Medicijn_txt.Text;
                int    New_Aantal      = Convert.ToInt32(Aantal_txt.Text);
                double New_Gewicht     = Convert.ToDouble(Gewicht_txt.Text);
                string CurrentDate     = DateTime.Now.ToString("yyyy-MM-dd");
                string New_Type        = Type_medicijn_cb.Text;
                var    New_Leverancier = leverancier_txt.Text;
                int    ExpiryMonth     = Convert.ToInt32(DateTime.Now.ToString("MM")) + 2;
                int    ExpiryYear      = Convert.ToInt32(DateTime.Now.ToString("yyyy"));
                int    Month           = Convert.ToInt32(ExpiryMonth);

                if (Month > 12)
                {
                    ExpiryYear = ExpiryYear + 1;
                    Month      = Month - 12;
                }
                string ExpiryDate = DateTime.Now.ToString($"{ExpiryYear}-{Month}-dd");

                var NewProduct   = new Product(New_medical, New_Aantal, New_Gewicht, CurrentDate, ExpiryDate);
                var NewExtraInfo = new ExtraInfo(New_Type, New_Leverancier);
                Naam_Medicijn_txt.Text         = " ";
                Aantal_txt.Text                = " ";
                Gewicht_txt.Text               = " ";
                Type_medicijn_cb.SelectedIndex = -1;
                leverancier_txt.Text           = " ";

                await Task.WhenAll(order.InsertNewProductAsync(NewProduct, NewExtraInfo, masterPage.CurrentUser));

                _ = order.GetTablesAsync(masterPage.CurrentUser);
            }

            if (CustomMB.DialogResult == DialogResult.No)
            {
                SoundPlayer Incorrect = new SoundPlayer(Properties.Resources.Error);
                Incorrect.Play();
                CustomMB.Dispose();
            }
        }
Esempio n. 15
0
 /// <summary>
 ///     Replays this event.
 /// </summary>
 public override void ReplayEvent()
 {
     Cursor.Position = Point;
     if (MouseEventFlags != 0)
     {
         KeyboardKey.InjectMouseEvent(MouseEventFlags, 0, 0, (uint)MouseData >> 16,
                                      new UIntPtr((ulong)ExtraInfo.ToInt64()));
     }
 }
Esempio n. 16
0
        }//SetResult

        //-------------------------------------------------------------------------------//

        public void Clear()
        {
            Customer.Clear();
            foreach (var product in Products)
            {
                product.Clear();
            }

            ExtraInfo.Clear();
        }//Clear
Esempio n. 17
0
        /// <summary>
        /// Deselects the given Character's current GO
        /// </summary>
        internal void Deselect(ExtraInfo info)
        {
            GOSelection selection = info.m_goSelection;

            if (selection != null)
            {
                selection.Dispose();
                info.m_goSelection = null;
            }
        }
Esempio n. 18
0
        /// <summary>Deselects the given Character's current GO</summary>
        internal void Deselect(ExtraInfo info)
        {
            GOSelection goSelection = info.m_goSelection;

            if (goSelection == null)
            {
                return;
            }
            goSelection.Dispose();
            info.m_goSelection = null;
        }
        public override void SerializeMessage(BitWriter writer)
        {
            /*
             * I don't know why this is not working... you can add new stacks, but cannot add to existent once.
             */

            writer.WriteBit(IsBound);
            writer.WriteBit(IsBoundOnEquip);
            writer.WriteBit(IsBoundOnPickup);

            writer.WriteBit(false);

            if (ExtraInfo != null)
            {
                var ldf = ExtraInfo.ToString();

                writer.Write((uint)ldf.Length);

                if (ldf.Length > 0)
                {
                    writer.WriteString(ldf, ldf.Length, true);

                    writer.Write((byte)0);
                    writer.Write((byte)0);
                }
            }
            else
            {
                writer.Write(0u);
            }

            writer.Write(ItemLot);

            writer.WriteBit(false);

            writer.WriteBit(true);
            writer.Write(InventoryType);

            writer.WriteBit(true);
            writer.Write(Delta);

            writer.WriteBit(true);
            writer.Write(TotalItems);

            writer.Write(Item.ObjectId);

            writer.Write(FlyingLootPosition);

            writer.WriteBit(ShowFlyingLoot);

            writer.Write(Slot);
        }
Esempio n. 20
0
        public ActionResult NewInfo(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var viewModel = new ExtraInfo {
                Vraag = "Stel uw vraag", IssueId = (int)id
            };

            return(View("InfoForm", viewModel));
        }
Esempio n. 21
0
        /// <summary>
        /// Adds extra info to the order for later analysis. Things like indicator values
        /// or anything can be added. Using a delegate function so that we can have one
        /// option to turn off the calculations so that users of this function don't have
        /// to worry if the calculation is expensive and turn it off there too if the option
        /// is disabled.
        /// </summary>
        /// <param name="getFn">Function that returns the key/value to be added</param>
        public void AddExtraInfo(GetExtraInfoFunction getFn)
        {
            if (Simulator.Config.AddExtraOrderInfo == true)
            {
                KeyValuePair <string, object> extraValue = getFn();
                if (ExtraInfo.ContainsKey(extraValue.Key))
                {
                    throw new Exception("Attempting to add a duplicate key for extra info (key=" + extraValue.Key);
                }

                ExtraInfo[extraValue.Key] = extraValue.Value;
            }
        }
        private static Issue CreateIssueWithExtraInfoNeed(Gebruiker gebruiker, Gebruiker solver, int i = 0)
        {
            Issue issue = CreateInBehandelingIssue(gebruiker, solver, i);

            issue = CreateAndAddIssueStatusToIssue(issue, IssueStatusBeschrijving.ExtraInfo, solver);
            IssueStatus issuestatus = issue.IssueStatussen.Single();
            ExtraInfo   extraInfo   = new ExtraInfo();

            extraInfo.IssueStatus = issuestatus;
            extraInfo.InfoVraag   = "vraag: " + i;
            issuestatus.ExtraInfos.Add(extraInfo);
            return(issue);
        }
Esempio n. 23
0
        public ActionResult Summary(string table)
        {
            if (Util2.OrgLeadersOnly)
            {
                return(Redirect("/Home"));
            }

            var m = ExtraInfo.CodeSummary(table);
            var c = CurrentDatabase.Content("StandardExtraValues2", "<Views />", ContentTypeCode.TypeText);

            ViewBag.EvSpecId = c.Id;
            return(View("Reports/Summary", m));
        }
Esempio n. 24
0
        public ActionResult UpdateExtrainfo()
        {
            JobResumeExtra er = new JobResumeExtra();

            er.extraactivities = Request["extraact"];
            er.otherinterests  = Request["othrint"];
            er.namep1          = Request["refperson1"];
            er.affp1           = Request["affperson1"];
            er.php1            = Request["phref1"];
            er.emailp1         = Request["refemail1"];
            er.namep2          = Request["refperson2"];
            er.affp2           = Request["affperson2"];
            er.php2            = Request["phref2"];
            er.emailp2         = Request["refemail2"];
            er.userId          = uid;
            ExtraInfo obj = new ExtraInfo();

            obj.updateExtraInfo(er);
            getAllLists obj3 = new getAllLists();

            ViewBag.Cities     = obj3.getCities();
            ViewBag.Countaries = obj3.getCountaries();
            ViewBag.Degrees    = obj3.getDegrees();
            ViewBag.Institutes = obj3.getInstitutes();
            BasicInfo b  = new BasicInfo();
            ExpInfo   e1 = new ExpInfo();
            ExtraInfo e2 = new ExtraInfo();

            ViewBag.isBasicInfoExist = b.isBasicInfoFound(uid);
            if (ViewBag.isBasicInfoExist)
            {
                ViewBag.allBasicInfo = b.getBasicInfo(uid);
            }
            ViewBag.isExpInfoExist = e1.isExpInfoFound(uid);
            if (ViewBag.isExpInfoExist)
            {
                ViewBag.allExpInfo = e1.getExpInfo(uid);
                ViewBag.allPreExp  = e1.getPreviousHistory(uid);
            }
            ViewBag.isExtraInfoExist = e2.isExtraInfoFound(uid);
            if (ViewBag.isExtraInfoExist)
            {
                ViewBag.allExraInfo = e2.getExtraInfo(uid);
            }

            UserInfo u = new UserInfo();

            ViewBag.UserInfo = u.getUserInfo(uid);

            return(View("Update"));
        }
Esempio n. 25
0
        void ConvertPermutations(SND h1)
        {
            sound_pitch_range_block pitchrange;

            foreach (SND.sound_pitch_range_block pr in h1.PitchRanges)
            {
                PitchRanges.Add(out pitchrange);
                pitchrange.Convert(pr);
            }

            sound_extra_info_block extra;

            ExtraInfo.Add(out extra);
            extra.Convert(h1);
        }
Esempio n. 26
0
        public static void Print(string line)
        {
            if (line == null)
            {
                throw new DDError();
            }

            int x = P_BaseX + P_X;
            int y = P_BaseY + P_Y;

            if (Extra.TL == null)
            {
                Print_Main(line, x, y);
            }
            else
            {
                ExtraInfo storedExtra = Extra;

                Extra.TL.Add(() =>
                {
                    ExtraInfo currExtra = Extra;

                    Extra = storedExtra;
                    Print_Main(line, x, y);
                    Extra = currExtra;

                    return(false);
                });
            }

            int w;

            if (P_FontSize == -1)
            {
                w = DX.GetDrawStringWidth(line, SCommon.ENCODING_SJIS.GetByteCount(line));
            }
            else
            {
                w = DX.GetDrawStringWidthToHandle(line, SCommon.ENCODING_SJIS.GetByteCount(line), Font.GetHandle(), 0);
            }

            if (w < 0 || SCommon.IMAX < w)
            {
                throw new DDError();
            }

            P_X += w;
        }
 public static void Main(string[] args)
 {
     var i = new ExtraInfo()
     {
         Id = 5, Related = new List <InfoBase> {
             new ExtraInfo {
                 Id = 1
             }
         }
     };
     var data = new InfoData <ExtraInfo> {
         Id = 100, Info = i
     };
     var result1 = Add <InfoData <ExtraInfo>, ExtraInfo>(data);
     var result2 = Add(data);
 }
Esempio n. 28
0
        public BaseUnitOfWork(ExtraInfo extra = null)
        {
            _context = new ClassicsContext(extra);

            ProfileRepository   = new ProfileRepository(_context);
            UserRepository      = new UserRepository(_context);
            AddressRepository   = new AddressRepository(_context);
            BlobFileRepository  = new BlobFileRepository(_context);
            BrandRepository     = new BrandRepository(_context);
            CarModelRepository  = new CarModelRepository(_context);
            MyCarRepository     = new MyCarRepository(_context);
            ProductRepository   = new ProductRepository(_context);
            SerieRepository     = new SerieRepository(_context);
            SupplierRepository  = new SupplierRepository(_context);
            AlertRepository     = new AlertRepository(_context);
            UserAlertRepository = new UserAlertRepository(_context);
        }
Esempio n. 29
0
        public ActionResult Index()
        {
            Stopwatch sw = Stopwatch.StartNew();

            var extraInfo = new ExtraInfo
            {
                DisplayItems = new Dictionary <string, string>()
                {
                    { "DisplayItem1", "DisplayItem1" },
                    { "DisplayItem2", "DisplayItem2" }
                },
                DropDownListFilterItem1 = stringfilterpool[rnd.Next(4)],
                DropDownListFilterItem2 = stringfilterpool[rnd.Next(4)],
                CheckBoxListFilterItem1 = stringfilterpool[rnd.Next(4)],
                CheckBoxListFilterItem2 = stringfilterpool[rnd.Next(4)],
            };

            AppInfoCenterService.LoggingService.Error("测试日志", extraInfo);

            new Exception("错误" + Guid.NewGuid().ToString(), new Exception("内部错误")).Handle(extraInfo: extraInfo);

            AppInfoCenterService.PerformanceService.StartPerformanceMeasure("性能测试1");
            aa();
            AppInfoCenterService.PerformanceService.SetPerformanceMeasurePoint("性能测试1", "性能测试1aa");
            cc();
            AppInfoCenterService.PerformanceService.SetPerformanceMeasurePoint("性能测试1", "性能测试1cc");
            dd();
            AppInfoCenterService.PerformanceService.SetPerformanceMeasurePoint("性能测试1", "性能测试1dd");

            //try
            //{
            //    ViewBag.Message = WcfService.WcfServiceLocator.GetService<IFuckService>().YouWannaFuckWho("you", 200);
            //}
            //catch (Exception ex)
            //{
            //    ex.Handle();
            //    ViewBag.Message = ex.Message;
            //}

            //ViewBag.Time = sw.ElapsedMilliseconds;

            //throw new Exception("assadad");
            //ViewBag.Message = suckservice.Suck();
            return(View());
        }
Esempio n. 30
0
 public bool Equals(ClientEvent other)
 {
     if (ReferenceEquals(other, null))
     {
         return(false);
     }
     if (ReferenceEquals(other, this))
     {
         return(true);
     }
     if (RequestId != other.RequestId)
     {
         return(false);
     }
     if (EventId != other.EventId)
     {
         return(false);
     }
     if (ParentEventId != other.ParentEventId)
     {
         return(false);
     }
     if (!object.Equals(CreateTime, other.CreateTime))
     {
         return(false);
     }
     if (!object.Equals(JobEvent, other.JobEvent))
     {
         return(false);
     }
     if (!object.Equals(ProfileEvent, other.ProfileEvent))
     {
         return(false);
     }
     if (!ExtraInfo.Equals(other.ExtraInfo))
     {
         return(false);
     }
     if (EventCase != other.EventCase)
     {
         return(false);
     }
     return(Equals(_unknownFields, other._unknownFields));
 }
Esempio n. 31
0
        /// <summary>
        /// Asynchronous export item's properties
        /// </summary>
        /// <returns>An <see cref="ExportableCI"/> instance containing all relevant properties</returns>
        public async Task <ExportableFixtureCI> ExportAsync()
        {
            var scheduledTasks = ScheduledStartTimeChanges?.Select(async s => await((ScheduledStartTimeChange)s).ExportAsync().ConfigureAwait(false));
            var channelTasks   = TvChannels?.Select(async c => await((TvChannel)c).ExportAsync().ConfigureAwait(false));

            return(new ExportableFixtureCI
            {
                ExtraInfo = ExtraInfo?.ToDictionary(i => i.Key, i => i.Value),
                CoverageInfo = CoverageInfo != null?await((CoverageInfo)CoverageInfo).ExportAsync().ConfigureAwait(false) : null,
                                   ProductInfo = ProductInfo != null?await((ProductInfo)ProductInfo).ExportAsync().ConfigureAwait(false) : null,
                                                     ReplacedBy = ReplacedBy?.ToString(),
                                                     References = References?.References?.ToDictionary(r => r.Key, r => r.Value),
                                                     NextLiveTime = NextLiveTime,
                                                     StartTimeConfirmed = StartTimeConfirmed,
                                                     ScheduledStartTimeChanges = scheduledTasks != null ? await Task.WhenAll(scheduledTasks) : null,
                                                     StartTime = StartTime,
                                                     TvChannels = channelTasks != null ? await Task.WhenAll(channelTasks) : null,
                                                     StartTimeTBD = StartTimeTBD
            });
        }
Esempio n. 32
0
        private void InternalHandle(ExceptionInfo info, Exception exception, string moduleName, string categoryName, string subcategoryName, string description, ExtraInfo extraInfo)
        {
            if (exception == null)
                return;
            try
            {
                if (AppInfoCenterConfiguration.GetConfig().ExceptionServiceConfig.Enabled)
                {
                    var strategy = GetExceptionStrategy(moduleName, info.GetType().Name, exception.GetType().Name);
                    if (strategy != null)
                    {
                        if (strategy.LocalLog)
                            LocalLog(info, exception, moduleName, categoryName, subcategoryName, description, extraInfo);
                        if (strategy.RemoteLog)
                        {
                            info.Exception = MapException(exception);
                            info.Description = description;
                            info.ExceptionTypeName = exception.GetType().FullName;
                            info.ExtraInfo = extraInfo;
                            info.ModuleName = moduleName;
                            info.CategoryName = categoryName;
                            info.SubCategoryName = subcategoryName;
                            info.ExceptionMessage = exception.Message;
                            ProcessInfo(info);
                            MongodbService.MongodbInsertService.Insert(info);
                        }

                        if (info is WebSiteUnhandledExceptionInfo && HttpContext.Current != null)
                        {
                            HttpContext.Current.Response.Clear();

                            //HttpContext.Current.Response.StatusCode = strategy.ResponseStatusCode;

                            if (!HttpContext.Current.Request.IsLocal && strategy.ClearException)
                            {
                                HttpContext.Current.Server.ClearError();

                                if (!string.IsNullOrEmpty(strategy.RedirectUrl))
                                {
                                    HttpContext.Current.Response.Redirect(string.Format("{0}/?ID={1}", strategy.RedirectUrl.TrimEnd('/'), info.ID), false);
                                }
                                else
                                {
                                    HttpContext.Current.Response.Write(string.Format(AppInfoCenterConfiguration.GetConfig().ExceptionServiceConfig.UnhandledExceptionMessage, info.ID));
                                    HttpContext.Current.Response.End();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LocalLoggingService.Error("InternalHandle出现错误,异常信息为:" + ex.ToString());
            }
        }
Esempio n. 33
0
 public void Info(string message, ExtraInfo extraInfo)
 {
     InternalLog(LogLevel.Info, message, string.Empty, string.Empty, message, extraInfo);
 }
Esempio n. 34
0
 private void InternalLog(LogLevel logLevel, string moduleName, string categoryName, string subcategoryName, string message, ExtraInfo extraInfo)
 {
     try
     {
         if (AppInfoCenterConfiguration.GetConfig().LoggingServiceConfig.Enabled)
         {
             var strategy = GetLogStrategy(moduleName, logLevel);
             if (strategy != null)
             {
                 if (strategy.LocalLog)
                     LocalLog(logLevel, moduleName, categoryName, subcategoryName, message, extraInfo);
                 if (strategy.RemoteLog)
                 {
                     var info = new LogInfo();
                     info.LogLevel = logLevel;
                     info.ModuleName = moduleName;
                     info.CategoryName = categoryName;
                     info.SubCategoryName = subcategoryName;
                     info.Message = message;
                     info.ExtraInfo = extraInfo;
                     ProcessInfo(info);
                     MongodbService.MongodbInsertService.Insert(info);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LocalLoggingService.Error("InternalLog出现错误,异常信息为:" + ex.ToString());
     }
 }
Esempio n. 35
0
        /// <summary>
        /// Used to make sure that the input for the guide body parses correctly as valid XML
        /// </summary>
        /// <returns>A string that represents the XML for the guide body</returns>
        private string TryParseGuideBody()
        {
            XmlDocument bodyDoc = new XmlDocument();
            XmlNode guideBody = null;
            try
            {
                // Load the body text into an XmlDoc to parse
                bodyDoc.LoadXml(Entities.GetEntities() + "<GUIDE><BODY>" + _template.UIFields["Body"].RawValue + "</BODY></GUIDE>");
                guideBody = bodyDoc.SelectSingleNode("//GUIDE");
            }
            catch (XmlException ex)
            {
                AddErrorXml("GuideXML", "The body text contains invalid XML - " + ex.Message, _typedArticleNode);
                return "";
            }

            // Create the extra info block
            int type = _template.UIFields["Type"].ValueInt;
            ExtraInfo extraInfo = new ExtraInfo();
            extraInfo.TryCreate(type, "");

            // Now add all the non required fields to the Guide
            Dictionary<string, UIField>.Enumerator validFields = _template.UIFields.GetEnumerator();
            while (validFields.MoveNext())
            {
                // Check to see if we've got a non require field
                UIField currentField = validFields.Current.Value;
                if (!currentField.Required)
                {
                    // Add the field to the extra info
                    extraInfo.AddExtraInfoTagValue(currentField.Name, currentField.ValueString);

                    // Add the element to the 
                    XmlDocument fieldDoc = new XmlDocument();
                    try
                    {
                        // Load the text into an XmlDoc to parse
                        fieldDoc.LoadXml("<" + currentField.Name.ToUpper() + ">" + currentField.RawValue + "</" + currentField.Name.ToUpper() + ">");
                        XmlNode bodyNode = bodyDoc.SelectSingleNode("//BODY");
                        XmlNode importNode = bodyDoc.ImportNode(fieldDoc.FirstChild,true);
                        bodyDoc.DocumentElement.InsertAfter(importNode, bodyNode);
                    }
                    catch (XmlException ex)
                    {
                        AddErrorXml("GuideXML", "The " + currentField.Name + " contains invalid XML - " + ex.Message, _typedArticleNode);
                        return "";
                    }
                }
            }

            // Add the guidebody to the page
            _typedArticleNode.AppendChild(_typedArticleNode.OwnerDocument.ImportNode(guideBody,true));
            AddInside(_typedArticleNode, extraInfo);

            // Get the text to insert into the database
            return guideBody.OuterXml.ToString();
        }
Esempio n. 36
0
 public void Debug(string categoryName, string subcategoryName, string message, ExtraInfo extraInfo)
 {
     InternalLog(LogLevel.Debug, string.Empty, categoryName, subcategoryName, message, extraInfo);
 }
Esempio n. 37
0
 public void Error(string moduleName, string message, ExtraInfo extraInfo)
 {
     InternalLog(LogLevel.Error, moduleName, string.Empty, string.Empty, message, extraInfo);
 }
Esempio n. 38
0
 public void Error(string moduleName, string categoryName, string subcategoryName, string message, ExtraInfo extraInfo)
 {
     InternalLog(LogLevel.Error, moduleName, categoryName, subcategoryName, message, extraInfo);
 }
Esempio n. 39
0
 /// <summary>
 /// Sets the extra info xml from the string and the type
 /// </summary>
 /// <param name="extraInfo"></param>
 /// <param name="type"></param>
 public void SetExtraInfo(string extraInfo, int type)
 {
     _extraInfo.RemoveAll();
     _extraInfo = CreateElement("ExtraInfo");
     ExtraInfo extraInfoObject = new ExtraInfo();
     extraInfoObject.TryCreate(type, extraInfo);
     _extraInfo.AppendChild(ImportNode(extraInfoObject.RootElement.FirstChild));
 }
        private void LoadXml()
        {
            _packageDescriptions = new Dictionary<string, List<KeyValuePair<PackageDescription, ExtraInfo>>>();
            _eulaTexts = new Dictionary<string, Dictionary<Guid, string>>();

            XDocument doc = XDocumentUtils.Load(_configFilePath);

            foreach (XElement element in doc.Root.Elements("Source"))
            {
                XAttribute urlAttribute = element.Attribute("url");

                List<KeyValuePair<PackageDescription, ExtraInfo>> packageDescriptions = new List<KeyValuePair<PackageDescription, ExtraInfo>>();
                foreach (XElement packageElement in element.Elements("PackageDescription"))
                {
                    PackageDescription packageDescription = new PackageDescription();

                    packageDescription.PackageVersion = packageElement.Attribute("packageVersion").Value;
                    packageDescription.PackageFileDownloadUrl = packageElement.Attribute("packageFileDownloadUrl").Value;
                    packageDescription.Description = packageElement.Attribute("description").Value;
                    packageDescription.EulaId = (Guid)packageElement.Attribute("eulaId");
                    packageDescription.GroupName = packageElement.Attribute("groupName").Value;
                    packageDescription.Id = (Guid)packageElement.Attribute("id");
                    packageDescription.InstallationRequireLicenseFileUpdate = (bool)packageElement.Attribute("installationRequireLicenseFileUpdate");
                    packageDescription.IsFree = (bool)packageElement.Attribute("isFree");
                    packageDescription.IsTrial = (bool)packageElement.Attribute("isTrial");
                    packageDescription.LicenseRuleId = (Guid)packageElement.Attribute("licenseRuleId");
                    packageDescription.MaxCompositeVersionSupported = packageElement.Attribute("maxCompositeVersionSupported").Value;
                    packageDescription.MinCompositeVersionSupported = packageElement.Attribute("minCompositeVersionSupported").Value;
                    packageDescription.Name = packageElement.Attribute("name").Value;
                    packageDescription.PriceAmmount = (decimal)packageElement.Attribute("priceAmmount");
                    packageDescription.PriceCurrency = packageElement.Attribute("priceCurrency").Value;
                    packageDescription.ReadMoreUrl = packageElement.Attribute("readMoreUrl").Value;
                    packageDescription.TechicalDetails = packageElement.Attribute("techicalDetails").Value;
                    packageDescription.TrialPeriodDays = (int)packageElement.Attribute("trialPeriodDays");
                    packageDescription.UpgradeAgreementMandatory = (bool)packageElement.Attribute("upgradeAgreementMandatory");
                    packageDescription.Vendor = packageElement.Attribute("vendor").Value;
                    ExtraInfo extraInfo = new ExtraInfo();

                    if (packageElement.Attribute("canBeUninstalled") != null) extraInfo.CanBeUninstalled = (bool)packageElement.Attribute("canBeUninstalled");
                    if (packageElement.Attribute("flushOnCompletion") != null) extraInfo.FlushOnCompletion = (bool)packageElement.Attribute("flushOnCompletion");
                    if (packageElement.Attribute("reloadConsoleOnCompletion") != null) extraInfo.ReloadConsoleOnCompletion = (bool)packageElement.Attribute("reloadConsoleOnCompletion");

                    if (packageElement.Attribute("systemLocking") != null)
                    {
                        SystemLockingType systemLockingType;
                        packageElement.Attribute("systemLocking").TryDeserialize(out systemLockingType);
                        extraInfo.SystemLockingType = systemLockingType;
                    }

                    packageDescriptions.Add(new KeyValuePair<PackageDescription, ExtraInfo>(packageDescription, extraInfo));
                }

                _packageDescriptions.Add(element.Attribute("url").Value.ToLowerInvariant(), packageDescriptions);

                Dictionary<Guid, string> eulaTexts = new Dictionary<Guid, string>();
                foreach (XElement eulaTextElement in element.Elements("EulaText"))
                {
                    eulaTexts.Add(
                        (Guid)eulaTextElement.Attribute("id"),
                        eulaTextElement.Value
                        );
                }
                _eulaTexts.Add(element.Attribute("url").Value.ToLowerInvariant(), eulaTexts);
            }
        }
Esempio n. 41
0
 public void StartPerformanceMeasure(string name, ExtraInfo extraInfo = null)
 {
     StartPerformanceMeasure(name, string.Empty, string.Empty, extraInfo);
 }
Esempio n. 42
0
 private ExtraInfo OnImageInfo()
 {
     return _extraInfo ?? (_extraInfo = new ExtraInfo());
 }
Esempio n. 43
0
 private void HandledException(Exception exception, string moduleName, string categoryName, string subcategoryName, string description, ExtraInfo extraInfo)
 {
     InternalHandle(new HandledExceptionInfo(),
         exception, moduleName, categoryName, subcategoryName, description, extraInfo);
 }
Esempio n. 44
0
        /// <summary>
        /// This method reads in the entry form the database and sets up all the member fields
        /// </summary>
        /// <param name="safeToCache">A flag to state whether or not this entry is safe to cache. Usually set to false whhen an error occures.</param>
        /// <param name="failingGracefully">A flag that states whether or not this method is failing gracefully.</param>
        private void GetEntryFromDataBase(ref bool safeToCache, ref bool failingGracefully)
        {
            // fetch all the lovely intellectual property from the database
            using (IDnaDataReader reader = InputContext.CreateDnaDataReader("getarticlecomponents2"))
            {
                // Add the entry id and execute
                reader.AddParameter("EntryID", EntryID);
                reader.Execute();

                // Make sure we got something back
                if (!reader.HasRows || !reader.Read())
                {
                    // Fail gracefully
                    XmlNode articleTag = AddElementTag(RootElement, "ARTICLE");
                    XmlNode guideTag = AddElementTag(articleTag, "GUIDE");
                    XmlNode bodyTag = AddElementTag(guideTag, "BODY");
                    AddElementTag(bodyTag, "NOENTRYYET");
                    failingGracefully = true;
                    safeToCache = false;
                }
                else
                {
                    // Go though the results untill we get the main article
                    do
                    {
                        if (reader.GetInt32("IsMainArticle") == 1)
                        {
                            // Now start reading in all the values for the entry
                            _h2g2ID = reader.GetInt32("h2g2ID");
                            _entryID = reader.GetInt32("EntryID");
                            _forumID = reader.GetInt32("ForumID");
                            _status = reader.GetInt32("Status");
                            _style = reader.GetInt32("Style");
                            _editor = reader.GetInt32("Editor");
                            _siteID = reader.GetInt32("SiteID");
                            _submittable = reader.GetTinyIntAsInt("Submittable");
                            _type = reader.GetInt32("Type");
                            if (!reader.IsDBNull("ModerationStatus"))
                            {
                                _moderationStatus = reader.GetTinyIntAsInt("ModerationStatus");
                            }
                            _subject = reader.GetString("subject");
                            _text = reader.GetString("text");
                            string extraInfo = reader.GetString("extrainfo");

                            _extraInfo = new ExtraInfo();
                            _extraInfo.TryCreate(_type, extraInfo);

                            if (reader.IsDBNull("Hidden"))
                            {
                                _hiddenStatus = 0;
                            }
                            else
                            {
                                _hiddenStatus = reader.GetInt32("Hidden");
                            }

                            _dateCreated = reader.GetDateTime("DateCreated");
                            _lastUpdated = reader.GetDateTime("LastUpdated");
                            _preProcessed = reader.GetInt32("PreProcessed");
                            _defaultCanRead = (reader.GetTinyIntAsInt("CanRead") > 0);
                            _defaultCanWrite = (reader.GetTinyIntAsInt("CanWrite") > 0);
                            _defaultCanChangePermissions = (reader.GetTinyIntAsInt("CanChangePermissions") > 0);

                            if (reader.IsDBNull("TopicID"))
                            {
                                _topicID = 0;
                            }
                            else
                            {
                                _topicID = reader.GetInt32("TopicID");
                            }

                            if (reader.IsDBNull("BoardPromoID"))
                            {
                                _boardPromoID = 0;
                            }
                            else
                            {
                                _boardPromoID = reader.GetInt32("BoardPromoID");
                            }

                            if (!reader.IsDBNull("StartDate"))
                            {
                                _dateRangeStart = reader.GetDateTime("StartDate");
                            }

                            if (!reader.IsDBNull("EndDate"))
                            {
                                _dateRangeEnd = reader.GetDateTime("EndDate");
                            }

                            if (reader.IsDBNull("TimeInterval"))
                            {
                                _rangeInterval = -1; // default value
                            }
                            else
                            {
                                _rangeInterval = reader.GetInt32("TimeInterval");
                            }
                        }
                    }
                    while (reader.Read());
                }
            }
        }
Esempio n. 45
0
 public void Handle(Exception exception, ExtraInfo extraInfo)
 {
     HandledException(exception, string.Empty, string.Empty, string.Empty, string.Empty, extraInfo);
 }
		ExtraInfo OnImageInfo()
		{
			if (extraInfo == null)
				extraInfo = new ExtraInfo();
			return extraInfo;
		}
Esempio n. 47
0
 public void Handle(string categoryName, string subcategoryName, Exception exception, ExtraInfo extraInfo)
 {
     HandledException(exception, string.Empty, categoryName, subcategoryName, string.Empty, extraInfo);
 }
Esempio n. 48
0
 public void Debug(string moduleName, string message, ExtraInfo extraInfo)
 {
     InternalLog(LogLevel.Debug, moduleName, string.Empty, string.Empty, message, extraInfo);
 }
Esempio n. 49
0
 public void Handle(string moduleName, Exception exception, string description, ExtraInfo extraInfo)
 {
     HandledException(exception, moduleName, string.Empty, string.Empty, description, extraInfo);
 }
Esempio n. 50
0
 private void LocalLog(LogLevel logLevel, string moduleName, string categoryName, string subcategoryName, string message, ExtraInfo extraInfo)
 {
     var msg = new StringBuilder();
     if (!string.IsNullOrEmpty(moduleName))
         msg.Append(string.Format("模块名:{0} ", moduleName));
     if (!string.IsNullOrEmpty(categoryName))
         msg.Append(string.Format("大类:{0} ", categoryName));
     if (!string.IsNullOrEmpty(subcategoryName))
         msg.Append(string.Format("小类:{0} ", subcategoryName));
     if (extraInfo != null)
         msg.Append(string.Format("额外信息:{0} ", extraInfo));
     msg.Append(string.Format("日志信息:{0} ", message));
     LocalLoggingService.Log(logLevel, msg.ToString());
 }
Esempio n. 51
0
 public void Handle(string moduleName, string categoryName, string subcategoryName, Exception exception, string description, ExtraInfo extraInfo)
 {
     HandledException(exception, moduleName, categoryName, subcategoryName, description, extraInfo);
 }
Esempio n. 52
0
 public void Warning(string message, ExtraInfo extraInfo)
 {
     InternalLog(LogLevel.Warning, message, string.Empty, string.Empty, message, extraInfo);
 }
Esempio n. 53
0
 private void LocalLog(ExceptionInfo info, Exception exception, string moduleName, string categoryName, string subcategoryName, string description, ExtraInfo extraInfo)
 {
     var message = new StringBuilder();
     if (info != null)
         message.Append(string.Format("异常类型:{0} ", info.GetType().Name));
     if (!string.IsNullOrEmpty(moduleName))
         message.Append(string.Format("模块名:{0} ", moduleName));
     if (!string.IsNullOrEmpty(categoryName))
         message.Append(string.Format("大类:{0} ", categoryName));
     if (!string.IsNullOrEmpty(subcategoryName))
         message.Append(string.Format("小类:{0} ", subcategoryName));
     if (!string.IsNullOrEmpty(description))
         message.Append(string.Format("描述:{0} ", description));
     if (extraInfo != null)
         message.Append(string.Format("额外信息:{0} ", extraInfo));
     message.Append(string.Format("异常信息:{0} ", exception.ToString()));
     LocalLoggingService.Error(message.ToString());
 }
Esempio n. 54
0
        /// <summary>
        /// This methos gets the list of related clubs for a given article
        /// </summary>
        /// <param name="h2g2ID">The id of the article you want to get the related clubs for</param>
        public void GetRelatedClubs(int h2g2ID)
        {
            // Create a data reader to get all the clubs
            using (IDnaDataReader reader = InputContext.CreateDnaDataReader("getrelatedclubs"))
            {
                reader.AddParameter("h2g2ID", h2g2ID);
                reader.Execute();

                XmlNode relatedClubsNode = AddElementTag(RootElement, "RELATEDCLUBS");
                
                // Add each club member in turn
                while (reader.Read())
                {
                    XmlNode clubNode = AddElementTag(relatedClubsNode, "CLUBMEMBER");
                    AddIntElement(clubNode, "CLUBID", reader.GetInt32("ClubID"));
                    AddTextElement((XmlElement)clubNode, "NAME", reader.GetString("Subject"));
                    ExtraInfo clubExtraInfo = new ExtraInfo();
                    clubExtraInfo.TryCreate(reader.GetInt32("Type"),reader.GetString("ExtraInfo"));
                    clubNode.AppendChild(ImportNode(clubExtraInfo.RootElement.FirstChild));
                    if (reader.Exists("DateCreated"))
                    {
                        XmlNode dateCreatedNode = AddElementTag(clubNode, "DATECREATED");
                        dateCreatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, reader.GetDateTime("DateCreated"), true));
                    }
                    if (reader.Exists("Lastupdated"))
                    {
                        XmlNode dateCreatedNode = AddElementTag(clubNode, "LASTUPDATE");
                        dateCreatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, reader.GetDateTime("DateCreated"), true));
                    }

                    // NEED TO ADD EDITOR, CLUBMEMBERS, LOCAL, EXTRAINFO, STRIPPED NAME... CHECK CLUB MEMBERS
                }
            }
        }
Esempio n. 55
0
        /// <summary>
        /// Creates a new reviewforum in the database
        /// </summary>
        /// <param name="forumName"></param>
        /// <param name="URLFriendlyName"></param>
        /// <param name="incubateTime"></param>
        /// <param name="recommend"></param>
        /// <param name="siteID"></param>
        /// <param name="userID"></param>
        public void CreateAndInitialiseNewReviewForum(string forumName, string URLFriendlyName, int incubateTime, bool recommend,int siteID, int userID)
        {        	
	        _urlFriendlyName = URLFriendlyName;
	        _reviewForumName = forumName;

	        // Get the user information

	        if (_reviewForumName == String.Empty || _urlFriendlyName == String.Empty || _urlFriendlyName.IndexOf(" ") >= 0 || siteID <= 0 || incubateTime < 0)
	        {
                throw new DnaException("INVALID PARAMETERS - Invalid parameters in CreateAndInitialiseNewReviewForum.");

                /*
		        TDVASSERT(forumName != String.Empty ,"NULL forumname in CReviewForum::AddNewReviewForum");
		        TDVASSERT(_urlFriendlyName != String.Empty ,"NULL forumname in CReviewForum::AddNewReviewForum");
		        TDVASSERT(_urlFriendlyName.Find(" ") < 0,"Spaces found in the URL");
		        TDVASSERT(incubateTime >= 0, "Invalid incubate time in CReviewForum::AddNewReviewForum");
		        TDVASSERT(siteID > 0,"invalid siteid in CReviewForum::AddNewReviewForum");
		        TDVASSERT(userID > 0,"invalid userid in CReviewForum::AddNewReviewForum");
		        return false;*/
	        }

	        ExtraInfo extrainfo = new ExtraInfo();
	        int typeID = (int) GuideEntry.GuideEntryType.TYPEREVIEWFORUM;
            if (!extrainfo.TryCreate(typeID, ""))
	        {
                throw new DnaException("ReviewForum - InitialiseAndCreateNewReviewForum - Failed to create extrainfo for reviewforum due bad element");
	        }
	        //pass in the object -not the string!
        	
	        int reviewForumID = 0;
            string hash = String.Empty;
            string hashString = forumName + "<:>" + URLFriendlyName + "<:>" + userID + "<:>" + siteID + "<:>" + extrainfo.RootElement.OuterXml + "<:>" + incubateTime + "<:>" + recommend;

            using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("addnewreviewforum"))
            {
                dataReader.AddParameter("URLName", URLFriendlyName);
                dataReader.AddParameter("ReviewForumName", forumName);
                dataReader.AddParameter("Incubate", incubateTime);
                dataReader.AddParameter("Recommend", recommend);
                dataReader.AddParameter("SiteID", siteID);
                dataReader.AddParameter("userid", userID);
                dataReader.AddParameter("extra", extrainfo.RootElement.OuterXml);
                dataReader.AddParameter("Type", typeID);
                dataReader.AddParameter("Hash", DnaHasher.GenerateHash(hashString));
                dataReader.Execute();
                // Check to see if we found anything
                if (dataReader.HasRows && dataReader.Read())
                {
                    reviewForumID = dataReader.GetInt32NullAsZero("ReviewForumID");
                }
            }
            if (reviewForumID > 0)
            {
                _recommend = recommend;
                _incubateTime = incubateTime;
                _siteID = siteID;
                _reviewForumID = reviewForumID;

                _initialised = true;
            }
        }    
 private ExtraInfo OnImageInfo()
 {
     if (_extraInfo == null)
         _extraInfo = new ExtraInfo();
     return _extraInfo;
 }
Esempio n. 57
0
        /// <summary>
        /// This method gets all the related articles for a given article h2g2ID
        /// </summary>
        /// <param name="h2g2ID">The id of the article you want to get the related articles for</param>
        public void GetRelatedArticles(int h2g2ID)
        {
            // Create the datareader to get the articles
            using (IDnaDataReader reader = InputContext.CreateDnaDataReader("getrelatedarticles"))
            {
                reader.AddParameter("h2g2ID", h2g2ID);
                reader.AddParameter("CurrentSiteID", 0);
                reader.Execute();

                XmlNode relatedArticlesNode = AddElementTag(RootElement, "RELATEDARTICLES");

                // Add each article in turn
                while (reader.Read())
                {
                    XmlNode relatedArticleNode = AddElementTag(relatedArticlesNode, "ARTICLEMEMBER");
                    AddIntElement(relatedArticleNode, "H2G2ID", h2g2ID);
                    string articleName = reader.GetString("Subject");
                    AddTextElement((XmlElement)relatedArticleNode, "NAME", articleName);
                    if (_includeStrippedNames)
                    {
                        string strippedName = StringUtils.StrippedName(articleName);
                        AddTextElement((XmlElement)relatedArticleNode, "STRIPPEDNAME", strippedName);
                    }
                    XmlNode userNode = AddElementTag(relatedArticleNode, "EDITOR");
                    User articleEditor = new User(InputContext);
                    articleEditor.AddPrefixedUserXMLBlock(reader, reader.GetInt32("Editor"), "Editor", userNode);
                    int status = reader.GetInt32("Status");
                    XmlNode statusNode = AddTextElement((XmlElement)relatedArticleNode, "STATUS", GuideEntry.GetDescriptionForStatusValue(status));
                    AddAttribute(statusNode, "TYPE", status);
                    ExtraInfo articleExtraInfo = new ExtraInfo();
                    int articleType = reader.GetInt32("Type");
                    int articleHidden = 0;
                    if (reader.Exists("Hidden") && !reader.IsDBNull("Hidden"))
                    {
                        articleHidden = reader.GetInt32("Hidden");
                    }
                    
                    // Create and add the article extra info
                    articleExtraInfo.TryCreate(articleType, reader.GetString("ExtraInfo"));
                    AddInside(relatedArticleNode, articleExtraInfo);

                    if (reader.Exists("DateCreated"))
                    {
                        XmlNode dateCreatedNode = AddElementTag(relatedArticleNode, "DATECREATED");
                        dateCreatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, reader.GetDateTime("DateCreated"), true));
                    }
                    if (reader.Exists("Lastupdated"))
                    {
                        XmlNode dateCreatedNode = AddElementTag(relatedArticleNode, "LASTUPDATE");
                        dateCreatedNode.AppendChild(DnaDateTime.GetDateTimeAsElement(RootElement.OwnerDocument, reader.GetDateTime("DateCreated"), true));
                    }

                    // NOW ADD KEYPHRASES, MEDIA ASSETS, POLLS
                }
            }
        }