Exemple #1
0
        public void GetTotalSeconds()
        {
            var a = ConvertDate.TotalSeconds(DateTime.Today);

            var b2 = (decimal)32344729;
            var c2 = ConvertDate.DecimalToDate(b2);


            //IAuthContainerModel model = new JWTContainerModel()
            //{
            //    Claims = new Claim[]
            //    {
            //        new Claim(ClaimTypes.Name, "abc"),
            //        new Claim("ID", "93"),
            //    }
            //};
            //IAuthService authService = new JWTService();
            //var token = authService.GenerateToken(model);
            //var b = authService.IsTokenValid("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjAyOTQyMzkzIiwiSUQiOiI5MyIsIm5iZiI6MTU4OTc3MDg5OSwiZXhwIjoxNTkwMzc1Njk5LCJpYXQiOjE1ODk3NzA4OTl9.uQ4mIkacmm2JAGnZWSUGtf8iI352q6dyagrxu8dOMZI");
            //var c = authService.GetTokenClaims(token);
            //var id = c.Where(m => m.Type == "ID").FirstOrDefault().Value;
        }
Exemple #2
0
        public virtual void ExportProductsExcel(string filePath, List <StorageWarehousingItem> lstStorageProduct)
        {
            var newFile = new FileInfo(filePath);

            // ok, we can run the real code of the sample now
            int dem = 0;

            using (var xlPackage = new ExcelPackage(newFile))
            {
                // uncomment this line if you want the XML written out to the outputDir
                //xlPackage.DebugMode = true;
                // get handle to the existing worksheet
                var worksheet = xlPackage.Workbook.Worksheets.Add("Phiếu nhập kho");
                xlPackage.Workbook.CalcMode = ExcelCalcMode.Manual;
                //Create Headers and format them
                var properties = new string[]
                {
                    "STT",
                    "Mã phiếu",
                    "Ngày nhập",
                    "Tổng tiền",
                    "Ghi chú"
                };
                for (var i = 0; i < properties.Length; i++)
                {
                    worksheet.Cells[1, i + 1].Value = properties[i];
                    worksheet.Cells[1, i + 1].Style.Fill.PatternType = ExcelFillStyle.Solid;
                    worksheet.Cells[1, i + 1].Style.Fill.BackgroundColor.SetColor(Color.FromArgb(184, 204, 228));
                    worksheet.Cells[1, i + 1].Style.Font.Bold = true;
                }

                var row = 2;
                foreach (var item in lstStorageProduct)
                {
                    dem++;
                    int col = 1;
                    worksheet.Cells[row, col].Value = dem;
                    col++;

                    worksheet.Cells[row, col].Value = item.Code;
                    col++;
                    // email
                    worksheet.Cells[row, col].Value = ConvertDate.DecimalToDate(item.DateCreated).ToString("dd/MM/yyyy");
                    col++;
                    // điện thoại
                    worksheet.Cells[row, col].Value = item.TotalPrice.Money();
                    col++;
                    // địa chỉ
                    worksheet.Cells[row, col].Value = item.Note;
                    row++;
                }

                // we had better add some document properties to the spreadsheet
                // set some core property values
                var nameexcel = "Danh sách nhập kho" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff");
                xlPackage.Workbook.Properties.Title   = string.Format("{0} reports", nameexcel);
                xlPackage.Workbook.Properties.Author  = "FDI-IT";
                xlPackage.Workbook.Properties.Subject = string.Format("{0} reports", "");
                //xlPackage.Workbook.Properties.Keywords = string.Format("{0} orders", _storeInformationSettings.StoreName);
                xlPackage.Workbook.Properties.Category = "Report";
                //xlPackage.Workbook.Properties.Comments = string.Format("{0} orders", _storeInformationSettings.StoreName);
                // set some extended property values
                xlPackage.Workbook.Properties.Company = "FDI ";
                //xlPackage.Workbook.Properties.HyperlinkBase = new Uri(_storeInformationSettings.StoreUrl);
                // save the new spreadsheet
                xlPackage.Save();
            }
        }