Exemplo n.º 1
0
        public void DownloadPrimarySalesExcelTemplate(string ddlValue)
        {
            try
            {
                string Monthname  = ddlValue.Substring(0, ddlValue.IndexOf("-"));
                int    Month      = DateTime.ParseExact(Monthname, "MMM", new CultureInfo("en-US")).Month;
                string Yearnumber = ddlValue.Substring(ddlValue.IndexOf("-") + 1);
                int    Year       = Int32.Parse(Yearnumber);
                Ds = new DataSet();
                DataTable dtHelpContent = new DataTable();
                DataRow   drLines;
                dtHelpContent.Columns.Add("Instructions");
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "1.Please Download the primary sales Master Data";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "2. Please Download the primary sales excel Template for upload";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "3.Do not enter above 500 characters in Excel sheet columns on upload template";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "4.Do not alter the excel file structure(i.e.adding or removing the column)";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "5.Do not rename the columns";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "6.Click the “Choose/Browse file” button to get the file";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "7.Click the upload button to upload the data";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "8.Please do not modify the Row_No column values";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "9.Please Enter document_Date in YYYY-MM-DD format";
                dtHelpContent.Rows.Add(drLines);
                drLines = dtHelpContent.NewRow();
                drLines["Instructions"] = "10.Please do not use WRAPTEXT/ALT+ENTER while enter the values. If you use then system will consider this as a special character.";
                dtHelpContent.Rows.Add(drLines);

                Ds = Bl.GetPrimarySalesMasterData("TEMP", Month, Year);
                Ds.Tables.Add(dtHelpContent);
                Ds.Tables[0].TableName = "Primary sales Header";
                //   Ds.Tables[1].TableName = "Primary sales Details";
                Ds.Tables[1].TableName = "Help";
                HttpResponse  response = System.Web.HttpContext.Current.Response;
                DownloadExcel excel    = new DownloadExcel();
                excel.Convert(Ds, "Primary_sales_upload_template" + "_" + DateTime.Now.ToShortDateString(), response);
            }
            finally
            {
                Ds.Dispose();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Excel Download Active Products from Product Master
        /// </summary>
        public void GetActiveProducts()
        {
            DataControl.BLRegion objBlRegion = new BLRegion();
            string  companyCode = _objCurrentInfo.GetCompanyCode();
            DataSet Ds          = new DataSet();

            Ds = objBlRegion.GetActiveProducts(companyCode);
            Ds.Tables[0].TableName = "Product Details";
            HttpResponse  response = System.Web.HttpContext.Current.Response;
            DownloadExcel excel    = new DownloadExcel();

            excel.Convert(Ds, "Product_Master_Data" + "_" + DateTime.Now.ToShortDateString(), response);
        }
Exemplo n.º 3
0
        public void DownloadSubList()
        {
            DataControl.BLUser      objUser    = new BLUser();
            DataControl.CurrentInfo objCurInfo = new CurrentInfo();
            string  companyCode = objCurInfo.GetCompanyCode();
            DataSet Ds          = new DataSet();

            Ds = objUser.DownloadSubList(companyCode);
            Ds.Tables[0].TableName = "State Details";
            Ds.Tables[1].TableName = "City Details";
            Ds.Tables.RemoveAt(3);
            Ds.Tables.RemoveAt(2);
            HttpResponse  response = System.Web.HttpContext.Current.Response;
            DownloadExcel excel    = new DownloadExcel();

            excel.Convert(Ds, "State_City" + "_" + DateTime.Now.ToShortDateString(), response);
        }
Exemplo n.º 4
0
        public void DownloadPrimarySalesMasterExcelTemplate(string ddlValue)
        {
            string Monthname  = ddlValue.Substring(0, ddlValue.IndexOf("-"));
            int    Month      = DateTime.ParseExact(Monthname, "MMM", new CultureInfo("en-US")).Month;
            string Yearnumber = ddlValue.Substring(ddlValue.IndexOf("-") + 1);
            int    Year       = Int32.Parse(Yearnumber);

            Ds = new DataSet();
            Ds = Bl.GetPrimarySalesMasterData("MASTER", Month, Year);
            Ds.Tables[0].TableName = "Region Details";
            Ds.Tables[1].TableName = "Customer Details";
            Ds.Tables[2].TableName = "Product Details";
            Ds.Tables[3].TableName = "Depot Details";
            Ds.Tables[4].TableName = "Document Type Details";
            HttpResponse  response = System.Web.HttpContext.Current.Response;
            DownloadExcel excel    = new DownloadExcel();

            excel.Convert(Ds, "Primary_Sales_Master_Data" + "_" + DateTime.Now.ToShortDateString(), response);
        }
Exemplo n.º 5
0
        public void DownloadMasterList()
        {
            DataControl.BLUser      objUser    = new BLUser();
            DataControl.CurrentInfo objCurInfo = new CurrentInfo();
            string  companyCode = objCurInfo.GetCompanyCode();
            DataSet Ds          = new DataSet();

            Ds = objUser.DownloadMasterList(companyCode);
            Ds.Tables[0].TableName = "Region Details";
            Ds.Tables[1].TableName = "Region Type Details";
            Ds.Tables[2].TableName = "Region Classification Details";
            Ds.Tables[3].TableName = "Expense Group Details";
            Ds.Tables[4].TableName = "Price Group Details";
            Ds.Tables[5].TableName = "State Details";
            Ds.Tables[6].TableName = "City Details";
            HttpResponse  response = System.Web.HttpContext.Current.Response;
            DownloadExcel excel    = new DownloadExcel();

            excel.Convert(Ds, "Master_List" + "_" + DateTime.Now.ToShortDateString(), response);
        }
Exemplo n.º 6
0
        public void DownloadExcel()
        {
            byte[] fileContents;
            ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

            using (var package = new ExcelPackage())

            {
                //////// --------Start  Excel Style Part --------
                var workSheet = package.Workbook.Worksheets.Add("Sheet1");
                int rowNumber = 9 + filteredPecMemberViewModelList.Count();

                #region TituleForDownloadExcel



                workSheet.Cells["A1:F1"].Merge = true;
                workSheet.Cells["A2:F2"].Merge = true;
                workSheet.Cells["A3:F3"].Merge = true;
                workSheet.Cells["A4:F4"].Merge = true;
                workSheet.Cells["A5:F5"].Merge = true;
                workSheet.Cells["A6:F6"].Merge = true;
                workSheet.Cells["A6:F6"].Merge = true;
                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Merge         = true;
                workSheet.Cells[$"A{rowNumber + 1}:C{rowNumber + 1}"].Merge = true;
                workSheet.Cells[$"E{rowNumber + 2}:F{rowNumber + 2}"].Merge = true;
                workSheet.Cells[$"E{rowNumber + 3}:F{rowNumber + 3}"].Merge = true;
                workSheet.Cells[1, 1].Value = "Լրացման կարգ. Աղյուսակի բոլոր վանդակներում տեղեկությունները լրացվում են GHEA Grapalat տառատեսակով, չափը` 10: Տվյալները լրացվում են ԿԸՀ համացանցային կայքից ներբեռնված ֆայլի կրկնօրինակի վրա:Աղյուսակում տողեր ավելացվում են աղյուսակի վերջին տողից առաջ` նշելով այդ տողի բոլոր վանդակները և ընտրելով Անվանացանկի(Menu) Ներմուծել(Insert) բաժնից Տողեր(Rows) կետը:(կուսակցության, կուսակցությունների դաշինքի անվանումը) դաշտում(կուսակցության, կուսակցությունների դաշինքի անվանումը) բառերի փոխարեն լրացվում է կուսակցության, կուսակցությունների դաշինքի անվանումը  Ընտրական տեղամասի N դաշտում լրացվում է ընտրական տեղամասի համարը, որտեղ m - ը համապատասխան ընտրատարածքի համարն է, իսկ n - ը՝ ընտրական տեղամասի հերթական համարը(միանիշ թվերը նշվում են միանիշ):Համայնք սյունակում լրացվում է համայնքի անվանումը(միայն ՏԻՄ ընտրության դեպքում) ՏԸՀ անդամի ազգանուն,անուն, հայրանուն սյունակում լրացվում է ՏԸՀ անդամի ազգանունը, անունը, հայրանունը Որակավորման վկայականի համար սյունակում լրացվում է որակավորման վկայականի համարը Հեռախոսահամար, կապի այլ միջոցներ սյունակում լրացվում է հեռախոսահամարը, կապի այլ միջոցները Ծանոթություն սյունակում լրացվում է ՏԸՀ անդամի պաշտոնը՝ նախագահ, քարտուղար կամ անդամ: ";
                workSheet.Cells[2, 1].Value = "ՀՀ ԿԵՆՏՐՈՆԱԿԱՆ ԸՆՏՐԱԿԱՆ ՀԱՆՁՆԱԺՈՂՈՎԻ ՆԱԽԱԳԱՀԻՆ";
                workSheet.Cells[3, 1].Value = "ՀԱՅՏ";
                //  workSheet.Cells[4, 1].Value = "(կուսակցության, կուսակցությունների դաշինքի անվանումը)";
                workSheet.Cells[4, 1].Value             = user.UName;
                workSheet.Cells[5, 1].Value             = "տեղամասային ընտրական հանձնաժողովների անդամների նշանակման";
                workSheet.Cells[6, 1].Value             = "ՀՀ ընտրական օրենսգրքի 44-րդ հոդվածին համապատասխան __________________________________ ընտրություններին տեղամասային ընտրական հանձնաժողովների անդամներ են նշանակվել.";
                workSheet.Cells[rowNumber, 1].Value     = "Հայտում նշված քաղաքացիներն ունեն տեղամասային ընտրական հանձնաժողովում ընդգրկվելու իրավունք, նրանց վրա չեն տարածվում ՀՀ ընտրական օրենսգրքի 39-րդ հոդվածով ընտրական հանձնաժողովի անդամ նշանակվելու համար նախատեսված սահմանափակումները:";
                workSheet.Cells[rowNumber + 1, 1].Value = "Կուսակցության ղեկավար (տեղակալ)Դաշինքի դեպքում` խմբակցության ղեկավար(տեղակալ)";
                workSheet.Cells[rowNumber + 1, 4].Value = "(ազգանուն, անուն)";
                workSheet.Cells[rowNumber + 1, 5].Value = "(ստորագրություն)";
                workSheet.Cells[rowNumber + 2, 5].Value = "«____» _____________     20     թ.";



                workSheet.Cells["A1:F1"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A1:F1"].Style.Font.Size           = 10;
                workSheet.Cells["A1:F1"].Style.WrapText            = true;
                workSheet.Cells["A1:F1"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A1:F1"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                workSheet.Cells["A2:F2"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A2:F2"].Style.Font.Size           = 10;
                workSheet.Cells["A2:F2"].Style.WrapText            = true;
                workSheet.Cells["A2:F2"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A2:F2"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;


                workSheet.Cells["A3:F3"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A3:F3"].Style.Font.Size           = 10;
                workSheet.Cells["A3:F3"].Style.WrapText            = true;
                workSheet.Cells["A3:F3"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A3:F3"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                workSheet.Cells["A4:F4"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A4:F4"].Style.Font.Size           = 10;
                workSheet.Cells["A4:F4"].Style.WrapText            = true;
                workSheet.Cells["A4:F4"].Style.Font.Bold           = true;
                workSheet.Cells["A4:F4"].Style.Font.Color.Indexed  = 4;
                workSheet.Cells["A4:F4"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A4:F4"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                workSheet.Cells["A5:F5"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A5:F5"].Style.Font.Size           = 10;
                workSheet.Cells["A5:F5"].Style.WrapText            = true;
                workSheet.Cells["A5:F5"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A5:F5"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                workSheet.Cells["A6:F6"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A6:F6"].Style.Font.Size           = 10;
                workSheet.Cells["A6:F6"].Style.WrapText            = true;
                workSheet.Cells["A6:F6"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A6:F6"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Style.Font.Size           = 9;
                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Style.WrapText            = true;
                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;
                workSheet.Cells[$"A{rowNumber}:F{rowNumber}"].Style.Font.Bold           = true;

                workSheet.Cells[$"A{rowNumber + 1}:F{rowNumber + 1}"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells[$"A{rowNumber + 1}:F{rowNumber + 1}"].Style.Font.Size           = 9;
                workSheet.Cells[$"A{rowNumber + 1}:F{rowNumber + 1}"].Style.WrapText            = true;
                workSheet.Cells[$"A{rowNumber + 1}:F{rowNumber + 1}"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells[$"A{rowNumber + 1}:F{rowNumber + 1}"].Style.VerticalAlignment   = ExcelVerticalAlignment.Bottom;
                workSheet.Cells[$"A{rowNumber + 1}:F{rowNumber + 1}"].Style.Font.Bold           = true;


                workSheet.Cells["A7:B7"].Merge = true;
                workSheet.Cells["C7:C8"].Merge = true;
                workSheet.Cells["D7:D8"].Merge = true;
                workSheet.Cells["E7:E8"].Merge = true;
                workSheet.Cells["F7:F8"].Merge = true;
                workSheet.Cells["G7:G8"].Merge = true;


                workSheet.Cells["A7:G7"].Style.WrapText  = true;
                workSheet.Cells["A7:G7"].Style.Font.Size = 8;
                workSheet.Cells["A7:G7"].Style.Font.Name = "GHEA Grapalat";
                workSheet.Cells["A7:G7"].Style.Font.Bold = true;
                //workSheet.Cells["C7:G7"].AutoFilter = true;
                //workSheet.Cells["C8:G8"].AutoFilter = true;
                workSheet.Cells["A7:G7"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A7:G7"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;


                workSheet.Cells["A8:B8"].Style.WrapText            = true;
                workSheet.Cells["A8:B8"].Style.Font.Size           = 8;
                workSheet.Cells["A8:B8"].Style.Font.Name           = "GHEA Grapalat";
                workSheet.Cells["A8:B8"].Style.Font.Bold           = true;
                workSheet.Cells["A7:G7"].AutoFilter                = true;
                workSheet.Cells["A8:B8"].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
                workSheet.Cells["A8:B8"].Style.VerticalAlignment   = ExcelVerticalAlignment.Center;

                //////// --------End  Excel Style Part --------

                workSheet.Cells[7, 1].Value = "Ընտրական տեղամաս N";
                workSheet.Cells[8, 1].Value = "m";
                workSheet.Cells[8, 2].Value = "n";
                workSheet.Cells[7, 3].Value = "Համայնք (նշվում է ՏԻՄ ընտրության դեպքում)";
                workSheet.Cells[7, 4].Value = "ՏԸՀ անդամի ազգանուն,անուն, հայրանուն";
                workSheet.Cells[7, 5].Value = "Որակավորման վկայականի համար";
                workSheet.Cells[7, 6].Value = "Հեռախոսահամար, կապի այլ միջոցներ";
                workSheet.Cells[7, 7].Value = "Ծանոթություն";


                workSheet.Row(1).Height             = 220;
                workSheet.Row(2).Height             = 20;
                workSheet.Row(3).Height             = 33;
                workSheet.Row(4).Height             = 27;
                workSheet.Row(5).Height             = 21;
                workSheet.Row(6).Height             = 52;
                workSheet.Row(7).Height             = 35;
                workSheet.Row(rowNumber).Height     = 45;
                workSheet.Row(rowNumber + 1).Height = 67;

                workSheet.Column(2).Width = 6;
                workSheet.Column(2).Width = 6;
                workSheet.Column(3).Width = 18;
                workSheet.Column(4).Width = 32;
                workSheet.Column(5).Width = 16;
                workSheet.Column(6).Width = 20;
                workSheet.Column(7).Width = 12;



                #endregion

                int i = 1;
                foreach (var item in filteredPecMemberViewModelList)
                {
                    workSheet.Cells[i + 8, 1].Value = item.DistrictView;
                    workSheet.Cells[i + 8, 2].Value = item.SubDistrictCodeView;
                    workSheet.Cells[i + 8, 3].Value = item.CommunityView;
                    workSheet.Cells[i + 8, 4].Value = item.FullName;
                    workSheet.Cells[i + 8, 5].Value = item.CerteficateView;
                    workSheet.Cells[i + 8, 6].Value = item.PhoneNumberView;
                    workSheet.Cells[i + 8, 7].Value = item.PositionView;

                    i++;
                }

                fileContents = package.GetAsByteArray();
            }

            DownloadExcel obj = new DownloadExcel();
            obj.GenerateExcel(jJSRuntime, fileContents);
        }