コード例 #1
0
        public string UpdateTax(int id, string name)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eTax obj = new eTax();
                obj = BL_Tax.GetSingleRecordById(id);
                obj.dtActionDate = DateTime.Now;
                obj.sTaxName     = name;
                obj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_Tax.UpdateRecord(obj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Tax", 2) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Tax", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Tax", 3) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
コード例 #2
0
        public string AddTax(string name)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eTax eObj = new eTax();
                eObj.sTaxName     = name;
                eObj.dtActionDate = DateTime.Now;
                eObj.cStatus      = "A";
                eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;
                int i = BL_Tax.AddRecord(eObj);
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("Tax", 1) };
                }
                else if (i == 2)
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Tax", 0) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("Tax", 3) };
                }
            }
            catch (Exception)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }
コード例 #3
0
        //Add new record
        public static int AddRecord(eTax eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    int dbobj = (from s in db.tblTaxMs.Where(u => u.sTaxName == eobj.sTaxName.Trim())
                                 select new
                    {
                        s.iTaxId,
                    }).Count();
                    if (dbobj > 0)
                    {
                        return(retval = 2);
                    }

                    OneFineRate.tblTaxM dbuser = (OneFineRate.tblTaxM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblTaxM());
                    db.tblTaxMs.Add(dbuser);
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
コード例 #4
0
        //Update a record
        public static int UpdateRecord(eTax eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    int dbobj = (from s in db.tblTaxMs.Where(u => u.sTaxName == eobj.sTaxName.Trim() && u.iTaxId != eobj.iTaxId)
                                 select new
                    {
                        s.iTaxId,
                    }).Count();
                    if (dbobj > 0)
                    {
                        return(retval = 2);
                    }

                    OneFineRate.tblTaxM obj = (OneFineRate.tblTaxM)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblTaxM());
                    db.tblTaxMs.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
コード例 #5
0
        //Get Single Record
        public static eTax GetSingleRecordById(int id)
        {
            eTax eobj = new eTax();

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                var dbobj = db.tblTaxMs.SingleOrDefault(u => u.iTaxId == id);
                if (dbobj != null)
                {
                    eobj = (eTax)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj);
                }
            }
            return(eobj);
        }