Exemplo n.º 1
0
        public void DateExtension_CurrentTimeZone_ReturnsTimeZoneByCode()
        {
            var timeZone = TimeZoneInfo.GetSystemTimeZones().First();

            MainApplicationContext.Current.TimeZone = timeZone;
            Assert.Equal(timeZone, DateExtension.CurrentTimeZone());
        }
        //สรุปรายการซ่อมประจำวัน
        public ActionResult ReportDay()
        {
            ViewBag.ReportList = "first active";

            ReportDayViewModel model = new ReportDayViewModel();
            model.Report = new ReportDay();

            DateTime start = DateTime.Today;
            model.DateStart = start.AddYears(543);

            DateTime end = DateTime.Today.AddDays(1);
            model.DateEnd = Convert.ToDateTime(end.AddYears(543).ToString("MM/dd/yyyy"));


            model.Report.Repairs = ReportManager.ReportRepairDay(start);
            model.Report.Claims = ReportManager.ReportClaimDay(start);
            
            var workingstatus = WorkingStatusManager.GetAll().Where(m => m.iDefault>=5 && m.iDefault<=7);
            model.Report.WorkingStatuies = workingstatus.OrderBy(m => m.iDefault).ToList();
            model.Report.Insurances = InsuranceManager.GetAll().OrderBy(m => m.sInsuranceName).ToList();
            model.Report.TCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.STCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "หัวหน้าช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.QCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ฝ่ายตรวจสอบคุณภาพ").OrderBy(m => m.sStaffName).ToList();

            ViewBag.ReportHeader = String.Format("รายงานบริการประจำวันที่ {0}", DateExtension.DateThaiFormat(start));
            return View(model);
        }
Exemplo n.º 3
0
        //สรุปผลงานช่างประจำเดือน
        public ActionResult ReportServices()
        {
            ViewBag.ReportList = "first active";

            ReportServicesViewModel model = new ReportServicesViewModel();

            model.Report = new ReportServices();

            DateTime start = DateExtension.FirstDayOfMonthFromDateTime(DateTime.Now);

            model.DateStart = Convert.ToDateTime(start.AddYears(543).ToString("MM/dd/yyyy"));

            DateTime end = DateExtension.LastDayOfMonthFromDateTime(DateTime.Now);

            model.DateEnd = Convert.ToDateTime(end.AddYears(543).ToString("MM/dd/yyyy"));

            model.Report.Repairs = ReportManager.ReportRepair(start, end);
            model.Report.Claims  = ReportManager.ReportClaim(start, end);


            model.Report.Staffs      = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.SuperStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "หัวหน้าช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.QCStaffs    = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ฝ่ายตรวจสอบคุณภาพ").OrderBy(m => m.sStaffName).ToList();

            ViewBag.ReportHeader = String.Format("รายรับ-รายจ่ายค่าบริการทั้งหมดประจำเดือน {0}", DateExtension.DateThaiFormat2(start));
            return(View(model));
        }
        public static PrivilegeRequestDTO Map(PrivilegeRequestBO privilegeRequest, IZeus zeus)
        {
            PrivilegeRequestDTO self = new PrivilegeRequestDTO
            {
                PrivilegeRequestId = privilegeRequest.Id,
                UserId             = privilegeRequest.UserId,
                Role        = privilegeRequest.RoleName,
                RequestDate = DateExtension.ConvertDateToShort(privilegeRequest.RequestDate)
            };

            return(self);
        }
        public ActionResult Index()
        {
            DateTime dt          = DateExtension.startdayOfweek(DateTime.Now, DayOfWeek.Monday);
            var      amountOrder = db.Orders.Where(o => o.Date_Order >= dt).Count();

            ViewBag.amountOrder = amountOrder;
            var total = (from o in db.Orders
                         join od in db.Order_Detail on o.ID_Order equals od.ID_Order
                         where o.Date_Order >= dt
                         select od).Sum(m => m.Current_Price * m.Amount_Product);

            ViewBag.total = total;
            return(View());
        }
Exemplo n.º 6
0
        public static UserTaskCommentDTO Map(UserTaskCommentBO userTaskComment, IZeus zeus)
        {
            UserTaskCommentDTO self = new UserTaskCommentDTO
            {
                UserTaskCommentId = userTaskComment.Id,
                UserTaskId        = userTaskComment.UserTaskId,
                CommenterId       = userTaskComment.CommenterId,
                Comment           = userTaskComment.Comment,
                CommentDate       = DateExtension.ConvertDateToShort(userTaskComment.CommentDate),
                Date             = userTaskComment.CommentDate,
                RelativeDateTime = userTaskComment.CommentDate.ToRelativeDate(),
            };

            self.CommenterName = userTaskComment.Commenter == null ? "" : userTaskComment.Commenter.FirstName + " " + userTaskComment.Commenter.LastName;

            return(self);
        }
        public ActionResult ReportMonth(ReportMonthViewModel model, FormCollection collection)
        {
            ViewBag.ReportList = "first active";

            DateTime start = model.DateStart;
            model.DateStart = start.AddYears(-543);

            DateTime end = model.DateEnd;
            model.DateEnd = end.AddYears(-543);

            model.Report = new ReportMonth();
            model.Report.Repairs = ReportManager.ReportRepairMonth(model.DateStart, model.DateEnd);
            
            model.Insurances = InsuranceManager.GetAll().OrderBy(m => m.sInsuranceName).ToList();
            ViewBag.ReportHeader = String.Format("สรุปบริการประจำเดือน {0}", DateExtension.DateThaiFormat2(model.DateStart));
            return View(model);
        }
Exemplo n.º 8
0
        public static UserTaskCommentDTO Map(UserTaskCommentBO userTaskComment, string currentUserId, IZeus zeus)
        {
            UserTaskCommentDTO self = new UserTaskCommentDTO
            {
                UserTaskCommentId = userTaskComment.Id,
                UserTaskId        = userTaskComment.UserTaskId,
                CommenterId       = userTaskComment.CommenterId,
                Comment           = userTaskComment.Comment,
                CommentDate       = DateExtension.ConvertDateToShort(userTaskComment.CommentDate),
                Date             = userTaskComment.CommentDate,
                RelativeDateTime = userTaskComment.CommentDate.ToRelativeDate(),
                IsCommenter      = userTaskComment.CommenterId == currentUserId
            };

            if (userTaskComment.Commenter != null)
            {
                self.CommenterName = userTaskComment.CommenterId == currentUserId ? "You" : userTaskComment.Commenter.FirstName + " " + userTaskComment.Commenter.LastName;
            }
            return(self);
        }
        //สรุปรายการซ่อมประจำเดือน
        public ActionResult ReportMonth()
        {
            ViewBag.ReportList = "first active";

            ReportMonthViewModel model = new ReportMonthViewModel();
            model.Report = new ReportMonth();

            DateTime start = DateExtension.FirstDayOfMonthFromDateTime(DateTime.Now);
            model.DateStart = Convert.ToDateTime(start.AddYears(543).ToString("MM/dd/yyyy"));

            DateTime end = DateExtension.LastDayOfMonthFromDateTime(DateTime.Now);
            model.DateEnd = Convert.ToDateTime(end.AddYears(543).ToString("MM/dd/yyyy"));

            model.Report.Repairs = ReportManager.ReportRepairMonth(start, end);
            //model.Report.Claims = ReportManager.ReportClaim(start, end);

            model.Insurances = InsuranceManager.GetAll().OrderBy(m => m.sInsuranceName).ToList();
            ViewBag.ReportHeader = String.Format("สรุปบริการประจำเดือน {0}", DateExtension.DateThaiFormat2(start));
            return View(model);
        }
Exemplo n.º 10
0
        public static UserTaskDTO Map(UserTaskBO userTask, IZeus zeus)
        {
            UserTaskDTO self = new UserTaskDTO
            {
                UserTaskId         = userTask.Id,
                TaskTitle          = userTask.Title,
                Description        = userTask.Description,
                AssignedToId       = userTask.UserId,
                Percentage         = DateExtension.PercentageProgressBetweenDates(userTask.BeginDate, userTask.EndDate),
                PercentageComplete = DateExtension.PercentageProgressBetweenDates(userTask.BeginDate, userTask.EndDate).ToString() + "%",
                DateCreated        = DateExtension.ConvertDateToShort(userTask.DateCreated),
                Deadline           = DateExtension.ConvertDateToShort(userTask.EndDate),
                BeginDate          = DateExtension.ConvertDateToShort(userTask.BeginDate),
                CreateDate         = userTask.DateCreated,
                UserTaskHtmlId     = StringConversion.ConvertGuidToString(userTask.Id),
                TaskHtmlId         = StringConversion.ConvertGuidToString(userTask.Id)
            };

            self.AssignedTo = userTask.User == null ? "" : userTask.User.FirstName + " " + userTask.User.LastName;

            //get list of measure/target

            return(self);
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    model = (BookingClaimViewModel)System.Web.HttpContext.Current.Session["BookingViewModel"];

                    if (model != null)
                    {
                        runRptViewer();
                        #region Application Setting
                        ReportParameter ApplicationSettingName;
                        ReportParameter ApplicationSettingAddress;
                        ReportParameter ApplicationTel;
                        ReportParameter ApplicationFax;
                        if (model.ApplicationSetting != null)
                        {
                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName))
                            {
                                ApplicationSettingName = new ReportParameter("ApplicationSettingName", model.ApplicationSetting.sApplicationName);
                            }
                            else
                            {
                                ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-");
                            }

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.vApplicationAddress))
                            {
                                ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", model.ApplicationSetting.vApplicationAddress);
                            }
                            else
                            {
                                ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-");
                            }


                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sPhone))
                            {
                                ApplicationTel = new ReportParameter("ApplicationTel", model.ApplicationSetting.sPhone);
                            }
                            else
                            {
                                ApplicationTel = new ReportParameter("ApplicationTel", "-");
                            }

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sFax))
                            {
                                ApplicationFax = new ReportParameter("ApplicationFax", model.ApplicationSetting.sFax);
                            }
                            else
                            {
                                ApplicationFax = new ReportParameter("ApplicationFax", "-");
                            }
                        }
                        else
                        {
                            ApplicationSettingName    = new ReportParameter("ApplicationSettingName", "-");
                            ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-");
                            ApplicationTel            = new ReportParameter("ApplicationTel", "-");
                            ApplicationFax            = new ReportParameter("ApplicationFax", "-");
                        }
                        #endregion

                        #region Customer

                        ReportParameter CustomerName;
                        ReportParameter CustomerMobile;
                        ReportParameter CustomerPhone;
                        if (model.Insurance != null)
                        {
                            if (!String.IsNullOrEmpty(model.Insurance.sInsuranceName))
                            {
                                CustomerName = new ReportParameter("CustomerName", model.Insurance.sInsuranceName);
                            }
                            else
                            {
                                CustomerName = new ReportParameter("CustomerName", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Insurance.sMobile))
                            {
                                CustomerMobile = new ReportParameter("CustomerMobile", model.Insurance.sMobile);
                            }
                            else
                            {
                                CustomerMobile = new ReportParameter("CustomerMobile", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Insurance.sPhone))
                            {
                                CustomerPhone = new ReportParameter("CustomerPhone", model.Insurance.sPhone);
                            }
                            else
                            {
                                CustomerPhone = new ReportParameter("CustomerPhone", "-");
                            }
                        }
                        else
                        {
                            CustomerName   = new ReportParameter("CustomerName", "-");
                            CustomerMobile = new ReportParameter("CustomerMobile", "-");
                            CustomerPhone  = new ReportParameter("CustomerPhone", "-");
                        }
                        #endregion


                        #region Product

                        ReportParameter ProductType;
                        ReportParameter ProductBrand;
                        ReportParameter ProductModel;

                        if (model.Product != null)
                        {
                            if (!String.IsNullOrEmpty(model.Product.vProductTypeDescription))
                            {
                                ProductType = new ReportParameter("ProductType", model.Product.vProductTypeDescription);
                            }
                            else
                            {
                                ProductType = new ReportParameter("ProductType", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Product.vBrandDescription))
                            {
                                ProductBrand = new ReportParameter("ProductBrand", model.Product.vBrandDescription);
                            }
                            else
                            {
                                ProductBrand = new ReportParameter("ProductBrand", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Product.sProductModel))
                            {
                                ProductModel = new ReportParameter("ProductModel", model.Product.sProductModel);
                            }
                            else
                            {
                                ProductModel = new ReportParameter("ProductModel", "-");
                            }
                        }
                        else
                        {
                            ProductType  = new ReportParameter("ProductType", "-");
                            ProductBrand = new ReportParameter("ProductBrand", "-");
                            ProductModel = new ReportParameter("ProductModel", "-");
                        }
                        #endregion


                        #region Claim
                        ReportParameter ReferenceNumber;
                        ReportParameter DateAdd;
                        ReportParameter TimeAdd;
                        ReportParameter Serial;



                        if (model.Claim != null)
                        {
                            if (!String.IsNullOrEmpty(model.Claim.sClaimNo))
                            {
                                ReferenceNumber = new ReportParameter("ReferenceNumber", model.Claim.sClaimNo);
                            }
                            else
                            {
                                ReferenceNumber = new ReportParameter("ReferenceNumber", "-");
                            }

                            if (model.Claim.dtDateAdd.HasValue)
                            {
                                DateAdd = new ReportParameter("DateAdd", DateExtension.DateThaiFormat(model.Claim.dtDateAdd.Value));
                            }
                            else
                            {
                                DateAdd = new ReportParameter("DateAdd", "-");
                            }

                            if (model.Claim.dtDateAdd.HasValue)
                            {
                                TimeAdd = new ReportParameter("TimeAdd", DateTime.Now.ToString(DateExtension.TimeFormat()));
                            }
                            else
                            {
                                TimeAdd = new ReportParameter("TimeAdd", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Claim.sSerial))
                            {
                                Serial = new ReportParameter("Serial", model.Claim.sSerial);
                            }
                            else
                            {
                                Serial = new ReportParameter("Serial", "-");
                            }
                        }
                        else
                        {
                            ReferenceNumber = new ReportParameter("ReferenceNumber", "-");
                            DateAdd         = new ReportParameter("DateAdd", "-");
                            TimeAdd         = new ReportParameter("TimeAdd", "-");
                            Serial          = new ReportParameter("Serial", "-");
                        }

                        #endregion


                        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] {
                            ApplicationSettingName,
                            ApplicationSettingAddress,
                            CustomerName,
                            CustomerMobile,
                            ReferenceNumber,
                            ProductType,
                            DateAdd,
                            TimeAdd,
                            ApplicationTel,
                            Serial,
                            ApplicationFax
                        });
                        Session["BookingViewModel"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public static List <GoogleAnalyticsReport> getGoogleAnalyticsReportData(string profileId, int daysCount, Helper.Cache _redisCache, Helper.AppSettings _appSettings)
        {
            var mongorepo = new MongoRepository("GoogleAnalyticsReport", _appSettings);

            var inMemGoogleAnalyticsDailyReports = _redisCache.Get <List <GoogleAnalyticsReport> >(Domain.Socioboard.Consatants.SocioboardConsts.CacheGoogleAnalyticsReport + profileId);

            if (inMemGoogleAnalyticsDailyReports != null)
            {
                return(inMemGoogleAnalyticsDailyReports);
            }

            if (daysCount == -1)
            {
                var ret = mongorepo.Find <GoogleAnalyticsReport>(t => t.GaProfileId == profileId);

                var task = Task.Run(async() => { return(await ret); });

                if (task.Result == null)
                {
                    return(new List <GoogleAnalyticsReport>());
                }

                var lstGoogleAnalyticsReport = task.Result.ToList();

                if (lstGoogleAnalyticsReport.Count > 0)
                {
                    _redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheGoogleAnalyticsReport + profileId, lstGoogleAnalyticsReport.ToList());
                }

                return(lstGoogleAnalyticsReport.ToList());
            }
            else
            {
                var dayStart = new DateTime(DateTime.UtcNow.AddDays(-90).Year, DateTime.UtcNow.AddDays(-90).Month, DateTime.UtcNow.AddDays(-90).Day, 0, 0, 0, DateTimeKind.Utc);
                var dayEnd   = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, 23, 59, 59, DateTimeKind.Utc);
                var ret      = mongorepo.Find <GoogleAnalyticsReport>(t => t.GaProfileId == profileId && t.date <= DateExtension.ConvertToUnixTimestamp(dayEnd) && t.date >= DateExtension.ConvertToUnixTimestamp(dayStart));

                var task = Task.Run(async() =>
                {
                    return(await ret);
                });

                if (task.Result != null)
                {
                    var lstGoogleAnalyticsReport = task.Result.ToList();
                    if (lstGoogleAnalyticsReport.Count > 0)
                    {
                        _redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheGoogleAnalyticsReport + profileId, lstGoogleAnalyticsReport.ToList());
                    }
                    return(lstGoogleAnalyticsReport.ToList());
                }
            }

            return(new List <GoogleAnalyticsReport>());
        }
Exemplo n.º 13
0
 public AssetController(DateExtension dateExtension)
 {
     _dateExtension = dateExtension;
 }
Exemplo n.º 14
0
            /// <summary>
            /// Handle the notifications from OneSignal that have data passed in order to update the UI
            /// </summary>
            private void HandleNotificationData(JSONObject data)
            {
                string           uidSeekios       = string.Empty;
                string           methodName       = string.Empty;
                Tuple <int, int> batteryAndSignal = null;
                Tuple <double, double, double, double> location = null;
                DateTime date = DateTime.Now;
                int      userCreditDebitAmount    = 0;
                int      seekiosCreditDebitAmount = 0;
                int      idAlert = 0;
                int      idMode  = 0;

                if (!data.IsNull("uidSeekios"))
                {
                    uidSeekios = data.Get("uidSeekios").ToString();
                }

                string seekiosName = string.Empty;

                if (null != uidSeekios && !string.Empty.Equals(uidSeekios))
                {
                    var seekios = App.CurrentUserEnvironment.LsSeekios.FirstOrDefault(el => el.UIdSeekios == uidSeekios);
                    if (seekios != null)
                    {
                        seekiosName = seekios.SeekiosName;
                    }
                }

                if (!data.IsNull("batterySignal"))
                {
                    batteryAndSignal = JsonConvert.DeserializeObject <Tuple <int, int> >(data.Get("batterySignal").ToString());
                }

                if (!data.IsNull("location"))
                {
                    location = JsonConvert.DeserializeObject <Tuple <double, double, double, double> >(data.Get("location").ToString());
                }

                if (!data.IsNull("date"))
                {
                    date = DateExtension.FormatJsonDateToDateTime(data.Get("date").ToString());
                }

                if (!data.IsNull("userCreditDebitAmount"))
                {
                    userCreditDebitAmount = JsonConvert.DeserializeObject <int>(data.Get("userCreditDebitAmount").ToString());
                }

                if (!data.IsNull("seekiosCreditDebitAmount"))
                {
                    seekiosCreditDebitAmount = JsonConvert.DeserializeObject <int>(data.Get("seekiosCreditDebitAmount").ToString());
                }

                if (!data.IsNull("methodName"))
                {
                    methodName = data.Get("methodName").ToString();
                }

                if (!data.IsNull("idAlert"))
                {
                    idAlert = JsonConvert.DeserializeObject <int>(data.Get("idAlert").ToString());
                }

                if (!data.IsNull("idMode"))
                {
                    idMode = JsonConvert.DeserializeObject <int>(data.Get("idMode").ToString());
                }


                if (!string.IsNullOrEmpty(methodName))
                {
                    SeekiosDTO seekios = App.CurrentUserEnvironment.LsSeekios.FirstOrDefault(el => el.UIdSeekios == uidSeekios);

                    switch (methodName)
                    {
                    case "RefreshCredits":
                        App.Locator.ListSeekios.OnHasToRefreshCredits(uidSeekios, userCreditDebitAmount, seekiosCreditDebitAmount, date);
                        break;

                    case "RefreshPosition":
                        if (batteryAndSignal != null && location != null)
                        {
                            App.Locator.BaseMap.OnDemandPositionReceived(uidSeekios, batteryAndSignal, location, date);
                        }
                        break;

                    case "InstructionTaken":
                        if (batteryAndSignal != null)
                        {
                            App.Locator.ListSeekios.SeekiosInstructionTaken(uidSeekios, batteryAndSignal, date);
                        }
                        break;

                    case "NotifySeekiosOutOfZone":
                        if (batteryAndSignal != null && location != null)
                        {
                            App.Locator.ModeZone.OnNotifySeekiosOutOfZone(uidSeekios, batteryAndSignal, location, date);
                        }
                        break;

                    case "AddTrackingLocation":
                        if (batteryAndSignal != null && location != null)
                        {
                            App.Locator.ModeTracking.OnAddTrackingLocation(uidSeekios, batteryAndSignal, location, date);
                        }
                        break;

                    case "AddNewZoneTrackingLocation":
                        if (batteryAndSignal != null && location != null)
                        {
                            App.Locator.ModeZone.OnNewZoneTrackingLocationAdded(uidSeekios, batteryAndSignal, location, date);
                        }
                        break;

                    case "AddNewDontMoveTrackingLocation":
                        if (batteryAndSignal != null && location != null)
                        {
                            App.Locator.ModeDontMove.OnNewDontMoveTrackingLocationAdded(uidSeekios, batteryAndSignal, location, date);
                        }
                        break;

                    case "NotifySeekiosMoved":
                        if (batteryAndSignal != null)
                        {
                            App.Locator.ModeDontMove.OnNotifySeekiosMoved(uidSeekios, batteryAndSignal, date);
                        }
                        break;

                    case "SOSSent":
                        if (seekios != null)
                        {
                            App.Locator.ListSeekios.OnSOSSentReceived(uidSeekios, batteryAndSignal, date);
                        }
                        break;

                    case "SOSLocationSent":
                        if (batteryAndSignal != null && location != null)
                        {
                            App.Locator.BaseMap.NotifySOSLocationReceived(uidSeekios, batteryAndSignal, location, date);
                        }
                        break;

                    case "CriticalBattery":
                        if (seekios != null)
                        {
                            App.Locator.ListSeekios.OnCriticalBatteryReceived(uidSeekios, batteryAndSignal, date);
                        }
                        break;

                    case "PowerSavingDisabled":
                        if (seekios != null)
                        {
                            App.Locator.ListSeekios.OnPowerSavingDisabledReceived(uidSeekios, batteryAndSignal, date);
                        }
                        break;
                    }
                }
            }
Exemplo n.º 15
0
 public void DateExtension_CurrentTimeZone_ReturnsContextTimeZone()
 {
     MainApplicationContext.Current.TimeZone = TimeZoneInfo.Utc;
     Assert.Equal(TimeZoneInfo.Utc, DateExtension.CurrentTimeZone());
 }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.IsPostBack)
                {
                    model = (BookingRepairViewModel)System.Web.HttpContext.Current.Session["BookingViewModel"];

                    if (model != null)
                    {
                        runRptViewer();

                        #region Application Setting
                        //ReportParameter ApplicationLogo;
                        ReportParameter ApplicationSettingName;
                        ReportParameter ApplicationSettingAddress;
                        ReportParameter ApplicationTel;
                        ReportParameter ApplicationFax;
                        if (model.ApplicationSetting != null)
                        {
                            //if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName))
                            //{
                            //    ApplicationLogo = new ReportParameter("ApplicationLogo", model.ApplicationSetting.sLogoUrl);
                            //}
                            //else
                            //{
                            //    ApplicationLogo = new ReportParameter("ApplicationLogo", "");
                            //}

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sApplicationName))
                            {
                                ApplicationSettingName = new ReportParameter("ApplicationSettingName", model.ApplicationSetting.sApplicationName);
                            }
                            else
                            {
                                ApplicationSettingName = new ReportParameter("ApplicationSettingName", "-");
                            }

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.vApplicationAddress))
                            {
                                ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", model.ApplicationSetting.vApplicationAddress);
                            }
                            else
                            {
                                ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-");
                            }


                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sPhone))
                            {
                                ApplicationTel = new ReportParameter("ApplicationTel", model.ApplicationSetting.sPhone);
                            }
                            else
                            {
                                ApplicationTel = new ReportParameter("ApplicationTel", "-");
                            }

                            if (!String.IsNullOrEmpty(model.ApplicationSetting.sFax))
                            {
                                ApplicationFax = new ReportParameter("ApplicationFax", model.ApplicationSetting.sFax);
                            }
                            else
                            {
                                ApplicationFax = new ReportParameter("ApplicationFax", "-");
                            }
                        }
                        else
                        {
                            ApplicationSettingName    = new ReportParameter("ApplicationSettingName", "-");
                            ApplicationSettingAddress = new ReportParameter("ApplicationSettingAddress", "-");
                            ApplicationTel            = new ReportParameter("ApplicationTel", "-");
                            ApplicationFax            = new ReportParameter("ApplicationFax", "-");
                        }
                        #endregion

                        #region Customer

                        ReportParameter CustomerName;
                        ReportParameter CustomerMobile;
                        ReportParameter CustomerPhone;
                        if (model.Customer != null)
                        {
                            if (!String.IsNullOrEmpty(model.Customer.sCustomerName))
                            {
                                CustomerName = new ReportParameter("CustomerName", model.Customer.sCustomerName);
                            }
                            else
                            {
                                CustomerName = new ReportParameter("CustomerName", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Customer.sMobile))
                            {
                                CustomerMobile = new ReportParameter("CustomerMobile", model.Customer.sMobile);
                            }
                            else
                            {
                                CustomerMobile = new ReportParameter("CustomerMobile", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Customer.sPhone))
                            {
                                CustomerPhone = new ReportParameter("CustomerPhone", model.Customer.sPhone);
                            }
                            else
                            {
                                CustomerPhone = new ReportParameter("CustomerPhone", "-");
                            }
                        }
                        else
                        {
                            CustomerName   = new ReportParameter("CustomerName", "-");
                            CustomerMobile = new ReportParameter("CustomerMobile", "-");
                            CustomerPhone  = new ReportParameter("CustomerPhone", "-");
                        }
                        #endregion

                        #region Product

                        ReportParameter ProductType;
                        ReportParameter ProductBrand;
                        ReportParameter ProductModel;


                        if (model.Product != null)
                        {
                            if (!String.IsNullOrEmpty(model.Product.vProductTypeDescription))
                            {
                                ProductType = new ReportParameter("ProductType", model.Product.vProductTypeDescription);
                            }
                            else
                            {
                                ProductType = new ReportParameter("ProductType", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Product.vBrandDescription))
                            {
                                ProductBrand = new ReportParameter("ProductBrand", model.Product.vBrandDescription);
                            }
                            else
                            {
                                ProductBrand = new ReportParameter("ProductBrand", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Product.sProductModel))
                            {
                                ProductModel = new ReportParameter("ProductModel", model.Product.sProductModel);
                            }
                            else
                            {
                                ProductModel = new ReportParameter("ProductModel", "-");
                            }
                        }
                        else
                        {
                            ProductType  = new ReportParameter("ProductType", "-");
                            ProductBrand = new ReportParameter("ProductBrand", "-");
                            ProductModel = new ReportParameter("ProductModel", "-");
                        }
                        #endregion

                        #region Repair
                        ReportParameter ReferenceNumber;
                        ReportParameter DateAdd;
                        ReportParameter TimeAdd;
                        ReportParameter Serial;
                        ReportParameter ProductAccessories;
                        ReportParameter ProductColor;
                        ReportParameter DayWarranty;


                        if (model.Repair != null)
                        {
                            if (!String.IsNullOrEmpty(model.Repair.sRepairNo))
                            {
                                ReferenceNumber = new ReportParameter("ReferenceNumber", model.Repair.sRepairNo);
                            }
                            else
                            {
                                ReferenceNumber = new ReportParameter("ReferenceNumber", "-");
                            }

                            if (model.Repair.dtDateAdd.HasValue)
                            {
                                DateAdd = new ReportParameter("DateAdd", DateExtension.DateThaiFormat(model.Repair.dtDateAdd.Value));
                            }
                            else
                            {
                                DateAdd = new ReportParameter("DateAdd", "-");
                            }

                            if (model.Repair.dtDateAdd.HasValue)
                            {
                                TimeAdd = new ReportParameter("TimeAdd", DateTime.Now.ToString(DateExtension.TimeFormat()));
                            }
                            else
                            {
                                TimeAdd = new ReportParameter("TimeAdd", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Repair.sSerial))
                            {
                                Serial = new ReportParameter("Serial", model.Repair.sSerial);
                            }
                            else
                            {
                                Serial = new ReportParameter("Serial", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Repair.sProductAccessories))
                            {
                                ProductAccessories = new ReportParameter("ProductAccessories", model.Repair.sProductAccessories);
                            }
                            else
                            {
                                ProductAccessories = new ReportParameter("ProductAccessories", "-");
                            }

                            if (!String.IsNullOrEmpty(model.Repair.sColor))
                            {
                                ProductColor = new ReportParameter("ProductColor", model.Repair.sColor);
                            }
                            else
                            {
                                ProductColor = new ReportParameter("ProductColor", "-");
                            }

                            if (model.Repair.iDayWarranty.HasValue)
                            {
                                DayWarranty = new ReportParameter("DayWarranty", model.Repair.iDayWarranty.ToString());
                            }
                            else
                            {
                                DayWarranty = new ReportParameter("DayWarranty", "-");
                            }
                        }
                        else
                        {
                            ReferenceNumber    = new ReportParameter("ReferenceNumber", "-");
                            DateAdd            = new ReportParameter("DateAdd", "-");
                            TimeAdd            = new ReportParameter("TimeAdd", "-");
                            Serial             = new ReportParameter("Serial", "-");
                            ProductAccessories = new ReportParameter("ProductAccessories", "-");
                            ProductColor       = new ReportParameter("ProductColor", "-");
                            DayWarranty        = new ReportParameter("DayWarranty", "-");
                        }

                        #endregion

                        ReportParameter InsuranceExpire;
                        if (model.Repair.dtInsuranceExpire != null)
                        {
                            if (model.Repair.dtInsuranceExpire.HasValue)
                            {
                                InsuranceExpire = new ReportParameter("InsuranceExpire", DateExtension.DateThaiFormat(model.Repair.dtInsuranceExpire.Value));
                            }
                            else
                            {
                                InsuranceExpire = new ReportParameter("InsuranceExpire", "-");
                            }
                        }
                        else
                        {
                            InsuranceExpire = new ReportParameter("InsuranceExpire", "-");
                        }

                        ReportParameter DueDate;
                        if (model.Repair.dtDueDate != null)
                        {
                            if (model.Repair.dtDueDate.HasValue)
                            {
                                DueDate = new ReportParameter("DueDate", DateExtension.DateThaiFormat(model.Repair.dtDueDate.Value));
                            }
                            else
                            {
                                DueDate = new ReportParameter("DueDate", "-");
                            }
                        }
                        else
                        {
                            DueDate = new ReportParameter("DueDate", "-");
                        }

                        ReportViewer1.LocalReport.SetParameters(new ReportParameter[] {
                            ApplicationSettingName,
                            ApplicationSettingAddress,
                            CustomerName,
                            CustomerMobile,
                            CustomerPhone,
                            ProductType,
                            ProductBrand,
                            ReferenceNumber,
                            DateAdd,
                            TimeAdd,
                            ApplicationTel,
                            ProductModel,
                            Serial,
                            InsuranceExpire,
                            ProductAccessories,
                            ProductColor,
                            DayWarranty,
                            DueDate,
                            ApplicationFax
                        });
                        Session["BookingViewModel"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 17
0
 public LookupListController(DateExtension dateExtension)
 {
     _dateExtension = dateExtension;
 }
Exemplo n.º 18
0
 public void DateExtension_CurrentTimeZone_ReturnsContextTimeZone()
 {
     MainApplicationContext.Current.TimeZoneId = "something that will be disregarded";
     MainApplicationContext.Current.TimeZone   = TimeZoneInfo.Utc;
     Assert.AreEqual(TimeZoneInfo.Utc, DateExtension.CurrentTimeZone());
 }
 public DepartmentController(DateExtension dateExtension)
 {
     _dateExtension = dateExtension;
 }
        public static string GetInstagramPostLikes(string profile_id, string access_token, int status, Helper.AppSettings _appSettings)
        {
            MongoRepository InstagramPostLikesRepo = new MongoRepository("InstagramPostLikes", _appSettings);
            MongoRepository InstagramSelfFeedRepo  = new MongoRepository("InstagramSelfFeed", _appSettings);
            string          code_status            = "false";

            Domain.Socioboard.Models.Mongo.InstagramPostLikes insert = new Domain.Socioboard.Models.Mongo.InstagramPostLikes();
            JObject post_data = new JObject();
            string  url       = "https://api.instagram.com/v1/users/" + profile_id + "/media/recent?access_token=" + access_token + "&count=30";

            try
            {
                post_data = JObject.Parse(ApiInstagramHttp(url));
            }
            catch (Exception ex)
            {
            }
            try
            {
                dynamic items = post_data["data"];
                foreach (var item in items)
                {
                    string   post_url          = string.Empty;
                    string   feed_url          = string.Empty;
                    string   user_name         = string.Empty;
                    Guid     Id                = Guid.NewGuid();
                    string   feed_id           = item["id"].ToString();
                    string   feed_type         = item["type"].ToString();
                    string   created_time_feed = item["created_time"].ToString();
                    DateTime create_time_feed  = DateExtension.ToDateTime(DateTime.Now, long.Parse(created_time_feed));

                    Domain.Socioboard.Models.Mongo.InstagramSelfFeed send_data = new Domain.Socioboard.Models.Mongo.InstagramSelfFeed();

                    try
                    {
                        if (feed_type.Equals("video"))
                        {
                            try
                            {
                                post_url  = item["videos"]["standard_resolution"]["url"].ToString();
                                feed_url  = item["link"].ToString();
                                user_name = item["user"]["username"].ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        else if (feed_type.Equals("image"))
                        {
                            try
                            {
                                post_url  = item["images"]["standard_resolution"]["url"].ToString();
                                feed_url  = item["link"].ToString();
                                user_name = item["user"]["username"].ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }

                        send_data.User_name    = user_name;
                        send_data.ProfileId    = profile_id;
                        send_data.FeedId       = feed_id;
                        send_data.Accesstoken  = access_token;
                        send_data.Post_url     = post_url;
                        send_data.Link         = feed_url;
                        send_data.Type         = feed_type;
                        send_data.Created_Time = created_time_feed;
                        var ret  = InstagramSelfFeedRepo.Find <Domain.Socioboard.Models.Mongo.InstagramSelfFeed>(t => t.FeedId.Equals(send_data.FeedId));
                        var task = Task.Run(async() =>
                        {
                            return(await ret);
                        });
                        int count = task.Result.Count;

                        if (count < 1)
                        {
                            InstagramSelfFeedRepo.Add(send_data);
                        }
                    }
                    catch (Exception ex)
                    {
                    }



                    try
                    {
                        dynamic likes = null;
                        string  url1  = "https://api.instagram.com/v1/media/" + feed_id + "/likes?access_token=" + access_token;
                        try
                        {
                            likes = JObject.Parse(ApiInstagramHttp(url1));
                            likes = likes["data"];
                        }
                        catch (Exception ex)
                        {
                        }


                        foreach (var like in likes)
                        {
                            try
                            {
                                string liked_by_id   = like["id"].ToString();
                                string liked_by_name = like["username"].ToString();
                                insert.Profile_Id    = profile_id;
                                insert.Feed_Id       = feed_id;
                                insert.Liked_By_Id   = liked_by_id;
                                insert.Liked_By_Name = liked_by_name;
                                insert.Feed_Type     = feed_type;
                                insert.Created_Date  = Helper.DateExtension.ConvertToUnixTimestamp(DateTime.UtcNow);
                                insert.Status        = status;
                                var ret  = InstagramPostLikesRepo.Find <Domain.Socioboard.Models.Mongo.InstagramPostLikes>(t => t.Feed_Id.Equals(insert.Feed_Id));
                                var task = Task.Run(async() =>
                                {
                                    return(await ret);
                                });
                                int count = task.Result.Count;

                                if (count < 1)
                                {
                                    InstagramPostLikesRepo.Add(insert);
                                }
                                code_status = "true";
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }

            catch (Exception ex)
            {
            }


            return(code_status);
        }
        public ActionResult ReportServiceDay(ReportServiceDayViewModel model, FormCollection collection)
        {
            ViewBag.ReportList = "first active";

            DateTime start = model.DateStart;
            model.DateStart = start.AddYears(-543);

            model.Report = new ReportServiceDay();
            model.Report.Repairs = ReportManager.ReportServiceDay(model.DateStart);
          

            //DateTime DateStart;
            //if (DateTime.TryParse(Request.Form["DateStart"], out DateStart))
            //{
            //    model.DateStart = DateStart.AddYears(-543);
            //    model.Report = new ReportServiceDay();
            //    model.Report.Repairs = ReportManager.ReportServiceDay(DateStart);
            //    ViewBag.ReportHeader = String.Format("รายงานสรุปความเคลื่อนไหวของฟร้อนต์ประจำวันที่ {0}", DateExtension.DateThaiFormat(model.DateStart));
            //}
            ViewBag.ReportHeader = String.Format("รายงานสรุปความเคลื่อนไหวของฟร้อนต์ประจำวันที่ {0}", DateExtension.DateThaiFormat(model.DateStart));
            return View(model);
        }
        //รายงานคสามเคลื่อนไหวประจำวัน
        public ActionResult ReportServiceDay()
        {
            ViewBag.ReportList = "first active";

            ReportServiceDayViewModel model = new ReportServiceDayViewModel();
            model.Report = new ReportServiceDay();

            DateTime start = DateTime.Today;
            model.DateStart = Convert.ToDateTime(start.AddYears(543).ToString("MM/dd/yyyy"));

            model.Report.Repairs = ReportManager.ReportServiceDay(start);
            ViewBag.ReportHeader = String.Format("รายงานสรุปความเคลื่อนไหวของฟร้อนต์ประจำวันที่ {0}", DateExtension.DateThaiFormat(start));
            return View(model);
        }
        public ActionResult ReportServices(ReportServicesViewModel model, FormCollection collection)
        {
            ViewBag.ReportList = "first active";

            DateTime start = model.DateStart;
            model.DateStart = start.AddYears(-543);

            DateTime end = model.DateEnd;
            model.DateEnd = end.AddYears(-543);

            model.Report = new ReportServices();
            model.Report.Repairs = ReportManager.ReportRepair(model.DateStart, model.DateEnd);
            model.Report.Claims = ReportManager.ReportClaim(model.DateStart, model.DateEnd);

            model.Report.Staffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.SuperStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "หัวหน้าช่าง").OrderBy(m => m.sStaffName).ToList();
            model.Report.QCStaffs = StaffManager.GetAll().Where(m => m.StaffPosition.sDescription == "ฝ่ายตรวจสอบคุณภาพ").OrderBy(m => m.sStaffName).ToList();

            ViewBag.ReportHeader = String.Format("รายรับ-รายจ่ายค่าบริการทั้งหมดประจำเดือน {0}", DateExtension.DateThaiFormat2(model.DateStart));
            return View(model);
        }
Exemplo n.º 24
0
 public AssetController(DateExtension dateExtension, ConnectionStringExtension connExtension)
 {
     _dateExtension = dateExtension;
     _connExtension = connExtension;
     ConfigureSetting.GetConnectionString = _connExtension.DefaultConnection;
 }
Exemplo n.º 25
0
 public RoleController(DateExtension dateExtension)
 {
     _dateExtension = dateExtension;
 }
Exemplo n.º 26
0
 public void DateExtension_CurrentTimeZone_ReturnsTimeZoneByCode()
 {
     MainApplicationContext.Current.TimeZoneId = "Central Standard Time";
     MainApplicationContext.Current.TimeZone   = null;
     Assert.AreEqual(TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"), DateExtension.CurrentTimeZone());
 }
Exemplo n.º 27
0
 public void DateExtension_CurrentTimeZone_ReturnsLocalIfNoneSpecified()
 {
     MainApplicationContext.Current.TimeZone = null;
     Assert.Equal(TimeZoneInfo.Local, DateExtension.CurrentTimeZone());
 }
Exemplo n.º 28
0
        public JsonResult SearchJobID(string term)
        {
            try
            {
                term = term.Trim();

                var items = RepairManager.GetBySearch(term);
                //items = items.Where(m => m.RepairStatuies[0].WorkingStatus.iDefault == (int)Working.Claim).ToList();


                return(Json(items.Select(m => new
                {
                    label = m.sRepairNo + " - " + m.Product.sProductName,
                    m.kRepairId,
                    m.sRepairNo,
                    sProductName = m.vProductName,
                    kProductTypeId = m.Product.kProductTypeId,
                    kBrandId = m.Product.kBrandId,
                    sBrandDescription = m.Product.vBrandDescription,
                    sProductTypeDescription = m.Product.vProductTypeDescription,
                    m.Product.kProductId,
                    m.Product.sProductModel,
                    m.sSerial,
                    dtInsuranceExpire = m.dtInsuranceExpire != null ? m.dtInsuranceExpire.GetValueOrDefault().AddYears(543).ToString(DateExtension.DateNumber()) : ""
                })
                            , JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { Result = "ERROR", Message = ex.Message }));
            }
        }
        public static string GetInstagramPostComments(string profile_id, string access_token, Helper.AppSettings _appSettings)
        {
            MongoRepository InstagramPostCommentsRepo = new MongoRepository("InstagramPostComments", _appSettings);
            string          code_status = "false";

            Domain.Socioboard.Models.Mongo.InstagramPostComments insert = new Domain.Socioboard.Models.Mongo.InstagramPostComments();
            JObject post_data = new JObject();
            string  url       = "https://api.instagram.com/v1/users/" + profile_id + "/media/recent?access_token=" + access_token + "&count=100";

            try
            {
                post_data = JObject.Parse(ApiInstagramHttp(url));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            try
            {
                dynamic items = post_data["data"];
                foreach (var item in items)
                {
                    Guid     Id                = Guid.NewGuid();
                    string   feed_id           = item["id"].ToString();
                    string   feed_type         = item["type"].ToString();
                    string   created_time_feed = item["created_time"].ToString();
                    DateTime create_time_feed  = DateExtension.ToDateTime(DateTime.Now, long.Parse(created_time_feed));
                    if (create_time_feed.Date >= DateTime.Now.AddDays(-90).Date)
                    {
                        dynamic comments = item["comments"]["data"];

                        foreach (var comment in comments)
                        {
                            string   created_time      = comment["created_time"].ToString();
                            DateTime create_time       = DateExtension.ToDateTime(DateTime.Now, long.Parse(created_time));
                            string   text              = comment["text"].ToString();
                            string   commented_by_id   = comment["from"]["id"].ToString();
                            string   commented_by_name = comment["from"]["username"].ToString();
                            string   comment_id        = comment["id"].ToString();

                            insert.Profile_Id        = profile_id;
                            insert.Feed_Id           = feed_id;
                            insert.Commented_By_Id   = commented_by_id;
                            insert.Commented_By_Name = commented_by_name;
                            insert.Created_Time      = Helper.DateExtension.ConvertToUnixTimestamp(Convert.ToDateTime(created_time));
                            insert.Comment_Id        = comment_id;
                            insert.Comment           = text;
                            insert.Feed_Type         = feed_type;
                            var ret  = InstagramPostCommentsRepo.Find <Domain.Socioboard.Models.Mongo.InstagramPostComments>(t => t.Feed_Id.Equals(insert.Feed_Id));
                            var task = Task.Run(async() =>
                            {
                                return(await ret);
                            });
                            int count = task.Result.Count;

                            if (count < 1)
                            {
                                InstagramPostCommentsRepo.Add(insert);
                            }
                            code_status = "true";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }



            return(code_status);
        }
Exemplo n.º 30
0
 public LocationController(DateExtension dateExtension)
 {
     _dateExtension = dateExtension;
 }