private void LoadReportDefaults(int DId, int UId, bool ForceLoad) { bool isUploadDefaults = false; string _range = ""; UserSetting _r = UserSetting.GetSettings("RPT"); UserSetting _w = UserSetting.GetSettings("RPT"); if (ForceLoad) { isUploadDefaults = true; } else { if (_r == null) { isUploadDefaults = true; } else { if (_r["RANGE"] == null) { isUploadDefaults = true; } else { if (_r["RANGE"].Length == 0) { isUploadDefaults = true; } if (isUploadDefaults == false) { if ((_r["STDT"] == null) || (_r["ENDT"] == null)) { isUploadDefaults = true; } else { if ((_r["STDT"].Length == 0) && (_r["ENDT"].Length == 0)) { isUploadDefaults = true; } }; } else { isUploadDefaults = true; } }; }; } if (isUploadDefaults == true) { _range = "10"; _w["RANGE"] = ConvertRangeIdToString(Int32.Parse(_range)); _w["STDT"] = DateTime.UtcNow.Date.AddYears(-1).ToString("MM/dd/yyyy HH:mm:ss"); _w["ENDT"] = DateTime.UtcNow.Date.ToString("MM/dd/yyyy HH:mm:ss"); if (_range.Length > 0) { this.DateRange = (DateRange)Enum.Parse(typeof(DateRange), _range, true); } _w["IsConfig"] = ""; } }
public Fltr(int DId, int UId, int HourOffset) { _did = DId; _uid = UId; this.LoadReportDefaults(_did, _uid, false); _houroffset = HourOffset; _end = _end.AddHours(-_houroffset); _start = _start.AddMonths(-1).AddHours(-_houroffset); UserSetting _c = UserSetting.GetSettings("RPT"); if (_c == null) { return; } if (!string.IsNullOrEmpty(_c["FID"])) { _id = int.Parse(_c["FID"]); } if (!string.IsNullOrEmpty(_c["FNAME"])) { _name = HttpUtility.UrlDecode(_c["FNAME"]); } if (!string.IsNullOrEmpty(_c["FTYPE"])) { _reptype = (ReportType)Enum.Parse(typeof(ReportType), _c["FTYPE"], true); } string[] expectedFormats = { "MM/dd/yyyy HH:mm:ss", "MM/dd/yyyyHH:mm:ss", "MM.dd.yyyy HH:mm:ss", "MM.dd.yyyyHH:mm:ss" }; IFormatProvider culture = new CultureInfo("en-US", false); if (!string.IsNullOrEmpty(_c["STDT"])) { try { string _str_start = HttpUtility.UrlDecode(_c["STDT"]); _start = DateTime.ParseExact(_str_start, expectedFormats, culture, DateTimeStyles.None); } catch { } } ; if (!string.IsNullOrEmpty(_c["ENDT"])) { try { string _str_end = HttpUtility.UrlDecode(_c["ENDT"]); _end = DateTime.ParseExact(_str_end, expectedFormats, culture, DateTimeStyles.None); } catch { } } ; if (!string.IsNullOrEmpty(_c["RANGE"])) { this.DateRange = ConvertStringToRange(_c["RANGE"]); //(DateRange)Enum.Parse(typeof(DateRange),_c["RANGE"],true); } if (!string.IsNullOrEmpty(_c["SLAYAX"])) { if (_c["SLAYAX"].IndexOf(Grouping.AccountLocation.ToString()) >= 0) { _yaxis = Grouping.AccountLocation; } else if (_c["SLAYAX"].IndexOf(Grouping.Location.ToString()) >= 0) { _yaxis = Grouping.Location; _locationtype = int.Parse(HttpUtility.UrlDecode(_c["SLAYAX"]).Split(',')[1]); } else if (_c["SLAYAX"].IndexOf(Grouping.Class.ToString()) >= 0) { _yaxis = Grouping.Class; string[] _arr = HttpUtility.UrlDecode(_c["SLAYAX"]).Split(','); if (_arr.Length > 1) { _classlevel = int.Parse(_arr[1]); } } else { _yaxis = (Grouping)Enum.Parse(typeof(Grouping), _c["SLAYAX"], true); } } if (!string.IsNullOrEmpty(_c["SLASYAX"])) { if (_c["SLASYAX"].IndexOf(Grouping.AccountLocation.ToString()) >= 0) { _subyaxis = Grouping.AccountLocation; } else if (_c["SLASYAX"].IndexOf(Grouping.Location.ToString()) >= 0) { _subyaxis = Grouping.Location; _sublocationtype = int.Parse(HttpUtility.UrlDecode(_c["SLASYAX"]).Split(',')[1]); } else if (_c["SLASYAX"].IndexOf(Grouping.Class.ToString()) >= 0) { _subyaxis = Grouping.Class; string[] _arr = HttpUtility.UrlDecode(_c["SLASYAX"]).Split(','); if (_arr.Length > 1) { _subclasslevel = int.Parse(_arr[1]); } } else { _subyaxis = (Grouping)Enum.Parse(typeof(Grouping), _c["SLASYAX"], true); } } if (!string.IsNullOrEmpty(_c["SLAPRT"])) { _priority = int.Parse(_c["SLAPRT"]); } if (!string.IsNullOrEmpty(_c["SLACLS"])) { _class = int.Parse(_c["SLACLS"]); } if (!string.IsNullOrEmpty(_c["SLACTG"])) { _creationcategory = int.Parse(_c["SLACTG"]); } if (!string.IsNullOrEmpty(_c["SLASTG"])) { _submissioncat = int.Parse(_c["SLASTG"]); } if (!string.IsNullOrEmpty(_c["SLARTG"])) { _resolutioncat = int.Parse(_c["SLARTG"]); } if (!string.IsNullOrEmpty(_c["SLALCT"])) { _location = int.Parse(_c["SLALCT"]); } if (!string.IsNullOrEmpty(_c["SLATCH"])) { _technician = int.Parse(_c["SLATCH"]); } if (!string.IsNullOrEmpty(_c["SLASBY"])) { _submittedby = int.Parse(_c["SLASBY"]); } if (!string.IsNullOrEmpty(_c["SLACBY"])) { _closedby = int.Parse(_c["SLACBY"]); } if (!string.IsNullOrEmpty(_c["SLAACC"])) { _account = int.Parse(_c["SLAACC"]); } if (!string.IsNullOrEmpty(_c["SLAACCL"])) { _accountLocation = int.Parse(_c["SLAACCL"]); } if (!string.IsNullOrEmpty(_c["SLAACCPL"])) { _accountParentLocation = int.Parse(_c["SLAACCPL"]); } if (!string.IsNullOrEmpty(_c["TECHTYPE"])) { technicianType = (TechnicianType)Enum.Parse(typeof(TechnicianType), _c["TECHTYPE"], true); } if (!string.IsNullOrEmpty(_c["CALLCENTER"])) { handledByCallCenter = (HandledByCallCenter)Enum.Parse(typeof(HandledByCallCenter), _c["CALLCENTER"], true); } //tkt #3949: Level Filter added to Ticket Count Report if (!string.IsNullOrEmpty(_c["TICKETLEVEL"])) { _ticket_level = int.Parse(_c["TICKETLEVEL"]); } //tkt #3632: Add Support Groups to Ticket Count Report criteria if (!string.IsNullOrEmpty(_c["SUPPORTGROUP"])) { _support_group = int.Parse(_c["SUPPORTGROUP"]); } if (!string.IsNullOrEmpty(_c["AGEDAY"])) { _age = int.Parse(HttpUtility.UrlDecode(_c["AGEDAY"])); } if (!string.IsNullOrEmpty(_c["AGERANGE"])) { this.AgeRange = (EqualRange)Enum.Parse(typeof(EqualRange), _c["AGERANGE"], true); } if (!string.IsNullOrEmpty(_c["ASSETFILTER"])) { _asset_filter = HttpUtility.UrlDecode(_c["ASSETFILTER"]); } if (!string.IsNullOrEmpty(_c["SLAGRAPHWIDTH"])) { _sla_graph_width_id = int.Parse(_c["SLAGRAPHWIDTH"]); } if (!string.IsNullOrEmpty(_c["SLAGRAPHVIEW"])) { _sla_graph_view_id = int.Parse(_c["SLAGRAPHVIEW"]); } }
public void Save() { UserSetting _c = UserSetting.GetSettings("RPT"); _c["FID"] = _id.ToString(); _c["FNAME"] = HttpUtility.UrlDecode(_name); _c["FTYPE"] = _reptype.ToString(); _c["STDT"] = _start.ToString("MM/dd/yyyy HH:mm:ss"); _c["ENDT"] = _end.ToString("MM/dd/yyyy HH:mm:ss"); _c["RANGE"] = ConvertRangeToString(_range); if (_yaxis == Grouping.Location) { _c["SLAYAX"] = Grouping.Location.ToString() + "," + LocationTypeID.ToString(); } else if (_yaxis == Grouping.Class) { _c["SLAYAX"] = Grouping.Class.ToString() + "," + ClassLevel.ToString(); } else { _c["SLAYAX"] = _yaxis.ToString(); } if (_subyaxis == Grouping.Location) { _c["SLASYAX"] = Grouping.Location.ToString() + "," + SubLocationTypeID.ToString(); } else if (_subyaxis == Grouping.Class) { _c["SLASYAX"] = Grouping.Class.ToString() + "," + SubClassLevel.ToString(); } else { _c["SLASYAX"] = _subyaxis.ToString(); } _c["SLAPRT"] = _priority.ToString(); _c["SLACLS"] = _class.ToString(); _c["SLACTG"] = _creationcategory.ToString(); _c["SLASTG"] = _submissioncat.ToString(); _c["SLARTG"] = _resolutioncat.ToString(); _c["SLALCT"] = _location.ToString(); _c["SLATCH"] = _technician.ToString(); _c["SLASBY"] = _submittedby.ToString(); _c["SLACBY"] = _closedby.ToString(); _c["SLAACC"] = _account.ToString(); _c["SLAACCL"] = _accountLocation.ToString(); _c["SLAACCPL"] = _accountParentLocation.ToString(); _c["TECHTYPE"] = technicianType.ToString(); _c["CALLCENTER"] = handledByCallCenter.ToString(); //tkt #3949: Level Filter added to Ticket Count Report _c["TICKETLEVEL"] = _ticket_level.ToString(); //tkt #3632: Add Support Groups to Ticket Count Report criteria _c["SUPPORTGROUP"] = _support_group.ToString(); _c["AGEDAY"] = _age.ToString(); _c["AGERANGE"] = _age_equal.ToString(); _c["ASSETFILTER"] = _asset_filter; _c["SLAGRAPHWIDTH"] = _sla_graph_width_id.ToString(); _c["SLAGRAPHVIEW"] = _sla_graph_view_id.ToString(); }
public static bool NoData() { return(UserSetting.GetSettings("RPT") == null || String.IsNullOrEmpty(UserSetting.GetSettings("RPT")["FID"])); }