Exemplo n.º 1
0
        public ActionResult DeleteReviewAccountSite(int?user, int accountID, int?reviewSiteID, string reviewURL, bool isActive)
        {
            try
            {
                string strMessage = "";
                bool   _success   = false;
                SMIM_ReviewAccountSite_ST Reviewact = new SMIM_ReviewAccountSite_ST();
                utility.IsSpecifed <SMIM_ReviewAccountSite_ST>(Reviewact);
                var respReview    = dbUser.GetAllReviewActSiteById(accountID);
                var respActsiteid = respReview.ReviewActsites.Where(x => x.ReviewSiteID == reviewSiteID).FirstOrDefault();
                Reviewact.AccountSiteID = respActsiteid.AccountSiteID;
                Reviewact.AccountID     = respActsiteid.AccountID;
                Reviewact.ReviewSiteID  = respActsiteid.ReviewSiteID;
                Reviewact.ReviewURL     = respActsiteid.ReviewURL;
                Reviewact.IsActive      = respActsiteid.IsActive;

                int maxValue = dbUser.DeleteReviewAct(Reviewact);
                if (maxValue > 0)
                {
                    strMessage = "Record successfully deleted.";
                    _success   = true;
                }
                else
                {
                    strMessage = "Application server error.";
                }
                return(Json(new { success = _success, response = strMessage }));
            }
            catch (Exception ex)
            {
                Log.LogWrite(ex.Message, "Review Account Sites Delete", ex);
                return(Json(new { success = false, response = ex.Message.ToString() }));
            }
        }
 public int InsertReviewAct(SMIM_ReviewAccountSite_ST InsReview)
 {
     try
     {
         dbUser.Timeout = System.Threading.Timeout.Infinite;
         int     _AccountSiteID = 0;
         bool    specified      = false;
         Utility util           = new Utility();
         util.IsSpecifed <SMIM_ReviewAccountSite_ST>(InsReview);
         dbUser.InsertReviewAct(InsReview, out _AccountSiteID, out specified); //out _Bankid,
         dbUser.Dispose();
         dbUser.Abort();
         return(_AccountSiteID);
     }
     catch (DbEntityValidationException ex)
     {
         dbUser.Dispose();
         dbUser.Abort();
         StringBuilder sb = new StringBuilder();
         foreach (var eve in ex.EntityValidationErrors)
         {
             sb.AppendLine(string.Format("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                         eve.Entry.Entity.GetType().Name,
                                         eve.Entry.State));
             foreach (var ve in eve.ValidationErrors)
             {
                 sb.AppendLine(string.Format("- Property: \"{0}\", Error: \"{1}\"",
                                             ve.PropertyName,
                                             ve.ErrorMessage));
             }
         }
         throw new DbEntityValidationException(sb.ToString(), ex);
     }
 }
        public ActionResult ReviewAccountSite(int?user, int accountID, int reviewSiteID, string reviewURL, bool?isActive)
        {
            try
            {
                string strMessage = ""; bool _success = false;
                //SMIM_ReviewAccountSite_ST Reviewact = new SMIM_ReviewAccountSite_ST();
                var Reviewact     = new SMIM_ReviewAccountSite_ST();
                var respReview    = dbUser.GetAllReviewActSiteById(accountID);
                var respActsiteid = respReview.ReviewActsites.Where(x => x.ReviewSiteID == reviewSiteID).FirstOrDefault(); // Select(x => x.AccountSiteID).FirstOrDefault();

                if (respActsiteid != null && respActsiteid.AccountSiteID > 0)
                {
                    utility.IsSpecifed <SMIM_ReviewAccountSite_ST>(Reviewact);
                    Reviewact.AccountSiteID = respActsiteid.AccountSiteID;     //Convert.ToInt32(respActsiteid);
                    Reviewact.AccountID     = accountID;
                    Reviewact.ReviewSiteID  = reviewSiteID;
                    Reviewact.ReviewURL     = reviewURL;
                    Reviewact.IsActive      = isActive;
                    int maxValue = dbUser.UpdateReviewAct(Reviewact);
                    if (maxValue > 0)
                    {
                        strMessage = "Record successfully updated.";
                        _success   = true;
                    }
                    else
                    {
                        strMessage = "Application server error.";
                    }
                }
                else
                {
                    utility.IsSpecifed <SMIM_ReviewAccountSite_ST>(Reviewact);
                    Reviewact.AccountID    = accountID;
                    Reviewact.ReviewSiteID = reviewSiteID;
                    Reviewact.ReviewURL    = reviewURL;
                    Reviewact.IsActive     = isActive;
                    int maxValue = dbUser.InsertReviewAct(Reviewact);
                    Reviewact.AccountSiteID = maxValue;
                    if (maxValue > 0)
                    {
                        strMessage = "Record successfully saved.";
                        _success   = true;
                    }
                    else
                    {
                        strMessage = "Application server error.";
                    }
                }

                //return Json(new { success = _success, response = strMessage });
                return(Json(new { success = _success, response = strMessage }));
            }
            catch (Exception ex)
            {
                Log.LogWrite(ex.Message, "Review Account Sites Insert/Edit", ex);
                return(Json(new { success = false, response = ex.Message.ToString() }));
            }
        }
Exemplo n.º 4
0
        public int DeleteReviewAct(SMIM_ReviewAccountSite_ST viewAct)
        {
            try
            {
                db.Configuration.ProxyCreationEnabled = false;
                db.Entry(viewAct).State = EntityState.Deleted;
                db.SaveChanges();

                return(Convert.ToInt32(viewAct.AccountSiteID));
            }
            catch (Exception ex)
            {
                throw ex;
                //return 0;
            }
        }
 public int DeleteReviewAct(SMIM_ReviewAccountSite_ST InsReview)
 {
     try
     {
         dbUser.Timeout = System.Threading.Timeout.Infinite;
         int  _AccountSiteID = 0;
         bool specified      = false;
         dbUser.DeleteReviewAct(InsReview, out _AccountSiteID, out specified);
         dbUser.Dispose();
         dbUser.Abort();
         return(Convert.ToInt32(InsReview.AccountSiteID));
     }
     catch (Exception ex)
     {
         dbUser.Dispose();
         dbUser.Abort();
         throw ex;
     }
 }
Exemplo n.º 6
0
        public int InsertReviewAct(SMIM_ReviewAccountSite_ST viewAct)
        {
            try
            {
                db.Configuration.ProxyCreationEnabled = false;
                int maxActSiteID = 0;
                if (db.SMIM_ReviewAccountSite_ST.Count() > 0)
                {
                    maxActSiteID = db.SMIM_ReviewAccountSite_ST.Select(x => x.AccountSiteID).Max();
                }
                maxActSiteID          = maxActSiteID + 1;
                viewAct.AccountSiteID = maxActSiteID;
                db.SMIM_ReviewAccountSite_ST.Add(viewAct);
                db.SaveChanges();

                return(viewAct.AccountSiteID);
            }
            catch (Exception ex)
            {
                throw ex;
                //return 0;
            }
        }