示例#1
0
        public static int AddMultipleRecord(etblPropetyPhotoMap[] eobjs)
        {
            int statusCode = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    foreach (var item in eobjs)
                    {
                        item.iPhotoCatId    = null;
                        item.iPhotoSubCatId = null;
                        OneFineRate.tblPropertyPhotoMap dbPropertyImg = (OneFineRate.tblPropertyPhotoMap)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new OneFineRate.tblPropertyPhotoMap());
                        db.tblPropertyPhotoMaps.Add(dbPropertyImg);
                    }

                    statusCode = db.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(statusCode);
        }
示例#2
0
        public static int AddRecord(etblPropetyPhotoMap eobj)
        {
            int statusCode = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblPropertyPhotoMap dbuser = (OneFineRate.tblPropertyPhotoMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblPropertyPhotoMap());
                    db.tblPropertyPhotoMaps.Add(dbuser);
                    db.SaveChanges();
                    statusCode = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(statusCode);
        }
示例#3
0
        public static int UpdateRecord(etblPropetyPhotoMap eobj)
        {
            int retval = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    OneFineRate.tblPropertyPhotoMap obj = (OneFineRate.tblPropertyPhotoMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblPropertyPhotoMap());
                    db.tblPropertyPhotoMaps.Attach(obj);
                    db.Entry(obj).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    retval = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(retval);
        }
示例#4
0
        public static int UpdateMultipleRecord(etblPropetyPhotoMap[] eobjs)
        {
            int statusCode = 0;

            using (OneFineRateEntities db = new OneFineRateEntities())
            {
                try
                {
                    foreach (var item in eobjs)
                    {
                        OneFineRate.tblPropertyPhotoMap dbPropertyImg = (OneFineRate.tblPropertyPhotoMap)OneFineRateAppUtil.clsUtils.ConvertToObject(item, new OneFineRate.tblPropertyPhotoMap());
                        db.tblPropertyPhotoMaps.Attach(dbPropertyImg);
                        db.Entry(dbPropertyImg).State = System.Data.Entity.EntityState.Modified;
                    }
                    db.SaveChanges();
                    statusCode = 1;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(statusCode);
        }