Esempio n. 1
0
        private List<flexnotchks> FnFetchData()
        {
            try
            {
                var myList = new List<flexnotchks>();
                var con = new SqlConnection(constring);
                const string query = "SELECT CONTRACT_REF_NO, BOOK_DATE, CUSTOM_REF_NO, DR_CCY, DR_AMOUNT, DR_ACCOUNT, BEN_AC_NO, PAYMENT_DETAILS," +
                                     " BY_ORDER_OF, ULT_BENEFICIARY, ACC_WITH_INSTN FROM VW_IN_FLEX_NOT_CHKPT_UPDATED";
                DataTable dt = new DataTable();
                con.Open();
                var da = new SqlDataAdapter(query, con);
                da.Fill(dt);
                con.Close();
                if (dt.Rows.Count > 0)
                {

                    foreach (DataRow n in dt.Rows)
                    {
                        var singleItem = new flexnotchks
                        {
                            CONTRACT_REF_NO = n[0].ToString(),
                            BOOK_DATE = n[1].ToString(),
                            CUSTOM_REF_NO = n[2].ToString(),
                            DR_CCY = n[3].ToString(),
                            DR_AMOUNT = n[4].ToString(),
                            DR_ACCOUNT = n[5].ToString(),
                            BEN_AC_NO = n[6].ToString(),
                            PAYMENT_DETAILS = n[7].ToString(),
                            BY_ORDER_OF = n[8].ToString(),
                            ULT_BENEFICIARY = n[9].ToString(),
                            ACC_WITH_INSTN = n[10].ToString()};
                        myList.Add(singleItem);
                    }
                }
                return myList;
            }
            catch (Exception ex)
            {
                _logs.LogError(User.Identity.GetUserName(), "flexnotchksFnFetchData", "Error: " + ex.Message,
             Request.ServerVariables["REMOTE_ADDR"], HttpContext.Server.MapPath("."), "EFTRecon");
                System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/errorLOG.txt"), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                System.IO.StreamWriter s = new System.IO.StreamWriter(fs);
                s.BaseStream.Seek(0, System.IO.SeekOrigin.End);
                s.WriteLine("ERROR DATE: " + System.DateTime.Now.ToString(System.Globalization.CultureInfo.InvariantCulture) + " \nERROR MESSAGE: " + ex.Message + "\nSOURCE: " + ex.Source + "\nFORM NAME: " + System.Web.HttpContext.Current.Request.Url.ToString() + "\nQUERYSTRING: " + Request.QueryString.ToString() + "\nTARGETSITE: " + ex.TargetSite.ToString() + "\nSTACKTRACE: " + ex.StackTrace + System.Diagnostics.EventLogEntryType.Error);
                s.WriteLine("-------------------------------------------------------------------------------------------------------------");
                s.Close();
                return new List<flexnotchks>();
            }
        }
        private List<flexnotchks> FnFetchData()
        {
            try
            {
                var myList = new List<flexnotchks>();
                var con = new SqlConnection(constring);
                const string query = "SELECT COUNT(CONTRACT_REF_NO) AS NoOfItems, DR_CCY, SUM(CONVERT (MONEY, DR_AMOUNT)) AS AMOUNT FROM VW_IN_FLEX_NOT_CHKPT_UPDATED GROUP BY DR_CCY";
                DataTable dt = new DataTable();
                con.Open();
                var da = new SqlDataAdapter(query, con);
                da.Fill(dt);
                con.Close();
                if (dt.Rows.Count > 0)
                {

                    foreach (DataRow n in dt.Rows)
                    {
                        var singleItem = new flexnotchks
                        {
                            DR_CCY = n[0].ToString(),
                            DR_AMOUNT = n[2].ToString()

                        };
                        myList.Add(singleItem);
                    }
                }
                return myList;
            }
            catch (Exception ex)
            {
                _logs.LogError(User.Identity.GetUserName(), "TotalFlexNotChqFnFetchData", "Error: " + ex.Message,
             Request.ServerVariables["REMOTE_ADDR"], HttpContext.Server.MapPath("."), "EFTRecon");
                System.IO.FileStream fs = new System.IO.FileStream(Server.MapPath("~/errorLOG.txt"), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
                System.IO.StreamWriter s = new System.IO.StreamWriter(fs);
                s.BaseStream.Seek(0, System.IO.SeekOrigin.End);
                s.WriteLine("ERROR DATE: " + System.DateTime.Now.ToString(System.Globalization.CultureInfo.InvariantCulture) + " \nERROR MESSAGE: " + ex.Message + "\nSOURCE: " + ex.Source + "\nFORM NAME: " + System.Web.HttpContext.Current.Request.Url.ToString() + "\nQUERYSTRING: " + Request.QueryString.ToString() + "\nTARGETSITE: " + ex.TargetSite.ToString() + "\nSTACKTRACE: " + ex.StackTrace + System.Diagnostics.EventLogEntryType.Error);
                s.WriteLine("-------------------------------------------------------------------------------------------------------------");
                s.Close();
                return new List<flexnotchks>();
            }
        }