示例#1
0
        public void UpdateCount(CountType CountType, int Count)
        {
            tmpCountType = CountType;
            tmpCount     = Count;

            countUpdated = true;
        }
示例#2
0
        public CountAttribute(CountType type, int count)
        {
            switch (type)
            {
            case CountType.Arbitrary:
            {
                ArbitraryCount = count;
                break;
            }

            case CountType.Constant:
            {
                ConstantCount = count;
                break;
            }

            case CountType.ParameterReference:
            {
                ParameterOffset = count;
                break;
            }

            default:
            {
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
            }

            Type = type;
        }
示例#3
0
        public FormPurchaseInfoCount(CountType orderType)
        {
            InitializeComponent();

            m_orderType = orderType;

            if (m_orderType == CountType.Materiel)
            {
                this.Text = "采购金额统计-按物料类型";
            }
            else if (m_orderType == CountType.People)
            {
                this.Text = "采购金额统计-按采购员名称";
            }
            else if (m_orderType == CountType.Supplier)
            {
                this.Text = "采购金额统计-按供应商名称";
            }

            // 默认查询得本月第一天开始到本月最后一天的数据
            DateTime nowDate = DateTime.Now;
            DateTime currentMonthFirstDay = new DateTime(nowDate.Year, nowDate.Month, 1);
            DateTime currentMonthLastDay  = currentMonthFirstDay.AddMonths(1).AddDays(-1);

            m_countStartDate = currentMonthFirstDay.ToString("yyyyMMdd");
            m_countEndDate   = currentMonthLastDay.ToString("yyyyMMdd");
        }
示例#4
0
        public int GetRequestCount(byte ReqType, User user, CountType countType, List <DateTime> selectedDates = null)
        {
            List <DateTime> dateTimes;

            if (countType == CountType.SelectDate)
            {
                dateTimes = selectedDates;
            }
            else
            {
                dateTimes = Functions.GetDateInterval(countType, user);
            }

            DateTime timeStart = dateTimes[0];
            DateTime timeEnd   = dateTimes[1];

            switch (ReqType)
            {
            case 1: return(db.TodoLists.Where(x => x.user_id == user.id && x.add_time >= timeStart && x.add_time <= timeEnd).Count());

            case 2: return(db.TodoLists.Where(x => x.status != (int)StatusType.Closed && x.user_id == user.id && x.add_time >= timeStart && x.add_time <= timeEnd).Count());

            case 3: return(db.TodoLists.Where(x => x.status == (int)StatusType.Closed && x.user_id == user.id && x.add_time >= timeStart && x.add_time <= timeEnd).Count());
            }
            return(0);
        }
示例#5
0
        public static int GetCount(CountType type)
        {
            int count = 0;

            ENgetcount((int)type, ref count);
            return(count);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ImmutableHashSet{T}.MutationResult"/> struct.
 /// </summary>
 /// <param name="root">The root node of the result.</param>
 /// <param name="count">The total element count or a count adjustment.</param>
 /// <param name="countType">The appropriate interpretation for the <paramref name="count"/> parameter.</param>
 internal MutationResult(SortedInt32KeyNode <HashBucket> root, int count, CountType countType = ImmutableHashSet <T> .CountType.Adjustment)
 {
     Requires.NotNull(root, nameof(root));
     _root      = root;
     _count     = count;
     _countType = countType;
 }
示例#7
0
        public List <WorkDoneList> GetWorkDoneForReport(User user, CountType countType, List <DateTime> selectedDates = null)
        {
            List <DateTime> dateTimes = null;

            if (countType == CountType.SelectDate)
            {
                dateTimes = selectedDates;
            }
            else
            {
                dateTimes = Functions.GetDateInterval(countType, user);
            }

            DateTime start  = dateTimes[0];
            DateTime end    = dateTimes[1];
            var      result = from done in db.WorkDones
                              join plan in db.Plans on done.plan_id equals plan.id
                              join work in db.TodoLists on plan.work_id equals work.id
                              where work.user_id == user.id && done.workDoneTime >= start && done.workDoneTime <= end
                              select new WorkDoneList
            {
                WorkDoneID    = done.id,
                WorkID        = work.id,
                RequestNumber = work.request_number,
                WorkDoneTime  = done.workDoneTime.Value,
                Description   = done.description
            };

            return(result.ToList());
        }
示例#8
0
        private void SyncSettings()
        {
            if (buttonUpdated)
            {
                Actions = tmpActions.ToList <AutoAction>();

                buttonUpdated = false;
            }

            if (actionUpdated)
            {
                Actions = tmpActions.ToList <AutoAction>();

                actionUpdated = false;
            }

            if (delayUpdated)
            {
                Actions = tmpActions.ToList <AutoAction>();

                delayUpdated = false;
            }

            if (countUpdated)
            {
                countType = tmpCountType;
                count     = tmpCount;

                countUpdated = false;
            }
            //System.Diagnostics.Debug.Print("Settings synced");
        }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImmutableHashSet&lt;T&gt;.MutationResult"/> struct.
 /// </summary>
 /// <param name="root">The root node of the result.</param>
 /// <param name="count">The total element count or a count adjustment.</param>
 /// <param name="countType">The appropriate interpretation for the <paramref name="count"/> parameter.</param>
 internal MutationResult(ImmutableSortedDictionary <int, HashBucket> .Node root, int count, CountType countType = ImmutableHashSet <T> .CountType.Adjustment)
 {
     Requires.NotNull(root, "root");
     this.root      = root;
     this.count     = count;
     this.countType = countType;
 }
示例#10
0
        public long Count(string clientName, CountType type, DateTime?clientStartTime)
        {
            var parameters = new QueryParameters();

            parameters.Fields.Add(new QueryField {
                Name = QueryFieldName.Name, Type = QueryFieldType.Equal, Value = clientName
            });
            parameters.Fields.Add(new QueryField
            {
                Name  = QueryFieldName.Result,
                Type  = type == CountType.Completed ? QueryFieldType.Equal : QueryFieldType.NotEqual,
                Value = (int)WorkUnitResult.FinishedUnit
            });
            if (clientStartTime.HasValue)
            {
                parameters.Fields.Add(new QueryField
                {
                    Name  = type == CountType.Completed ? QueryFieldName.CompletionDateTime : QueryFieldName.DownloadDateTime,
                    Type  = QueryFieldType.GreaterThan,
                    Value = clientStartTime.Value
                });
            }
            PetaPoco.Sql where = WhereBuilder.Execute(parameters);

            var countSql = PetaPoco.Sql.Builder.Select("ID", "InstanceName", "DownloadDateTime", "CompletionDateTime", "Result", "COUNT(*)")
                           .From("WuHistory")
                           .Append(where);

            using (var table = Select(countSql.SQL, countSql.Arguments))
            {
                return((long)table.Rows[0][5]);
            }
        }
        public void IncrementCount(CountType type)
        {
            var current   = _gateway.GetCount(type);
            var new_count = current + 1;

            _gateway.SetCount(type, new_count);

            // publish the value changed
            OnCountChanged.Invoke(this, new CounterEventArgs(type, new_count));
        }
示例#12
0
        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <param name="counts">The counts.</param>
        /// <param name="key">The key.</param>
        /// <returns>System.Int32.</returns>
        internal static int GetCount(Dictionary <CountType, int> counts, CountType key)
        {
            int count;

            if (counts.TryGetValue(key, out count))
            {
                return(count);
            }

            return(0);
        }
 public void SetCount(CountType type, int new_value)
 {
     if (type == CountType.A)
     {
         CountA.Num = new_value;
     }
     else if (type == CountType.B)
     {
         CountB.Num = new_value;
     }
 }
示例#14
0
        /// <summary>
        /// Increments the count.
        /// </summary>
        /// <param name="counts">The counts.</param>
        /// <param name="key">The key.</param>
        internal static void IncrementCount(Dictionary <CountType, int> counts, CountType key)
        {
            int count;

            if (counts.TryGetValue(key, out count))
            {
                count++;
                counts[key] = count;
            }
            else
            {
                counts.Add(key, 1);
            }
        }
示例#15
0
 public XDRPCStringArgumentInfo(
     string v,
     Encoding encoding,
     ArgumentType t,
     int cMax,
     CountType ct)
 {
     this.Value    = v;
     this.PassBy   = t;
     this.Encoding = encoding;
     this.CchMax   = cMax;
     this.MaxType  = ct;
     this.CalculateBufferSize();
 }
示例#16
0
        /// <summary>
        /// Increments the count.
        /// </summary>
        /// <param name="counts">The counts.</param>
        /// <param name="key">The key.</param>
        internal static void IncrementCount(Dictionary<CountType, int> counts, CountType key)
        {
            int count;

            if (counts.TryGetValue(key, out count))
            {
                count++;
                counts[key] = count;
            }
            else
            {
                counts.Add(key, 1);
            }
        }
 public int GetCount(CountType type)
 {
     if (type == CountType.A)
     {
         return(CountA.Num);
     }
     else if (type == CountType.B)
     {
         return(CountB.Num);
     }
     else
     {
         return(-1);
     }
 }
示例#18
0
        public static string ConvertCountTypeToString(CountType countType)
        {
            switch (countType)
            {
            case CountType.Daily: return(Lang.SettingsRadioDaily);

            case CountType.Weekly: return(Lang.SettingsRadioWeekly);

            case CountType.Montly: return(Lang.SettingsRadioMonthly);

            case CountType.Yearly: return(Lang.SettingsRadioYearly);

            default:
            case CountType.FromTheBeginning: return(Lang.SettingsRadioBeforeStart);
            }
        }
示例#19
0
 public BlockVolume BlockVolume(ISeries <double> input, double blockSize, CountType countType)
 {
     if (cacheBlockVolume != null)
     {
         for (int idx = 0; idx < cacheBlockVolume.Length; idx++)
         {
             if (cacheBlockVolume[idx] != null && cacheBlockVolume[idx].BlockSize == blockSize && cacheBlockVolume[idx].CountType == countType && cacheBlockVolume[idx].EqualsInput(input))
             {
                 return(cacheBlockVolume[idx]);
             }
         }
     }
     return(CacheIndicator <BlockVolume>(new BlockVolume()
     {
         BlockSize = blockSize, CountType = countType
     }, input, ref cacheBlockVolume));
 }
示例#20
0
        public List <WorkDoneandPlans> GetWorkDoneAndPlansForReport(User user, CountType countType, List <DateTime> selectedDates = null)
        {
            List <DateTime> dateTimes = null;

            if (countType == CountType.SelectDate)
            {
                dateTimes = selectedDates;
            }
            else
            {
                dateTimes = Functions.GetDateInterval(countType, user);
            }

            DateTime start = dateTimes[0];
            DateTime end   = dateTimes[1];

            var plans = from plan in db.Plans
                        join work in db.TodoLists on plan.work_id equals work.id
                        where work.user_id == user.id
                        where plan.work_plan_time >= start && plan.work_plan_time <= end
                        orderby plan.id ascending
                        select new WorkDoneandPlans
            {
                PlanDate      = plan.work_plan_time,
                Priority      = work.priority,
                RequestNumber = work.request_number,
                AddDate       = plan.add_time
            };

            var wDone = from done in db.WorkDones
                        join plan in db.Plans on done.plan_id equals plan.id
                        join work in db.TodoLists on plan.work_id equals work.id
                        where work.user_id == user.id && done.workDoneTime >= start && done.workDoneTime <= end
                        select new WorkDoneandPlans
            {
                PlanDate      = plan.work_plan_time,
                Priority      = work.priority,
                RequestNumber = work.request_number,
                WorkDoneDate  = done.workDoneTime.Value
            };
            List <WorkDoneandPlans> merge = new List <WorkDoneandPlans>();

            merge.AddRange(plans.ToList());
            merge.AddRange(wDone.ToList());
            return(merge);
        }
示例#21
0
        public int GetRequestCount(PriorityType priorityType, User user, CountType countType, List <DateTime> selectedDates = null)
        {
            List <DateTime> dateTimes;

            if (countType == CountType.SelectDate)
            {
                dateTimes = selectedDates;
            }
            else
            {
                dateTimes = Functions.GetDateInterval(countType, user);
            }

            DateTime timeStart = dateTimes[0];
            DateTime timeEnd   = dateTimes[1];

            return(db.TodoLists.Where(x => x.user_id == user.id && x.add_time >= timeStart && x.add_time <= timeEnd && x.priority == (int)priorityType).Count());
        }
示例#22
0
        private string GetCode(string code, string startVal, int codeCount, CountType countType)
        {
            int    replacementLength = code.LastIndexOf('#') - code.IndexOf('#') + 1;
            string textToReplace     = new string('#', replacementLength);

            switch (countType)
            {
            case CountType.NumericDecimal:
                int    startValInt = int.Parse(startVal);
                string result      = code.Replace(textToReplace, (startValInt + codeCount).ToString(new string('0', replacementLength)));
                return(result);

            case CountType.NumericHexadecimal:
                break;

            case CountType.Alphabetical:
                break;
            }
            return(code);
        }
示例#23
0
        public IHttpActionResult GetCountFreight(CountType t)
        {
            System.Diagnostics.Debug.WriteLine(t.QueryType);
            if (t.QueryType == "freightCount")
            {
                using (var ctx = new OracleDbContext())
                {
                    var freightOrderNumber = ctx.FreightOrder.Where(x => x.DueDate >= t.From && x.DueDate <= t.To).Count();//日期比from大比to小
                    var s = new CountFreight();
                    s.freightOrderNumber = freightOrderNumber;

                    var w = Json <CountFreight>(s);
                    return(Json <CountFreight>(s));
                }
            }
            else if (t.QueryType == "freightDailyCount")
            {
                var dailyOrderFlow = new List <DailyCountFreight>(); //传回去的表
                var sf             = new DailyCountFreight();        //用于加入LIST
                var temp           = t.From;                         //日期的临时变量用于判断
                while (temp <= t.To)                                 //当时间大于to时结束循环
                {
                    sf.Date = temp.ToString("d");                    //先把当天日期放到sf的Date中

                    var tomorrow = temp.AddDays(1);
                    using (var ctx = new OracleDbContext())
                    {
                        var count = ctx.FreightOrder.Where(x => x.DueDate >= temp && x.DueDate <= tomorrow).Count();
                        sf.freightOrderNumber = count;//放count
                    }
                    dailyOrderFlow.Add(sf);
                    temp = tomorrow;                                      //日期加一天
                }
                return(Json <List <DailyCountFreight> >(dailyOrderFlow)); //返回
            }
            else
            {
                return(Json <string>("error"));
            }
        }
示例#24
0
        private static int GetCount(IDbConnection conn, IDbTransaction trans, CountType countType, string userId)
        {
            var param = new { UserId = userId };

            switch (countType)
            {
            case CountType.Share:
                return(conn.ExecuteScalar <int>("select count(*) from T_Activitys where UserId=@UserId", param, trans));

            case CountType.Friend:
                return(conn.ExecuteScalar <int>("select count(*) from T_UserFriends where (UserId=@UserId or FriendId=@UserId) and Status='1'", param, trans));

            case CountType.Attention:
                return(conn.ExecuteScalar <int>("select count(*) from T_UserAttentions where UserId=@UserId", param, trans));

            case CountType.Fans:
                return(conn.ExecuteScalar <int>("select count(*) from T_UserAttentions where AttentionId=@UserId", param, trans));

            default:
                return(0);
            }
        }
示例#25
0
        private void SyncSettings()
        {
            if (buttonUpdated)
            {
                buttonType  = tmpButtonType;
                doubleClick = tmpDoubleClick;

                buttonUpdated = false;
            }

            if (locationUpdated)
            {
                locationType = tmpLocationType;
                x            = tmpX;
                y            = tmpY;
                width        = tmpWidth;
                height       = tmpHeight;

                locationUpdated = false;
            }

            if (delayUpdated)
            {
                delayType  = tmpDelayType;
                delay      = tmpDelay;
                delayRange = tmpDelayRange;

                delayUpdated = false;
            }

            if (countUpdated)
            {
                countType = tmpCountType;
                count     = tmpCount;

                countUpdated = false;
            }
            //System.Diagnostics.Debug.Print("Settings synced");
        }
示例#26
0
        public static List <DateTime> GetDateInterval(CountType countType, User user = null)
        {
            DateTime timeStart, timeEnd;

            switch (countType)
            {
            case CountType.Daily:
                timeStart = DateTime.Now.Date.AddSeconds(0);
                timeEnd   = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
                break;

            default:
            case CountType.Weekly:
                timeStart = DateTime.Now.AddDays(-(int)DateTime.Now.DayOfWeek + (int)DayOfWeek.Monday).Date;
                timeEnd   = timeStart.AddDays(5).Date.AddSeconds(-1);
                break;

            case CountType.Montly:
                timeStart = DateTime.Now.AddDays(-DateTime.Now.Day).Date.AddSeconds(1).AddDays(1);
                timeEnd   = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1).AddSeconds(-1);
                break;

            case CountType.Yearly:
                timeStart = new DateTime(DateTime.Now.Year, 1, 1).Date;
                timeEnd   = new DateTime(DateTime.Now.Year, 12, 1).AddMonths(1).AddSeconds(-1);
                break;

            case CountType.FromTheBeginning:
                timeStart = user.register_date;
                timeEnd   = new DateTime(DateTime.Now.Year, 12, 31).AddDays(1).AddSeconds(-1);
                break;
            }
            List <DateTime> dateTimes = new List <DateTime>();

            dateTimes.Add(timeStart);
            dateTimes.Add(timeEnd);
            return(dateTimes);
        }
示例#27
0
        private void MakeCount(CountType ct)
        {
            switch (ct)
            {
            //Prakash 11/26/12 - Added Code to Handle the null Refernce exceptions

            case CountType.Add:
                Application.Lock();
                if (Application["UserCount"] == null)
                {
                    Application["UserCount"] = 1;
                }
                else
                {
                    Application["UserCount"] = (int)Application["UserCount"] + 1;
                }
                Application.UnLock();
                break;

            //case CountType.Add:
            //    Application.Lock();
            //    Application["UserCount"] = (int)Application["UserCount"] + 1;
            //    Application.UnLock();
            //    break;

            case CountType.Dec:
                Application.Lock();
                Application["UserCount"] = (int)Application["UserCount"] - 1;
                Application.UnLock();
                break;

            case CountType.Reset:
                Application.Lock();
                Application["UserCount"] = 0;
                Application.UnLock();
                break;
            }
        }
示例#28
0
        private void SyncSettings()
        {
            if (buttonUpdated)
            {
                buttonType  = tmpButtonType;
                doubleClick = tmpDoubleClick;

                buttonUpdated = false;
            }

            if (locationUpdated)
            {
                locationType = tmpLocationType;
                x            = tmpX;
                y            = tmpY;
                width        = tmpWidth;
                height       = tmpHeight;

                locationUpdated = false;
            }

            if (delayUpdated)
            {
                delayType  = tmpDelayType;
                delay      = tmpDelay;
                delayRange = tmpDelayRange;

                delayUpdated = false;
            }

            if (countUpdated)
            {
                countType = tmpCountType;
                count     = tmpCount;

                countUpdated = false;
            }
        }
示例#29
0
        public static void AddCount(CountType type)
        {
            switch (type)
            {
            case CountType.UDCSelect:
                data.UDCCount++;
                break;

            case CountType.STGSelect:
                data.STGCount++;
                break;

            case CountType.UDCEnd:
                data.UDCCountEnd++;
                break;

            case CountType.STGEnd:
                data.STGCountEnd++;
                break;
            }

            data.SaveData();
        }
示例#30
0
        public List <WeeklyPlanDetail> GetPlansForReport(User user, CountType countType, List <DateTime> selectedDates = null)
        {
            List <DateTime> dateTimes = null;

            if (countType == CountType.SelectDate)
            {
                dateTimes = selectedDates;
            }
            else
            {
                dateTimes = Functions.GetDateInterval(countType, user);
            }

            DateTime start = dateTimes[0];
            DateTime end   = dateTimes[1];

            if (countType == CountType.FromTheBeginning)
            {
                start = user.register_date;                                           // report date bug fix.
            }
            var result = from plan in db.Plans
                         join work in db.TodoLists on plan.work_id equals work.id
                         where work.user_id == user.id
                         where plan.work_plan_time >= start && plan.work_plan_time <= end
                         orderby plan.id ascending
                         select new WeeklyPlanDetail
            {
                WorkID        = work.id,
                PlanID        = plan.id,
                PlanDate      = plan.work_plan_time,
                Priority      = work.priority,
                RequestNumber = work.request_number,
                AddDate       = plan.add_time
            };

            return(result.ToList());
        }
示例#31
0
        /// <summary>
        /// Returns ONLY a count from the specified query.
        ///
        /// See: https://postgrest.org/en/v7.0.0/api.html?highlight=count
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Task <int> Count(CountType type)
        {
            var tsc = new TaskCompletionSource <int>();

            Task.Run(async() =>
            {
                method = HttpMethod.Head;

                var attr = type.GetAttribute <MapToAttribute>();

                var headers = new Dictionary <string, string> {
                    { "Prefer", $"count={attr.Mapping}" }
                };

                var request = Send(method, null, headers);
                Clear();

                try
                {
                    var response = await request;
                    var countStr = response.ResponseMessage.Content.Headers.GetValues("Content-Range").FirstOrDefault();
                    if (countStr.Contains("/"))
                    {
                        // Returns X-Y/COUNT [0-3/4]
                        tsc.SetResult(int.Parse(countStr.Split('/')[1]));
                    }
                    tsc.SetException(new Exception("Failed to parse response."));
                }
                catch (Exception ex)
                {
                    tsc.SetException(ex);
                }
            });

            return(tsc.Task);
        }
示例#32
0
    private void CountByItemPeriodOrByDisNo(CountType ct)
    {
        #region
        try
        {
            if (dt_QueryResult != null && dt_QueryResult.Rows.Count > 0)
            {
                #region
                DataView dv = dt_QueryResult.DefaultView;
                DataView dv1 = dt_QueryResult.DefaultView;
                DataView dv2 = dt_QueryResult.DefaultView;

                if (ct == CountType.ByItemPeriod)
                    dv.Sort = "ITEM,PERIOD";
                else if (ct == CountType.ByDisNo)
                    dv.Sort = "DIS_NO";


                DataTable dtSorted = dv.ToTable();
                string strDistinctKey = "";
                string strDistinctKeyBefore = "";

                string strDistinctKey1 = "";
                string strDistinctKey2 = "";

                string strDATA_SOURCE = "";
                string strDIS_KIND = "";

                if (dtSorted != null && dtSorted.Rows.Count > 0)
                {
                    for (Int32 i = 0; i <= dtSorted.Rows.Count - 1; i++)
                    {
                        #region
                        strDATA_SOURCE = dtSorted.Rows[i]["DATA_SOURCE"].ToString().Trim();
                        strDIS_KIND = dtSorted.Rows[i]["DIS_KIND"].ToString().Trim();

                        if (ct == CountType.ByItemPeriod)
                            strDistinctKey = string.Format("{0}_{1}", dtSorted.Rows[i]["ITEM"].ToString().Trim(), dtSorted.Rows[i]["PERIOD"].ToString().Trim());
                        else if (ct == CountType.ByDisNo)
                            strDistinctKey = string.Format("{0}", dtSorted.Rows[i]["DIS_NO"].ToString().Trim());


                        if (strDistinctKey != strDistinctKeyBefore)
                        {
                            if (strDATA_SOURCE == "2" && strDIS_KIND == "1")//計算 客服訂單轉理貨
                                iCount1 = iCount1 + 1;
                            else if (strDATA_SOURCE != "2" && strDIS_KIND == "1")//計算 一般配本
                                iCount2 = iCount2 + 1;


                            iCount3 = iCount3 + 1;//計算 出貨合計

                        }
                        else
                        {
                            //指定KEY重複
                            iCount5 = iCount5 + 1;
                            strDuplicated += strDistinctKey + ";";
                        }

                        if (ct == CountType.ByItemPeriod)
                            strDistinctKeyBefore = string.Format("{0}_{1}", dtSorted.Rows[i]["ITEM"].ToString().Trim(), dtSorted.Rows[i]["PERIOD"].ToString().Trim());
                        else if (ct == CountType.ByDisNo)
                            strDistinctKeyBefore = string.Format("{0}", dtSorted.Rows[i]["DIS_NO"].ToString().Trim());
                        #endregion
                    }
                }

                #endregion

                #region 計算 重複品項


                dv1.RowFilter = "DATA_SOURCE='2'";
                DataTable dt1 = dv1.ToTable();

                dv2.RowFilter = "DATA_SOURCE<>'2'";
                DataTable dt2 = dv2.ToTable();

                for (Int32 i = 0; i <= dt1.Rows.Count - 1; i++)
                {

                    if (ct == CountType.ByItemPeriod)
                        strDistinctKey1 = string.Format("{0}_{1}", dt1.Rows[i]["ITEM"].ToString().Trim(), dt1.Rows[i]["PERIOD"].ToString().Trim());
                    else if (ct == CountType.ByDisNo)
                        strDistinctKey1 = string.Format("{0}", dt1.Rows[i]["DIS_NO"].ToString().Trim());

                    for (Int32 j = 0; j <= dt2.Rows.Count - 1; j++)
                    {
                        if (ct == CountType.ByItemPeriod)
                            strDistinctKey2 = string.Format("{0}_{1}", dt2.Rows[j]["ITEM"].ToString().Trim(), dt2.Rows[j]["PERIOD"].ToString().Trim());
                        else if (ct == CountType.ByDisNo)
                            strDistinctKey2 = string.Format("{0}", dt2.Rows[j]["DIS_NO"].ToString().Trim());


                        if (strDistinctKey1 == strDistinctKey2)
                            iCount4 = iCount4 + 1;

                    }
                }


                #endregion

            }

            //ResultMsgLabel.Text = strDuplicated;

            if (ct == CountType.ByItemPeriod)
            {
                txt_CountItem1.Text = iCount1.ToString();
                txt_CountItem2.Text = iCount2.ToString();
                txt_CountItem3.Text = iCount3.ToString();
                txt_CountItem4.Text = iCount4.ToString();
            }
            else if (ct == CountType.ByDisNo)
            {
                txt_CountDisNo1.Text = iCount1.ToString();
                txt_CountDisNo2.Text = iCount2.ToString();
                txt_CountDisNo3.Text = iCount3.ToString();
                txt_CountDisNo4.Text = iCount4.ToString();
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
示例#33
0
        public void UpdateCount(CountType CountType, int Count)
        {
            tmpCountType = CountType;
            tmpCount = Count;

            countUpdated = true;
        }
示例#34
0
 static private byte[] EncryptAesGcm(Command command, Security security, UInt32 FrameCounter, byte[] systemTitle, byte[] BlockCipherKey, byte[] AuthenticationKey, byte[] plainText, CountType type, out byte[] countTag)
 {
     countTag = null;
     List<byte> data = new List<byte>();
     if (type == CountType.Packet)
     {
         data.Add((byte)security);
     }
     byte[] tmp = BitConverter.GetBytes(FrameCounter).Reverse().ToArray();
     byte[] aad = GetAuthenticatedData(security, AuthenticationKey, plainText);
     GXDLMSChipperingStream gcm = new GXDLMSChipperingStream(security, true, BlockCipherKey, aad, GetNonse(FrameCounter, systemTitle), null);
     // Encrypt the secret message
     if (security != Security.Authentication)
     {                
         gcm.Write(plainText);
     }
     byte[] ciphertext = gcm.FlushFinalBlock();
     if (security == Security.Authentication)
     {
         if (type == CountType.Packet)
         {
             data.AddRange(tmp);
         }
         if ((type & CountType.Data) != 0)
         {
             data.AddRange(plainText);
         }
         if ((type & CountType.Tag) != 0)
         {
             countTag = gcm.GetTag();
             data.AddRange(countTag);                    
         }
     }
     else if (security == Security.Encryption)
     {
         data.AddRange(tmp);
         data.AddRange(ciphertext);
     }
     else if (security == Security.AuthenticationEncryption)
     {
         if (type == CountType.Packet)
         {
             data.AddRange(tmp);
         }
         if ((type & CountType.Data) != 0)
         {
             data.AddRange(ciphertext);
         }
         if ((type & CountType.Tag) != 0)
         {
             countTag = gcm.GetTag();
             data.AddRange(countTag);
         }
     }
     else
     {
         throw new ArgumentOutOfRangeException("security");
     }
     if (type == CountType.Packet)
     {
         Gurux.DLMS.Internal.GXCommon.SetObjectCount(data.Count, data, 0);
         data.Insert(0, (byte)command);
     }
     return data.ToArray();        
 }
示例#35
0
      public long Count(string clientName, CountType type, DateTime? clientStartTime)
      {
         var parameters = new QueryParameters();
         parameters.Fields.Add(new QueryField { Name = QueryFieldName.Name,   Type = QueryFieldType.Equal, Value = clientName });
         parameters.Fields.Add(new QueryField
                               {
                                  Name = QueryFieldName.Result,
                                  Type = type == CountType.Completed ? QueryFieldType.Equal : QueryFieldType.NotEqual,
                                  Value = (int)WorkUnitResult.FinishedUnit
                               });
         if (clientStartTime.HasValue)
         {
            parameters.Fields.Add(new QueryField
                                  {
                                     Name = type == CountType.Completed ? QueryFieldName.CompletionDateTime : QueryFieldName.DownloadDateTime,
                                     Type = QueryFieldType.GreaterThan,
                                     Value = clientStartTime.Value
                                  });
         }
         PetaPoco.Sql where = WhereBuilder.Execute(parameters);

         var countSql = PetaPoco.Sql.Builder.Select("ID", "InstanceName", "DownloadDateTime", "CompletionDateTime", "Result", "COUNT(*)")
            .From("WuHistory")
            .Append(where);

         using (var table = Select(countSql.SQL, countSql.Arguments))
         {
            return (long)table.Rows[0][5];
         }
      }
示例#36
0
 public int UpdateCount(CountType type, int ID)
 {
     SqlHelper objSqlHelper = new SqlHelper();
     SqlParameter[] objParams = new SqlParameter[2];
     objParams[0] = new SqlParameter("@type", (int)type);
     objParams[1] = new SqlParameter("@ID", ID);
     return objSqlHelper.ExecuteNonQuery("je_Book_UpdateCount", objParams);
 }
示例#37
0
       public static int UpdateCount(CountType type, int ID)
       {

           return books.UpdateCount(type, ID);
       }
示例#38
0
        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <param name="counts">The counts.</param>
        /// <param name="key">The key.</param>
        /// <returns>System.Int32.</returns>
        internal static int GetCount(Dictionary<CountType, int> counts, CountType key)
        {
            int count;

            if (counts.TryGetValue(key, out count))
            {
                return count;
            }

            return 0;
        }
示例#39
0
        private void SyncSettings()
        {
            if (buttonUpdated)
            {
                buttonType = tmpButtonType;
                doubleClick = tmpDoubleClick;

                buttonUpdated = false;
            }

            if (locationUpdated)
            {
                locationType = tmpLocationType;
                x = tmpX;
                y = tmpY;
                width = tmpWidth;
                height = tmpHeight;

                locationUpdated = false;
            }

            if (delayUpdated)
            {
                delayType = tmpDelayType;
                delay = tmpDelay;
                delayRange = tmpDelayRange;

                delayUpdated = false;
            }

            if (countUpdated)
            {
                countType = tmpCountType;
                count = tmpCount;

                countUpdated = false;
            }
            //System.Diagnostics.Debug.Print("Settings synced");
        }
示例#40
0
 public long Count(string clientName, CountType type)
 {
    return Count(clientName, type, null);
 }
示例#41
0
        /// <summary>
        /// Populate the numbers array for the type of output required
        /// </summary>
        /// <param name="Model"></param>
        /// <param name="code"></param>
        /// <param name="bUseYoung"></param>
        /// <param name="bUseAll"></param>
        /// <param name="bUseTag"></param>
        /// <param name="numbers"></param>
        /// <returns></returns>
        public static bool PopulateNumberValue(TStockList Model, CountType code, bool bUseYoung, bool bUseAll, bool bUseTag, ref int[] numbers)
        {
            int iNoPasses;
            TAnimalGroup aGroup;
            int iValue;
            int iTotal;
            int iPass, Idx;

            bool Result = true;
            Array.Clear(numbers, 0, numbers.Length);

            if (bUseTag)
                iNoPasses = numbers.Length;
            else
                iNoPasses = 1;

            for (iPass = 1; iPass <= iNoPasses; iPass++)
            {
                iTotal = 0;

                for (Idx = 1; Idx <= Model.Count(); Idx++)
                    if (!bUseTag || (Model.getTag(Idx) == iPass))
                    {
                        if (!bUseYoung)
                            aGroup = Model.At(Idx);
                        else
                            aGroup = Model.At(Idx).Young;

                        iValue = 0;
                        if (aGroup != null)
                        {
                            switch (code)
                            {
                                case CountType.eBoth:
                                    iValue = aGroup.NoAnimals;
                                    break;
                                case CountType.eFemale:
                                    iValue = aGroup.FemaleNo;
                                    break;
                                case CountType.eMale:
                                    iValue = aGroup.MaleNo;
                                    break;
                                default:
                                    Result = false;
                                    break;
                            }
                        }
                        if (!bUseTag && !bUseAll)
                            numbers[Idx - 1] = iValue;
                        else
                            iTotal = iTotal + iValue;
                    } // _ loop over animal groups 

                if (bUseAll)
                    numbers[0] = iTotal;
                else if (bUseTag)
                    numbers[iPass - 1] = iTotal;
            } //_ loop over passes _
            return Result;
        }