NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

using iTextSharp.text;
using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf;
using OfficeOpenXml;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

public partial class Pension_Fund_AllCustomer : System.Web.UI.Page
{


cls_User loggedUser;
cls_PublicFunctions pFunc;
string trxName = "LOAN";
string tmpTrxType = "1";
int limit = 0;

protected override void InitializeCulture()
{
string lang = string.Empty;

string LanguageID = Request.Cookies["iBankLanguage"] == null ? "MN" : Request.Cookies["iBankLanguage"].Value;

if (LanguageID == "MN")
lang = "mn-MN";
else
lang = "en-US";

if (lang != string.Empty && lang != null)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
}

base.InitializeCulture();
}
protected void Page_PreInit(object sender, EventArgs e)
{
if (Session["loggedUser"] != null && Session["publicFunctions"] != null)
{
loggedUser = (cls_User)Session["loggedUser"];
pFunc = (cls_PublicFunctions)Session["publicFunctions"];
pFunc.checkLinkRequest(loggedUser, Response, "8");
pFunc.SetMasterPage(loggedUser, this, Response);
}

}
protected void Button5_Click(object sender, EventArgs e)
{
if (TextBox2.Text.ToString() != "" && TextBox3.Text.ToString() != "" && DropDownList1.SelectedIndex!=-1)
{
limit = 0;
Hashtable param = new Hashtable();
param["CorpID"] = loggedUser.pCorporateID;
param["StartDate"] = TextBox2.Text.ToString();
param["EndDate"] = TextBox3.Text.ToString();
param["Limit"] = limit;
switch (DropDownList1.SelectedIndex) {
case 1: param["Status"] = "Y";
break;
case 2:
param["Status"] = "N";
break;
case 3:
param["Status"] = "L";
break;
case 4:
param["Status"] = "B";
break;
case 5:
param["Status"] = "O";
break;
case 6:
param["Status"] = "A";
break;
}


cls_XmlBuilder gateway = (cls_XmlBuilder)Session["gateway"];
XDocument res = gateway.CallFunction(loggedUser.pUserID, loggedUser.pLanguageID, "getCustomerInfo", param, Request, Response);
try
{
if (res.Element("IBankGateWay").Element("GWHeader").Element("Status").Value == "OK")
{
XElement resval = res.Element("IBankGateWay").Element("GWBody").Element("Response");
Session["soList"] = resval.ToString();
int ctr = res.Element("IBankGateWay").Element("GWBody").Element("Response").Elements("Statement").Count();
if (ctr > 0)
{
DataTable res_dt = pFunc.XMLToDataTable(resval.ToString());
res_dt.Columns.Add("rowNumber", typeof(int));
res_dt.Columns.Add("fullName", typeof(string));
int rowNumber = limit+1;

foreach(DataRow row in res_dt.Rows) {
row["rowNumber"] = rowNumber;
rowNumber++;

string lastname = row["cust_lastname"].ToString();
string firstname = row["cust_firstname"].ToString();
string fullName = lastname + " " + firstname;
row["fullName"] = fullName;
if (row["is_active_employee"].ToString() != "Y")
{
row["amount"] = "0";
}
}

GridView1.DataSource = res_dt;
GridView1.DataBind();
GridView1.Visible = true;
MultiView1.ActiveViewIndex = 0;
Label16.Visible = false;
Label16.Text = "";

}
else
{

}

}
}
catch (Exception ex)
{
//errorMsg.Text = ex.Message;
}
}
}
protected void Button3_Click(object sender, EventArgs e)
{
if (TextBox2.Text.ToString() != "" && TextBox3.Text.ToString() != "" && DropDownList1.SelectedIndex != -1)
{
Hashtable param = new Hashtable();
param["CorpID"] = loggedUser.pCorporateID;
param["StartDate"] = TextBox2.Text.ToString();
param["EndDate"] = TextBox3.Text.ToString();

switch (DropDownList1.SelectedIndex)
{
case 1:
param["Status"] = "Y";
break;
case 2:
param["Status"] = "N";
break;
case 3:
param["Status"] = "L";
break;
case 4:
param["Status"] = "B";
break;
case 5:
param["Status"] = "O";
break;
case 6:
param["Status"] = "A";
break;
}
param["Limit"] = limit-20;

cls_XmlBuilder gateway = (cls_XmlBuilder)Session["gateway"];
XDocument res = gateway.CallFunction(loggedUser.pUserID, loggedUser.pLanguageID, "getCustomerInfo", param, Request, Response);
try
{
if (res.Element("IBankGateWay").Element("GWHeader").Element("Status").Value == "OK")
{
XElement resval = res.Element("IBankGateWay").Element("GWBody").Element("Response");
Session["soList"] = resval.ToString();
int ctr = res.Element("IBankGateWay").Element("GWBody").Element("Response").Elements("Statement").Count();
if (ctr > 0)
{
DataTable res_dt = pFunc.XMLToDataTable(resval.ToString());
res_dt.Columns.Add("rowNumber", typeof(int));
int rowNumber = limit + 1;
res_dt.Columns.Add("fullName", typeof(string));
foreach (DataRow row in res_dt.Rows)
{
row["rowNumber"] = rowNumber;
rowNumber++;
string lastname = row["cust_lastname"].ToString();
string firstname = row["cust_firstname"].ToString();
string fullName = lastname + " " + firstname;
row["fullName"] = fullName;
if (row["is_active_employee"].ToString() != "Y")
{
row["amount"] = "0";
}
}
GridView1.DataSource = res_dt;
GridView1.DataBind();
GridView1.Visible = true;
MultiView1.ActiveViewIndex = 0;
Label16.Visible = false;
Label16.Text = "";

}
else
{

}

}
}
catch (Exception ex)
{
//errorMsg.Text = ex.Message;
}
}
}
protected void Button4_Click(object sender, EventArgs e)
{
limit = limit + 20;
if (TextBox2.Text.ToString() != "" && TextBox3.Text.ToString() != "" && DropDownList1.SelectedIndex != -1)
{
Hashtable param = new Hashtable();
param["CorpID"] = loggedUser.pCorporateID;
param["StartDate"] = TextBox2.Text.ToString();
param["EndDate"] = TextBox3.Text.ToString();

switch (DropDownList1.SelectedIndex)
{
case 1:
param["Status"] = "Y";
break;
case 2:
param["Status"] = "N";
break;
case 3:
param["Status"] = "L";
break;
case 4:
param["Status"] = "B";
break;
case 5:
param["Status"] = "O";
break;
case 6:
param["Status"] = "A";
break;
}
param["Limit"] = limit;

cls_XmlBuilder gateway = (cls_XmlBuilder)Session["gateway"];
XDocument res = gateway.CallFunction(loggedUser.pUserID, loggedUser.pLanguageID, "getCustomerInfo", param, Request, Response);
try
{
if (res.Element("IBankGateWay").Element("GWHeader").Element("Status").Value == "OK")
{
XElement resval = res.Element("IBankGateWay").Element("GWBody").Element("Response");
Session["soList"] = resval.ToString();
int ctr = res.Element("IBankGateWay").Element("GWBody").Element("Response").Elements("Statement").Count();
if (ctr > 0)
{
DataTable res_dt = pFunc.XMLToDataTable(resval.ToString());
res_dt.Columns.Add("rowNumber", typeof(int));
int rowNumber = limit + 1;
res_dt.Columns.Add("fullName", typeof(string));
foreach (DataRow row in res_dt.Rows)
{
row["rowNumber"] = rowNumber;
rowNumber++;
string lastname = row["cust_lastname"].ToString();
string firstname = row["cust_firstname"].ToString();
string fullName = lastname + " " + firstname;
row["fullName"] = fullName;
if (row["is_active_employee"].ToString() != "Y")
{
row["amount"] = "0";
}
}
GridView1.DataSource = res_dt;
GridView1.DataBind();
GridView1.Visible = true;
MultiView1.ActiveViewIndex = 0;
Label16.Visible = false;
Label16.Text = "";

}
else
{

}

}
}
catch (Exception ex)
{
//errorMsg.Text = ex.Message;
}
}
}


protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
TextBox2.Text = DateTime.Now.ToString("yyyy-MM-dd");
TextBox3.Text = DateTime.Now.ToString("yyyy-MM-dd");

}

}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string strmsg = pFunc.GetDictionary("Confirmation", loggedUser.pLanguageID);

LinkButton lnkButton = (LinkButton)e.Row.FindControl("LinkButton2");

if ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == DataControlRowState.Alternate))
{
lnkButton.OnClientClick = String.Format("return confirm('" + strmsg + "');", "");
}
}
}
protected void InsertExcel_Click(object sender, EventArgs e)
{
Response.Redirect("~/Pension_Fund/InsertExcel.aspx");
}
protected void OT_Click(object sender, EventArgs e)
{
Response.Redirect("~/Pension_Fund/OT.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{

if (TextBox2.Text.ToString() != "" && TextBox3.Text.ToString() != "" && DropDownList1.SelectedIndex != -1)
{
limit = 1;
Hashtable param = new Hashtable();
param["CorpID"] = loggedUser.pCorporateID;
param["StartDate"] = TextBox2.Text.ToString();
param["EndDate"] = TextBox3.Text.ToString();
param["Limit"] = limit;
switch (DropDownList1.SelectedIndex)
{
case 1:
param["Status"] = "Y";
break;
case 2:
param["Status"] = "N";
break;
case 3:
param["Status"] = "L";
break;
case 4:
param["Status"] = "B";
break;
case 5:
param["Status"] = "O";
break;
case 6:
param["Status"] = "A";
break;
}


cls_XmlBuilder gateway = (cls_XmlBuilder)Session["gateway"];
XDocument res = gateway.CallFunction(loggedUser.pUserID, loggedUser.pLanguageID, "getCustomerInfo", param, Request, Response);
try
{
if (res.Element("IBankGateWay").Element("GWHeader").Element("Status").Value == "OK")
{
XElement resval = res.Element("IBankGateWay").Element("GWBody").Element("Response");
Session["soList"] = resval.ToString();
int ctr = res.Element("IBankGateWay").Element("GWBody").Element("Response").Elements("Statement").Count();
if (ctr > 0)
{
DataTable res_dt = pFunc.XMLToDataTable(resval.ToString());
res_dt.Columns.Add("rowNumber", typeof(int));
res_dt.Columns.Add("fullName", typeof(string));
int rowNumber = 1;

foreach (DataRow row in res_dt.Rows)
{
row["rowNumber"] = rowNumber;
rowNumber++;

string lastname = row["cust_lastname"].ToString();
string firstname = row["cust_firstname"].ToString();
string fullName = lastname + " " + firstname;
row["fullName"] = fullName;
if (row["is_active_employee"].ToString() != "Y")
{
row["amount"] = "0";
}
}

GridView1.DataSource = res_dt;
GridView1.DataBind();
GridView1.Visible = false;

ExcelPackage.LicenseContext = LicenseContext.NonCommercial;

// Create a DataTable to hold your data (you can replace this with your actual data)
DataTable dataTable = new DataTable();

foreach (DataControlFieldHeaderCell headerCell in GridView1.HeaderRow.Cells)
{
dataTable.Columns.Add(headerCell.Text);
}

foreach (GridViewRow row in GridView1.Rows)
{
DataRow dataRow = dataTable.NewRow();
for (int i = 0; i < row.Cells.Count; i++)
{
dataRow[i] = row.Cells[i].Text;
}
dataTable.Rows.Add(dataRow);
}

// Export DataTable to Excel
if (dataTable != null && dataTable.Rows.Count > 0)
{
using(var package = new ExcelPackage())
{
var worksheet = package.Workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].LoadFromDataTable(dataTable, true);
worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns();

string customFileName = "exported_data_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";

byte[] fileBytes = package.GetAsByteArray();

Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + customFileName);

Response.BinaryWrite(fileBytes);
Response.Flush();
Context.ApplicationInstance.CompleteRequest();
Label16.Visible = true;
Label16.Text = customFileName + " нэртэй excel file татагдлаа Downloads хавтасаа шалгана уу!";
}
}
else
{
Label16.Visible = true;
Label16.Text = "Алдаа гарсан";
}

}
else
{

}

}
}
catch (Exception ex)
{
MultiView1.ActiveViewIndex = 0;
Label16.Visible = true;
Label16.Text = ex.Message;
}
}


}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.