Beispiel #1
0
        private void CaseDataQuery()
        {
            String str = String.Format(DataGridsqltunnel(DataGridsql), StartDateTime.ToString(), EndDateTime.AddSeconds(86399).ToString(), "");

            dataTable = DB.Query(str);
            pagecount = (int)Math.Ceiling((float)(dataTable.Rows.Count) / 50);
            CaseDataQuery(page);
            checkpagebtn();
        }
Beispiel #2
0
        protected override bool Execute(CodeActivityContext context)
        {
            Error.Set(context, null);
            KeyValuePair <Guid, TReportResult> RepF = new KeyValuePair <Guid, TReportResult>();
            MemoryStream doc = null;

            try
            {
                string userId = null;
                if (!string.IsNullOrEmpty(User_ID))
                {
                    try
                    {
                        userId = UserHelper.GetIdByUserName(User_ID);
                        if (string.IsNullOrEmpty(userId))
                        {
                            userId = User_ID;
                        }
                    }
                    catch (Exception ex)
                    {
                        Error.Set(context, ex.Message);
                        if (!HideException.Get(context))
                        {
                            throw ex;
                        }
                    }
                }

                RepF = ARM_Service.REP_Export_Report(userId, ReportFormat, Report_id.Get(context), StartDateTime.Get(context), EndDateTime.Get(context), null, WcfTimeOut.Get(context));
                doc  = LargeData.DownloadData(RepF.Key);


                if (!string.IsNullOrEmpty(RepF.Value.Error))
                {
                    Error.Set(context, RepF.Value.Error);
                }
                else
                {
                    PutReportToFolder(context, doc);
                }
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (ResourceName.Length != 0)
            {
                hash ^= ResourceName.GetHashCode();
            }
            if (ExtensionType != 0)
            {
                hash ^= ExtensionType.GetHashCode();
            }
            if (startDateTime_ != null)
            {
                hash ^= StartDateTime.GetHashCode();
            }
            if (endDateTime_ != null)
            {
                hash ^= EndDateTime.GetHashCode();
            }
            hash ^= adSchedules_.GetHashCode();
            if (Device != 0)
            {
                hash ^= Device.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.SitelinkFeedItem)
            {
                hash ^= SitelinkFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.StructuredSnippetFeedItem)
            {
                hash ^= StructuredSnippetFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.AppFeedItem)
            {
                hash ^= AppFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.CallFeedItem)
            {
                hash ^= CallFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.CalloutFeedItem)
            {
                hash ^= CalloutFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.TextMessageFeedItem)
            {
                hash ^= TextMessageFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.PriceFeedItem)
            {
                hash ^= PriceFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.PromotionFeedItem)
            {
                hash ^= PromotionFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.LocationFeedItem)
            {
                hash ^= LocationFeedItem.GetHashCode();
            }
            if (extensionCase_ == ExtensionOneofCase.AffiliateLocationFeedItem)
            {
                hash ^= AffiliateLocationFeedItem.GetHashCode();
            }
            hash ^= (int)extensionCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        protected override bool Execute(CodeActivityContext context)
        {
            int ti_id = TiId.Get(context);

            Value.Set(context, 0);
            Status.Set(context, (int)VALUES_FLAG_DB.DataNotFull);
            StatusStr.Set(context, TVALUES_DB.FLAG_to_String(VALUES_FLAG_DB.DataNotFull, ";"));
            ValueDateTime.Set(context, DateTime.MinValue);

            List <TINTEGRALVALUES_DB> _valueList = new List <TINTEGRALVALUES_DB>();

            ValueList.Set(context, _valueList);

            if (RequestType == enumEnrgyQualityRequestType.Archive)
            {
                if (StartDateTime.Get(context) == null || EndDateTime.Get(context) == null)
                {
                    Error.Set(context, "Для архивных значений начальная и конечная дата должна быть определена");
                    return(false);
                }
            }

            try
            {
                var tiList = new List <TI_ChanelType>()
                {
                    new TI_ChanelType()
                    {
                        TI_ID          = ti_id,
                        ChannelType    = Channel.Get(context),
                        DataSourceType = DataSourceType,
                    }
                };

                if (RequestType == enumEnrgyQualityRequestType.Archive)
                {
                    //TODO часовой пояс
                    var values = ARM_Service.DS_GetIntegralsValues_List(tiList,
                                                                        StartDateTime.Get(context),
                                                                        EndDateTime.Get(context),
                                                                        IsCoeffEnabled, false, false, OnlyAutoRead, false, false, enumTimeDiscreteType.DBHalfHours, EnumUnitDigit.None, null, false, false);


                    if (values != null && values.IntegralsValue30orHour != null && values.IntegralsValue30orHour.Count > 0)
                    {
                        var    integralTiValue = values.IntegralsValue30orHour[0];
                        double diff            = 0;
                        var    flag            = VALUES_FLAG_DB.None;
                        if (integralTiValue.Val_List != null)
                        {
                            foreach (var iVal in integralTiValue.Val_List)
                            {
                                diff += iVal.F_VALUE_DIFF;
                                flag  = flag.CompareAndReturnMostBadStatus(iVal.F_FLAG);
                                _valueList.Add(iVal);
                            }
                        }

                        Value.Set(context, diff);
                        var stat = flag;
                        Status.Set(context, (int)stat);
                        StatusStr.Set(context, TVALUES_DB.FLAG_to_String(stat, ";"));

                        if (integralTiValue.Val_List != null && integralTiValue.Val_List.Count > 0)
                        {
                            ValueDateTime.Set(context, integralTiValue.Val_List.Last().EventDateTime);
                        }
                    }
                }
                else
                {
                    var val = ARM_Service.DS_ReadLastIntegralArchives(tiList);
                    if (val != null && val.Count > 0)
                    {
                        var valDict = val.ToDictionary(k => k.Key, v => v.Value, new TI_ChanelComparer());
                        foreach (var r in tiList)
                        {
                            TINTEGRALVALUES_DB i_val;

                            if (valDict.TryGetValue(r, out i_val) && i_val != null)
                            {
                                Value.Set(context, i_val.F_VALUE);
                                Status.Set(context, (int)i_val.F_FLAG);
                                StatusStr.Set(context, TVALUES_DB.FLAG_to_String(i_val.F_FLAG, ";"));
                                ValueDateTime.Set(context, i_val.EventDateTime);
                                _valueList.Add(i_val);
                                break;
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }

            ValueList.Set(context, _valueList);

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Beispiel #5
0
 public override int GetHashCode()
 {
     return((StartDateTime.GetHashCode() * 397) ^ (EndDateTime.GetHashCode() * 397) ^ (SamplingRate * 397));
 }