示例#1
0
        //Update Rank
        public static int UpdateRecord(etblRankManagement eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    bool checkExists = false;
                    checkExists = db.tblRankManagements.Any(
                        p => p.iPropId == eobj.iPropId &&
                        p.iID != eobj.iID &&
                        (((p.dtStartdate <= eobj.dtStartdate && p.dtEndDate >= eobj.dtStartdate) || (p.dtStartdate <= eobj.dtEndDate && p.dtEndDate >= eobj.dtEndDate)) ||
                         ((eobj.dtStartdate <= p.dtStartdate && eobj.dtEndDate >= p.dtStartdate) || (eobj.dtStartdate <= p.dtEndDate && eobj.dtEndDate >= p.dtEndDate)))
                        );
                    if (checkExists != true)
                    {
                        OneFineRate.tblRankManagement obj = (OneFineRate.tblRankManagement)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblRankManagement());
                        db.tblRankManagements.Attach(obj);
                        db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        retval = 1;
                    }
                    else
                    {
                        retval = 2;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
示例#2
0
        //Delete Rank
        public static int DeleteRecord(etblRankManagement eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblRankManagement obj = (OneFineRate.tblRankManagement)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblRankManagement());
                    db.tblRankManagements.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }