Wednesday, 11 May 2016

CLSACCOUNTHEAD



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SNSCT
{
    class ClsAccountHead
    {
        public DataTable Get_AccountHead(int Type)
        {
            SqlDb Db = new SqlDb();
            return Db.getTable_("Select AccountHeadID, AccountHead,Amount,case IsCompulsory when 1 then 'YES' else 'NO' end[Mandatory] from Account_Head where Type=" + Type + "");
        }

        public void insert_AccountHead(string ACC_HEAD,decimal Amount,int Is_Compulsory, int Type)
        {

            SqlDb Db = new SqlDb();
            StringBuilder Str = new StringBuilder();
            Str.Append("Insert into Account_Head(AccountHead,Amount,IsCompulsory,Type) values");
            Str.Append("('" + ACC_HEAD + "'," + Amount + "," + Is_Compulsory + "," + Type + ")");
            Db.Execute_(Str.ToString());
        }
        public void Delete_AccountHead(int ID)
        {
            SqlDb Db = new SqlDb();
            StringBuilder Str = new StringBuilder();
            Str.Append("Delete from Account_Head where AccountHeadID = " + ID + "");
            Db.Execute_(Str.ToString());
        }

        public void Update_AccountHead(string Acc_Head, decimal Amount, int Is_Compulsory, int ID)
        {
            SqlDb Db = new SqlDb();
            StringBuilder Str = new StringBuilder();
            Str.Append("Update Account_Head set ");
            Str.Append("AccountHead='" + Acc_Head + "', ");
            Str.Append("Amount=" + Amount + ", ");
            Str.Append("IsCompulsory=" + Is_Compulsory + " ");
            Str.Append("where AccountHeadID=" + ID + "");
            Db.Execute_(Str.ToString());
        }



    }
}

No comments:

Post a Comment