protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(FiltersStrings.GetText(@"FilterName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(FiltersStrings.GetText(@"SubFilterName"), typeof(string)));

            List <FilterUI> filters = ProductController.GetAllFilter();

            foreach (FilterUI filter in filters)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = filter.FilterName;
                row[i++] = ProductController.ConvertSubFilterListToString(filter.LstSubFilter);
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, true, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=AppUsersExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #2
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"SupplierName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Price"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Gift"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"IsOrder"), typeof(string)));


            List <OfferUI> coll = OfferController.GetAllOfferByBidIdWithIsOrder(BidId);

            foreach (OfferUI offer in coll)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = offer.SupplierName;
                row[i++] = offer.TotalPrice;
                row[i++] = offer.Gift;
                row[i++] = GlobalStrings.GetYesNo(offer.IsOrder);
                dt.Rows.Add(row);
            }
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=OffersExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #3
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        System.Data.DataTable dt = new System.Data.DataTable();

        dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"OrderId"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"OrderDate"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"BidId"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"TotalPrice"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"ApprovedDeal"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierProfileStrings.GetText(@"DealDetails"), typeof(string)));


        int      year  = Convert.ToInt32(ddlyear.SelectedValue);
        int      month = Convert.ToInt32(ddlMonth.SelectedValue);
        int      from  = Convert.ToInt32(ddlDayFrom.SelectedValue);
        int      to    = Convert.ToInt32(ddlDayTo.SelectedValue);
        DateTime?start = null;
        DateTime?end   = null;

        if (year != 0 && month != 0 && from != 0)
        {
            start = new DateTime(year, month, from); end = (to != 0 ? new DateTime(year, month, to) : end = new DateTime(year, month, DateTime.DaysInMonth(year, month)));
        }
        else if (year != 0 && month != 0)
        {
            start = new DateTime(year, month, 1); end = new DateTime(year, month, DateTime.DaysInMonth(year, month));
        }
        else if (year != 0)
        {
            start = new DateTime(year, 1, 1); end = new DateTime(year, 12, 31);
        }
        List <OrderUI> orders = OrderController.GetOrderSupplierHistoryExcel(SuppliersSessionHelper.SupplierId(), start, end);

        foreach (OrderUI order in orders)
        {
            int i = 0;
            System.Data.DataRow row = dt.NewRow();
            row[i++] = order.OrderId;
            row[i++] = order.OrderDate;
            row[i++] = order.BidId;
            row[i++] = order.Price;
            row[i++] = GlobalStrings.GetYesNo(order.IsPayed);
            row[i++] = ListTostring(order.LstProduct);
            dt.Rows.Add(row);
        }

        SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, true, true);

        Response.Clear();
        Response.AddHeader(@"content-disposition", @"attachment;filename=Deals_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
        Response.Charset         = @"UTF-8";
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = ex.FileContentType;
        Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
        Response.Write(ex.ToString());
        Response.End();
    }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"Email"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"FirstName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"LastName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"IsLocked"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"Address"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"IsAdv"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"LastLogin"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"CreateDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"UserId"), typeof(string)));

            string   searchName = "%" + txtSearchName.Text.Trim() + "%";
            string   searchPhone = "%" + txtSearchPhone.Text.Trim() + "%";
            DateTime from, to = new DateTime();

            DateTime.TryParse(dpSearchCreateDateFrom.Value.ToString(), out from);
            DateTime.TryParse(dpSearchCreateDateTo.Value.ToString(), out to);

            List <AppUserUI> app_users = AppUserUI.GetAllAppUserUI(from, to, searchName, searchPhone);

            foreach (AppUserUI appUser in app_users)
            {
                System.Data.DataRow row = dt.NewRow();
                row[0] = appUser.Email;
                row[1] = appUser.FirstName;
                row[2] = appUser.LastName;
                row[3] = GlobalStrings.GetYesNo(appUser.IsLocked);
                row[4] = "\"" + appUser.Phone + "\"";
                row[5] = appUser.Street + " " + appUser.HouseNum + "\n"
                         + AppUsersStrings.GetText(@"Floor") + " " + appUser.Floor + "\n"
                         + AppUsersStrings.GetText(@"ApartmentNumber") + " " + appUser.ApartmentNumber + "\n"
                         + appUser.CityName;
                row[6] = GlobalStrings.GetYesNo(appUser.IsAdv);
                row[7] = "\"" + appUser.LastLogin + "\"";
                row[8] = "\"" + appUser.CreateDate + "\"";
                row[9] = "\"" + appUser.AppUserId + "\"";

                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=AppUsersExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #5
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        System.Data.DataTable dt = new System.Data.DataTable();

        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductName"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductCode"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"Amount"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"RecomendedPrice"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"Description"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"AnimalType"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductPrice"), typeof(string)));
        //dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"Category"), typeof(string)));
        //  dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"SubCategory"), typeof(string)));
        // dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductRate"), typeof(string)));

        string searchCode = "%" + txtSearch.Text.Trim() + "%";

        List <ProductUI> products = ProductController.GetAllProductUI(searchCode, Int64.Parse(ddlCategory.SelectedValue), Int64.Parse(ddlSubCategory.SelectedValue));

        foreach (ProductUI product in products)
        {
            int i = 0;
            System.Data.DataRow row = dt.NewRow();
            row[i++] = product.ProductName;
            row[i++] = product.ProductCode;
            row[i++] = product.Amount;
            row[i++] = product.RecomendedPrice;
            row[i++] = product.Description;
            row[i++] = ProductController.ConvertListToString(product.AnimalLst);
            SupplierProduct sup_prd = SupplierProduct.FetchByID(SuppliersSessionHelper.SupplierId(), product.ProductId);
            if (sup_prd != null)
            {
                row[i++] = sup_prd.Price;
            }


            //row[i++] = product.CategoryName;
            // row[i++] = product.SubCategoryName;
            // row[i++] = product.ProductRate;
            dt.Rows.Add(row);
        }

        SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

        Response.Clear();
        Response.AddHeader(@"content-disposition", @"attachment;filename=ProductsExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
        Response.Charset         = @"UTF-8";
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.Cache.SetCacheability(HttpCacheability.NoCache);

        Response.ContentType = ex.FileContentType;
        Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
        Response.Write(ex.ToString());
        Response.End();
    }
Example #6
0
        protected void btnExportForCRM_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"SupplierId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"BusinessName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"SupplierServices"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"Address"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"CityName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"ContactPhone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"ContactName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Email"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"SupplierType"), typeof(string)));

            List <SupplierUI> suppliers   = new List <SupplierUI>();
            string            searchName  = "%" + txtSearchName.Text.Trim() + "%";
            string            searchPhone = "%" + txtSearchPhone.Text.Trim() + "%";

            suppliers = SupplierController.GetAllSuppliersUI(true, searchName, searchPhone);

            foreach (SupplierUI supplier in suppliers)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = supplier.SupplierId;
                row[i++] = supplier.BusinessName;

                row[i++] = getSupplierServices(supplier);
                row[i++] = supplier.Street + " " + supplier.HouseNum;
                row[i++] = supplier.CityName;
                row[i++] = "=\"" + supplier.Phone + "\"";
                row[i++] = "=\"" + supplier.ContactPhone + "\"";
                row[i++] = supplier.ContactName;
                row[i++] = supplier.Email;
                row[i++] = supplier.IsProduct ? SuppliersStrings.GetText(@"IsProduct") : SuppliersStrings.GetText(@"IsService");
                dt.Rows.Add(row);
            }
            System.Data.DataRow sumRow = dt.NewRow();
            sumRow[0] = SuppliersStrings.GetText(@"SumSumPerMonth") + " " + suppliers.Sum(o => o.SumPerMonth);
            dt.Rows.Add(sumRow);
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=SuppliersExportForCRM_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #7
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        System.Data.DataTable dt = new System.Data.DataTable();

        dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"SupplierId"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"BusinessName"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Phone"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"ContactName"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"ContactPhone"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"CityName"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierEventStrings.GetText(@"ClickNum"), typeof(string)));
        dt.Columns.Add(new System.Data.DataColumn(SupplierEventStrings.GetText(@"ClickToCallNum"), typeof(string)));


        List <SupplierServiceUI> suppliers = new List <SupplierServiceUI>();
        string   searchName = txtSearchName.Text.Trim();
        string   searchPhone = txtSearchPhone.Text.Trim();
        string   searchId = txtSearchSupplierId.Text.Trim();
        string   searchCity = txtSearchCity.Text.Trim();
        DateTime from, to = new DateTime();

        DateTime.TryParse(datepickerFrom.Text.ToString(), out from);
        DateTime.TryParse(datepickerTo.Text.ToString(), out to);
        suppliers = ServiceController.GetServiceSuppliersAndNumEvents(searchName, searchPhone, searchId, searchCity, from, to, true);
        foreach (SupplierServiceUI supplier in suppliers)
        {
            System.Data.DataRow row = dt.NewRow();
            row[0] = supplier.SupplierId;
            row[1] = supplier.BusinessName;
            row[2] = "\"" + supplier.Phone + "\"";
            row[3] = supplier.ContactName;
            row[4] = "\"" + supplier.ContactPhone + "\"";
            row[5] = supplier.CityName;
            row[6] = supplier.ClickNum;
            row[7] = supplier.ClickToCallNum;
            dt.Rows.Add(row);
        }
        //System.Data.DataRow sumRow = dt.NewRow();
        //sumRow[0] = SuppliersStrings.GetText(@"SumSumPerMonth") + " " + suppliers.Sum(o => o.SumPerMonth);
        //dt.Rows.Add(sumRow);
        SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

        Response.Clear();
        Response.AddHeader(@"content-disposition", @"attachment;filename=ServiceSuppliersReport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
        Response.Charset         = @"UTF-8";
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = ex.FileContentType;
        Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
        Response.Write(ex.ToString());
        Response.End();
    }
Example #8
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"StartDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"EndDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"OffersCount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Products"), typeof(string)));
            if (bidType != BidType.BidCount || bidType != BidType.BidPurchase)
            {
                dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"OrderDate"), typeof(string)));
            }
            List <BidUI> coll;

            if (AllBids)
            {
                coll = BidController.GetAllBidByCustomerTypeAndBidType(customerType, bidType, BidLeave, 0, 0);
            }
            else
            {
                coll = BidController.GetAllBidByCustomerIdAndBidType(CustomerId, customerType, bidType, 0, 0);
            }
            foreach (BidUI Bid in coll)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = Bid.BidId;
                row[i++] = "\"" + Bid.StartDate + "\"";
                row[i++] = "\"" + Bid.EndDate + "\"";
                row[i++] = Bid.OfferNum;
                row[i++] = Bid.Products.Replace("<br>", ",");
                if (bidType != BidType.BidCount || bidType != BidType.BidPurchase)
                {
                    row[i++] = "\"" + Bid.OrderDate + "\"";
                }
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=MyBidsExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
        protected void ExportToExcel(int limit, int offset)
        {
            EmailLogCollection coll = EmailLogController.GetLogItems(EmailLog.Columns.DeliveryDate, dg.Sql.SortDirection.DESC, limit, offset);

            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("LogNumber"), typeof(Int64)));
            dt.Columns.Add(new System.Data.DataColumn(GlobalStrings.GetText("Date"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(GlobalStrings.GetText("Status"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("Subject"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("From"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("Recipient"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("CC"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("BCC"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("Priority"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("Content"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(EmailTemplatesStrings.GetText("Exception"), typeof(string)));

            foreach (EmailLog item in coll)
            {
                System.Data.DataRow row = dt.NewRow();
                row[0]  = item.EmailLogId;
                row[1]  = item.DeliveryDate.ToString(@"dd/MM/yyyy HH:mm:ss");
                row[2]  = GetStatus(item.Status);
                row[3]  = item.Subject;
                row[4]  = item.FromEmail + (string.IsNullOrEmpty(item.FromName) ? string.Empty : @" - " + item.FromName);
                row[5]  = item.ToList;
                row[6]  = item.CcList;
                row[7]  = item.BccList;
                row[8]  = GetMailPriority(item.MailPriority);
                row[9]  = item.Body.Replace(@"<br />", "\r\n").StripHtml();
                row[10] = item.Exception;
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, true, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=EmailLogsExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #10
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"ProductName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"LstCategory"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"Price"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"CityName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"ContactName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"Details"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(Yad2Strings.GetText(@"Status"), typeof(string)));


            List <int>           StatusIdList = FillStatusList();
            List <ProductYad2UI> productsYad2 = ProductYad2Controller.GetAllProductsYad2(StatusIdList);

            foreach (ProductYad2UI product in productsYad2)
            {
                System.Data.DataRow row = dt.NewRow();
                row[0] = product.ProductName;
                row[1] = (product.LstCategory.Count == 0 || product.LstCategory == null) ? "" : String.Join(", ", product.LstCategory.Select(p => p.CategoryYad2Name));
                row[2] = product.Price;
                row[3] = product.CityName;
                row[4] = product.ContactName;
                row[5] = "\"" + product.Phone + "\"";
                row[6] = product.Details;
                row[7] = Yad2Strings.GetText(Enum.GetName(typeof(StatusType), product.Status));
                dt.Rows.Add(row);
            }
            System.Data.DataRow sumRow = dt.NewRow();
            sumRow[0] = Yad2Strings.GetText(@"SumPrice") + " " + productsYad2.Sum(p => p.Price);
            dt.Rows.Add(sumRow);
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=ProductsYad2Export_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"StartDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"EndDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"TotalPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Products"), typeof(string)));
            if (Action == "Win" || Action == "Offers")
            {
                dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"OrderDate1"), typeof(string)));
            }


            List <BidUI> coll = BidController.GetSupplierBids(SupplierId, Action, FromDate, ToDate, BidId);

            foreach (BidUI bid in coll)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = bid.BidId;
                row[i++] = "\"" + bid.StartDate + "\"";
                row[i++] = "\"" + bid.EndDate + "\"";
                row[i++] = bid.Price;
                row[i++] = (bid.LstProduct.Count == 0 || bid.LstProduct == null) ? "" : String.Join(", ", bid.LstProduct.Select(o => o.ProductName));
                if (Action == "Win" || Action == "Offers")
                {
                    row[i++] = "\"" + bid.OrderDate + "\"";
                }
                dt.Rows.Add(row);
            }
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=Supplier" + SupplierId + Action + "BidsExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(CategoriesStrings.GetText(@"CategoryId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(CategoriesStrings.GetText(@"CategoryName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(CategoriesStrings.GetText(@"CategoryRate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(CategoriesStrings.GetText(@"SubCategoryId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(CategoriesStrings.GetText(@"SubCategoryName"), typeof(string)));
            List <CategoryUI> categories = ProductController.GetAllCategoriesAndSubCategories();

            foreach (CategoryUI category in categories)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = category.CategoryId;
                row[i++] = category.CategoryName;
                row[i++] = category.CategoryRate;
                row[i++] = category.SubCategoryId;
                row[i++] = category.SubCategoryName;
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex     = SpreadsheetWriter.FromDataTable(dt, true, true);
            ExcelSheetStyle   _style = new ExcelSheetStyle();

            _style.Alignment.Horizontal = HorizontalAlignment.Center;
            ex.AddStyle(_style);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=CategoriesExport_" + DateTime.Now.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductCode"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"Amount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"ProductPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(ProductsStrings.GetText(@"Gift"), typeof(string)));


            List <ProductUI> products = ProductController.GetSupplierProducts(SupplierId);

            foreach (ProductUI product in products)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = product.ProductName;
                row[i++] = product.ProductCode;
                row[i++] = product.Amount;
                row[i++] = product.ProductPrice;
                row[i++] = product.Gift;
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, true, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=SupplierProductsExport_" + DateTime.Now.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #14
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"BusinessName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Email"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"ContactName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"ContactPhone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"CityName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Street"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"HouseNum"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Precent"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"SumPerMonth"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"CreateDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"citiesSupplied"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"citiesHomeService"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"MaxWinningsNum"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"AvgRate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"SupplierType"), typeof(string)));

            List <SupplierUI> suppliers   = new List <SupplierUI>();
            string            searchName  = "%" + txtSearchName.Text.Trim() + "%";
            string            searchPhone = "%" + txtSearchPhone.Text.Trim() + "%";

            suppliers = SupplierController.GetAllSuppliersUI(true, searchName, searchPhone);
            foreach (SupplierUI supplier in suppliers)
            {
                System.Data.DataRow row = dt.NewRow();
                row[0]  = supplier.BusinessName;
                row[1]  = supplier.Email;
                row[2]  = "\"" + supplier.Phone + "\"";
                row[3]  = supplier.ContactName;
                row[4]  = "\"" + supplier.ContactPhone + "\"";
                row[5]  = supplier.CityName;
                row[6]  = supplier.Street;
                row[7]  = supplier.HouseNum;
                row[8]  = supplier.Precent;
                row[9]  = supplier.SumPerMonth;
                row[10] = "\"" + supplier.CreateDate + "\"";
                row[11] = (supplier.citiesSupplied.Count == 0 || supplier.citiesSupplied == null) ? "" : String.Join(", ", supplier.citiesSupplied.Select(o => o.CityName));
                row[12] = (supplier.citiesHomeService.Count == 0 || supplier.citiesHomeService == null) ? "" : String.Join(", ", supplier.citiesHomeService.Select(o => o.CityName));
                row[13] = supplier.MaxWinningsNum;
                row[14] = supplier.AvgRate;
                row[15] = supplier.IsProduct ? SuppliersStrings.GetText(@"IsProduct") : SuppliersStrings.GetText(@"IsService");
                dt.Rows.Add(row);
            }
            System.Data.DataRow sumRow = dt.NewRow();
            sumRow[0] = SuppliersStrings.GetText(@"SumSumPerMonth") + " " + suppliers.Sum(o => o.SumPerMonth);
            dt.Rows.Add(sumRow);
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=SuppliersExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #15
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"SupplierId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"SupplierName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"BidEndDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"DonationPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"TotalPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PrecentDiscount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PriceAfterDiscount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Precent"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PaymentForSupplier"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"IsSendReceived"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"OrderDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"TransactionStatus"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PaySupplierStatus"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"Remarks"), typeof(string)));

            DateTime from, to = new DateTime();

            if (DateTime.TryParse(datepickerFrom.Value.ToString(), out from))
            {
                TimeSpan tsFrom = new TimeSpan(TimeSelectorFrom.Hour, TimeSelectorFrom.Minute, 0);
                from = from.Date + tsFrom;
            }
            if (DateTime.TryParse(datepickerTo.Value.ToString(), out to))
            {
                TimeSpan tsTo = new TimeSpan(TimeSelectorTo.Hour, TimeSelectorTo.Minute, 0);
                to = to.Date + tsTo;
            }
            List <Int64>   SuppliersIdList      = FillSupplierList();
            List <bool>    IsReceivedSendDate   = FillIsSendReceived();
            List <int>     StatusIdList         = FillStatusList();
            List <int>     StatusPayementIdList = FillPayementStatusList();
            string         SearchBid            = "%" + txtSearchBid.Text.Trim() + "%";
            List <OrderUI> orders = OrderController.GetAllOrders(from, to, SuppliersIdList, IsReceivedSendDate, StatusIdList, StatusPayementIdList, SearchBid);

            foreach (OrderUI order in orders)
            {
                System.Data.DataRow row = dt.NewRow();
                row[0]  = order.SupplierId;
                row[1]  = order.SupplierName;
                row[2]  = order.BidId;
                row[3]  = "\"" + order.BidEndDate + "\"";
                row[4]  = order.DonationPrice;
                row[5]  = order.TotalPrice;
                row[6]  = order.PrecentDiscount + "%";
                row[7]  = order.PriceAfterDiscount;
                row[8]  = order.Precent + "%";
                row[9]  = order.PaymentForSupplier;
                row[10] = GlobalStrings.GetYesNo(order.IsSendReceived);
                row[11] = "\"" + order.OrderDate + "\"";
                row[12] = OrdersStrings.GetText(Enum.GetName(typeof(OrderStatus), order.TransactionStatus));
                row[13] = OrdersStrings.GetText(Enum.GetName(typeof(PaymentStatus), order.PaySupplierStatus));;
                row[14] = order.Remarks;
                dt.Rows.Add(row);
            }
            System.Data.DataRow sumRow = dt.NewRow();
            dt.Rows.Add(sumRow);

            System.Data.DataRow sumRowTotalPrice = dt.NewRow();
            sumRowTotalPrice[0] = OrdersStrings.GetText(@"SumTotalPrice") + " " + orders.Sum(o => o.TotalPrice);
            dt.Rows.Add(sumRowTotalPrice);

            System.Data.DataRow sumRowPriceAfterDiscount = dt.NewRow();
            sumRowPriceAfterDiscount[0] = OrdersStrings.GetText(@"SumPriceAfterDiscount") + " " + orders.Sum(o => o.PriceAfterDiscount);
            dt.Rows.Add(sumRowPriceAfterDiscount);

            System.Data.DataRow sumRowSumPaymentForSupplier = dt.NewRow();
            sumRowSumPaymentForSupplier[0] = OrdersStrings.GetText(@"SumPaymentForSupplier") + " " + orders.Sum(o => o.PaymentForSupplier);
            dt.Rows.Add(sumRowSumPaymentForSupplier);

            System.Data.DataRow sumRowSumDonation = dt.NewRow();
            sumRowSumDonation[0] = OrdersStrings.GetText(@"SumDonation") + " " + orders.Sum(o => o.DonationPrice);
            dt.Rows.Add(sumRowSumDonation);
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=OrdersExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #16
0
        protected void btnExportForCRM_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"ActionType"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"SupplierId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"SupplierName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(SuppliersStrings.GetText(@"Email"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"Products"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"TotalPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PaymentForSupplier"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"OrderDate"), typeof(string)));


            DateTime from, to = new DateTime();

            if (DateTime.TryParse(datepickerFrom.Value.ToString(), out from))
            {
                TimeSpan tsFrom = new TimeSpan(TimeSelectorFrom.Hour, TimeSelectorFrom.Minute, 0);
                from = from.Date + tsFrom;
            }
            if (DateTime.TryParse(datepickerTo.Value.ToString(), out to))
            {
                TimeSpan tsTo = new TimeSpan(TimeSelectorTo.Hour, TimeSelectorTo.Minute, 0);
                to = to.Date + tsTo;
            }
            List <Int64>   SuppliersIdList      = FillSupplierList();
            List <bool>    IsReceivedSendDate   = FillIsSendReceived();
            List <int>     StatusIdList         = FillStatusList();
            List <int>     StatusPayementIdList = FillPayementStatusList();
            string         SearchBid            = "%" + txtSearchBid.Text.Trim() + "%";
            List <OrderUI> orders = OrderController.GetAllOrders(from, to, SuppliersIdList, IsReceivedSendDate, StatusIdList, StatusPayementIdList, SearchBid);

            foreach (OrderUI order in orders)
            {
                var supplier            = SupplierController.GetSupplierUI(order.SupplierId);
                System.Data.DataRow row = dt.NewRow();
                row[0] = "רכישה";
                row[1] = order.SupplierId;
                row[2] = order.SupplierName;
                row[3] = supplier == null?"": "=\"" + supplier.Phone + "\"";
                row[4] = supplier == null ? "" : supplier.Email;
                row[5] = order.BidId;
                row[6] = GetStringProduct(BidController.GetProductsByBid(order.BidId));
                row[7] = order.TotalPrice;
                row[8] = order.PaymentForSupplier;
                row[9] = order.OrderDate;


                dt.Rows.Add(row);
            }
            System.Data.DataRow sumRow = dt.NewRow();
            dt.Rows.Add(sumRow);

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=OrdersExportFoCRM_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"BidEndDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"LstProducts"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"Gift"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"DonationPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"TotalPrice"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PrecentDiscount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"PriceAfterDiscount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"CampaignName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"IsSendReceived"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"OrderDate1"), typeof(string)));

            DateTime from, to = new DateTime();

            DateTime.TryParse(datepickerFrom.Value.ToString(), out from);
            DateTime.TryParse(datepickerTo.Value.ToString(), out to);
            string         SearchBid = "%" + txtSearchBid.Text.Trim() + "%";
            List <OrderUI> orders    = OrderController.GetAllAppUserOrders(AppUserId, from, to, SearchBid);

            foreach (OrderUI order in orders)
            {
                System.Data.DataRow row = dt.NewRow();
                row[0]  = order.BidId;
                row[1]  = "\"" + order.BidEndDate + "\"";
                row[2]  = (order.LstProduct.Count == 0 || order.LstProduct == null) ? "" : String.Join(", ", order.LstProduct.Select(p => p.Amount + " " + p.ProductName));
                row[3]  = order.Gift;
                row[4]  = order.DonationPrice;
                row[5]  = order.TotalPrice;
                row[6]  = order.PrecentDiscount + "%";
                row[7]  = order.PriceAfterDiscount;
                row[8]  = order.CampaignName;
                row[9]  = GlobalStrings.GetYesNo(order.IsSendReceived);
                row[10] = "\"" + order.OrderDate + "\"";
                dt.Rows.Add(row);
            }
            System.Data.DataRow sumRow = dt.NewRow();
            dt.Rows.Add(sumRow);

            System.Data.DataRow sumRowTotalPrice = dt.NewRow();
            sumRowTotalPrice[0] = OrdersStrings.GetText(@"SumTotalPrice") + " " + orders.Sum(o => o.TotalPrice);
            dt.Rows.Add(sumRowTotalPrice);

            System.Data.DataRow sumRowPriceAfterDiscount = dt.NewRow();
            sumRowPriceAfterDiscount[0] = OrdersStrings.GetText(@"SumPriceAfterDiscount") + " " + orders.Sum(o => o.PriceAfterDiscount);
            dt.Rows.Add(sumRowPriceAfterDiscount);


            System.Data.DataRow sumRowSumDonation = dt.NewRow();
            sumRowSumDonation[0] = OrdersStrings.GetText(@"SumDonation") + " " + orders.Sum(o => o.DonationPrice);
            dt.Rows.Add(sumRowSumDonation);
            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=AppUserOrdersExport_" + "AppUserId:" + AppUserId + "_Date:" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #18
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();

            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"StartDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"EndDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"CustomerId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"CustomerName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"CityName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"OffersCount"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"SupplierName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Price"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Products"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"OrderStatus"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"IsActive"), typeof(string)));


            DateTime from = new DateTime(), to = new DateTime();

            DateTime.TryParse(dpSearchCreateDateFrom.Value.ToString(), out from);
            DateTime.TryParse(dpSearchCreateDateTo.Value.ToString(), out to);
            Int64 _BidId = -1;

            if (txtBidNumber.Text != "")
            {
                Int64.TryParse(txtBidNumber.Text, out _BidId);
            }
            List <BidUI> app_users = BidController.GetAllBids(filterSearch, from, to, txtSearchPhone.Text, txtCustomerId.Text, _BidId, txtCityName.Text);

            foreach (BidUI Bid in app_users)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                row[i++] = Bid.BidId;
                row[i++] = "\"" + Bid.StartDate + "\"";
                row[i++] = "\"" + Bid.EndDate + "\"";
                row[i++] = Bid.CustomerId;
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp"):  Bid.CustomerName;
                row[i++] = Bid.Phone;
                row[i++] = Bid.City;
                row[i++] = Bid.OfferNum;
                row[i++] = Bid.SupplierName;
                row[i++] = Bid.Price;
                row[i++] = Bid.Products;
                row[i++] = Bid.OrderStatus == OrderDeliveryStatus.None?"": BidString.GetText(Bid.OrderStatus.ToString()).Replace("XXX", Bid.SuppliedDate.ToString());
                row[i++] = GlobalStrings.GetYesNo(Bid.IsActive);
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=BidsExport_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }
Example #19
0
        protected void btnExportForCRM_Click(object sender, EventArgs e)
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"CustomerId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"FirstName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"LastName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"Email"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Phone"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"Address"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"CityName"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(AppUsersStrings.GetText(@"CreateDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"BidId"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Products"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"Price"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(BidString.GetText(@"OrderDate"), typeof(string)));
            dt.Columns.Add(new System.Data.DataColumn(OrdersStrings.GetText(@"ActionType"), typeof(string)));



            DateTime from = new DateTime(), to = new DateTime();

            DateTime.TryParse(dpSearchCreateDateFrom.Value.ToString(), out from);
            DateTime.TryParse(dpSearchCreateDateTo.Value.ToString(), out to);
            Int64 _BidId = -1;

            if (txtBidNumber.Text != "")
            {
                Int64.TryParse(txtBidNumber.Text, out _BidId);
            }
            List <BidUI> app_users = BidController.GetAllBids(filterSearch, from, to, txtSearchPhone.Text, txtCustomerId.Text, _BidId, txtCityName.Text);

            foreach (BidUI Bid in app_users)
            {
                int i = 0;
                System.Data.DataRow row = dt.NewRow();
                var appUser             = AppUser.FetchByID(Bid.CustomerId);
                row[i++] = Bid.CustomerId;
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp") : appUser.FirstName;
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp") : appUser.LastName;
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp") : appUser.Email;
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp") : "=\"" + appUser.Phone + "\"";
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp") : appUser.Street + " " + appUser.HouseNum;
                row[i++] = Bid.City;
                row[i++] = Bid.CustomerType == CustomerType.Temp ? BidString.GetText("Temp") : appUser.CreateDate.ToString();
                row[i++] = Bid.BidId;
                row[i++] = Bid.Products;
                row[i++] = Bid.Price;
                row[i++] = Bid.OrderDate;
                row[i++] = "רכישה";
                dt.Rows.Add(row);
            }

            SpreadsheetWriter ex = SpreadsheetWriter.FromDataTable(dt, false, true);

            Response.Clear();
            Response.AddHeader(@"content-disposition", @"attachment;filename=BidsExportForCRM_" + DateTime.UtcNow.ToString(@"yyyy_MM_dd_HH_mm_ss") + "." + ex.FileExtension);
            Response.Charset         = @"UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = ex.FileContentType;
            Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());
            Response.Write(ex.ToString());
            Response.End();
        }