Esempio n. 1
0
        public static string GetRow(string RowId)
        {
            if (HttpContext.Current.Session["UserName"] == null)
            {
                return("Error: You are not logged-in.");
            }

            DBClass db = new DBClass("SCM");

            db.Con.Open();
            db.Com.CommandText = "SELECT [id] as [AccountCode], [Description], [subheadid] as [BankName],[subheadid] as [BranchName],[AccountType],[currency] as [Currency],[BankGlCode] as [GLCode],[AccountNo],[SwiftCode],[iban] as IBAN FROM [setupBankAccount] WHERE [id] = '" + RowId + "'";
            SqlDataReader        dr          = db.Com.ExecuteReader();
            JavaScriptSerializer serailizer  = new JavaScriptSerializer();
            BankAccounts         BankAccount = new BankAccounts();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    BankAccount.AccountCode = dr[0].ToString();
                    BankAccount.Description = dr[1].ToString();
                    BankAccount.SubHeadId   = dr[2].ToString();
                    BankAccount.SubHeadId   = dr[3].ToString();
                    BankAccount.AccountType = dr[4].ToString();
                    BankAccount.Currency    = dr[5].ToString();
                    BankAccount.GLCode      = dr[6].ToString();
                    BankAccount.AccountNo   = dr[7].ToString();
                    BankAccount.SwiftCode   = dr[8].ToString();
                    BankAccount.IBAN        = dr[9].ToString();
                }
            }

            if (dr.IsClosed == false)
            {
                dr.Close();
            }

            db.Con.Close();
            db = null;
            return(serailizer.Serialize(BankAccount));
        }
        public static string GetRow(string RowId)
        {
            if (HttpContext.Current.Session["UserName"] == null)
            {
                return "Error: You are not logged-in.";
            }

            DBClass db = new DBClass("SCM");
            db.Con.Open();
            db.Com.CommandText = "SELECT [id] as [AccountCode], [Description], [subheadid] as [BankName],[subheadid] as [BranchName],[AccountType],[currency] as [Currency],[BankGlCode] as [GLCode],[AccountNo],[SwiftCode],[iban] as IBAN FROM [setupBankAccount] WHERE [id] = '" + RowId + "'";
            SqlDataReader dr = db.Com.ExecuteReader();
            JavaScriptSerializer serailizer = new JavaScriptSerializer();
            BankAccounts BankAccount = new BankAccounts();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    BankAccount.AccountCode = dr[0].ToString();
                    BankAccount.Description = dr[1].ToString();
                    BankAccount.SubHeadId = dr[2].ToString();
                    BankAccount.SubHeadId = dr[3].ToString();
                    BankAccount.AccountType = dr[4].ToString();
                    BankAccount.Currency = dr[5].ToString();
                    BankAccount.GLCode = dr[6].ToString();
                    BankAccount.AccountNo = dr[7].ToString();
                    BankAccount.SwiftCode = dr[8].ToString();
                    BankAccount.IBAN = dr[9].ToString();
                }
            }

            if (dr.IsClosed == false)
                dr.Close();

            db.Con.Close();
            db = null;
            return serailizer.Serialize(BankAccount);
        }