public AllowanceDeduction Add(AllowanceDeduction AD, string userid)
        {
            var sqlQuery = @"INSERT INTO ALLOWANCEDEDUCTION (IDALLOWANCEDEDUCTION, ALLOWANCEDEDUCTIONNAME, ALLOWANCEDEDUCTIONTYPE, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE) 
                            VALUES('" + AD.IDALLOWANCEDEDUCTION + "', '" + AD.ALLOWANCEDEDUCTIONNAME + "', '" + AD.ALLOWANCEDEDUCTIONTYPE + "', '" + userid + "', '" + DateTime.Now + "', '" + userid + "', '" + DateTime.Now + "'); " + "SELECT CAST(SCOPE_IDENTITY() as int)";
            var SID      = _db.Query <int>(sqlQuery, AD).Single();

            AD.SID = SID;
            return(AD);
        }
        public AllowanceDeduction Update(AllowanceDeduction AD, string userid)
        {
            var sqlQuery =
                "UPDATE ALLOWANCEDEDUCTION " +
                "SET IDALLOWANCEDEDUCTION    = '" + AD.IDALLOWANCEDEDUCTION + "', " +
                "    ALLOWANCEDEDUCTIONNAME  = '" + AD.ALLOWANCEDEDUCTIONNAME + "', " +
                "    ALLOWANCEDEDUCTIONTYPE  = '" + AD.ALLOWANCEDEDUCTIONTYPE + "', " +
                "    UPDATEBY      = '" + Convert.ToInt32(userid) + "', " +
                "    UPDATEDATE    = '" + DateTime.Now + "' " +
                "WHERE SID = " + AD.SID + "";

            this._db.Execute(sqlQuery, AD);
            return(AD);
        }
        public JsonResult Edit(AllowanceDeduction AllowanceDeduction, string userid)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    AD.Update(AllowanceDeduction, Session["userid"].ToString());
                }
            }
            catch
            {
                return(Json("error"));
            }

            return(Json("success"));
        }