Esempio n. 1
0
        protected string ReturnAllItems()
        {
            String strOutput = "{\"aaData\":[";

            var          connString   = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            RepDayOffDAL repDayOffDal = new RepDayOffDAL(connString);

            var targetConfigs = repDayOffDal.GetAllTargetItems();

            foreach (var item in targetConfigs)
            {
                String strEdit = "<img src='../../Images/Edit.png'  onclick='Delete(" + item.Id + ")'/>";
                strOutput = strOutput + "[\"" + item.Id + "\","
                            + "\"" + item.TargetTitle + "\","
                            + "\"" + Math.Truncate(item.TargetAmount) + "\","
                            + "\"" + item.TargetDay.ToString("dd-MM-yyyy") + "\","
                            + "\"" + strEdit + "\"],";
            }

            if (targetConfigs.Count() > 0)
            {
                int Length = strOutput.Length;
                strOutput = strOutput.Substring(0, (Length - 1));
            }
            strOutput = strOutput + "]}";



            return(strOutput);
        }
        public string HandleConfigTarget()
        {
            string re = "";

            var connectionString = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;

            var targetConfig = new RepDayOffDAL(connectionString);

            var listConfig = targetConfig.GetAllTargetItems();
            var currentDay = DateTime.Now.Date;

            listConfig = (from cons in listConfig where cons.TargetDay.Date == currentDay
                          select cons).ToList();

            if (listConfig.Count() > 0)
            {
                getRepName();
                re = listConfig[0].TargetTitle + "," + Math.Truncate(listConfig[0].TargetAmount);
            }

            float dailyVolume = 0.0f;

            foreach (var pair in di_getStat)
            {
                obj_Contact = (DelReport_Contact)pair.Value;
                String repName = obj_Contact.FirstName + " " + obj_Contact.LastName;
                dailyVolume = dailyVolume + getDailyVolume(repName);
            }
            if (!string.IsNullOrEmpty(re))
            {
                re = re + "," + dailyVolume + "," + listConfig[0].Id + "," + listConfig[0].IsReached;
            }

            return(re);
        }