Exemple #1
0
        private int Executive(string execsum, long projId)
        {
            var exec = new ExecutiveSummary()
            {
                content     = execsum,
                created_at  = DateTime.Now,
                modified_at = DateTime.Now,
                proj_id     = (int)projId
            };

            _insendluEntities.ExecutiveSummaries.Add(exec);

            try
            {
                _insendluEntities.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                // Retrieve the error messages as a list of strings.
                var errorMessages = ex.EntityValidationErrors
                                    .SelectMany(x => x.ValidationErrors)
                                    .Select(x => x.ErrorMessage);

                // Join the list to a single string.
                var fullErrorMessage = string.Join("; ", errorMessages);

                // Combine the original exception message with the new one.
                var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                // Throw a new DbEntityValidationException with the improved exception message.
                throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
            }

            return((int)exec.id);
        }
Exemple #2
0
        public ActionResult Dashboard()
        {
            ViewBag.Votes     = VoteSummary.Get();
            ViewBag.ExecVotes = ExecutiveSummary.Get();
            ViewBag.Overall   = OverallSummary.Get();

            return(View());
        }
Exemple #3
0
        private void UpdateExecSummary(string execSumm, ExecutiveSummary execSummar, DateTime date)
        {
            execSummar.content     = execSumm;
            execSummar.modified_at = date;

            _insendluEntities.Entry(execSummar).State = System.Data.Entity.EntityState.Modified;
            _insendluEntities.SaveChanges();
        }
        private int Executive(string execsum, long projId)
        {
            var exec = new ExecutiveSummary
            {
                content     = execsum,
                created_at  = DateTime.Now,
                modified_at = DateTime.Now,
                proj_id     = (int)projId
            };

            _insendluEntities.ExecutiveSummaries.Add(exec);
            TryCatch();

            return((int)exec.id);
        }
        public ActionResult Index()
        {
            ExecutiveSummary dataDashboard = new ExecutiveSummary();

            try
            {
                var userDetails = (CustomerLoginDetail)Session["UserSession"];
                var lstOutlet   = RR.GetOutletList(userDetails.GroupId, userDetails.connectionString);
                dataDashboard       = DR.GetDashboardData(userDetails.GroupId, userDetails.connectionString, userDetails.LoginId);
                ViewBag.OutletList  = lstOutlet;
                ViewBag.OutletCount = lstOutlet.Count;
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, "");
            }
            return(View(dataDashboard));
        }
        public ExecutiveSummary GetDashboardData(string GroupId, string connstr, string LoginId)
        {
            ExecutiveSummary dataDashboard = new ExecutiveSummary();

            try
            {
                using (var context = new BOTSDBContext(connstr))
                {
                    //dataDashboard = context.Database.SqlQuery<ExecutiveSummary>("sp_Dashboard @pi_GroupId, @pi_Date", new SqlParameter("@pi_GroupId", GroupId), new SqlParameter("@pi_Date", DateTime.Now.ToShortDateString())).FirstOrDefault<ExecutiveSummary>();
                    dataDashboard = context.Database.SqlQuery <ExecutiveSummary>("sp_BOTS_LoyaltyPerfromance @pi_GroupId, @pi_Date,@pi_LoginId,@pi_Month,@pi_Year,@pi_OutletId", new SqlParameter("@pi_GroupId", GroupId), new SqlParameter("@pi_Date", DateTime.Now.ToShortDateString()), new SqlParameter("@pi_LoginId", LoginId), new SqlParameter("@pi_Month", ""), new SqlParameter("@pi_Year", ""), new SqlParameter("@pi_OutletId", "")).FirstOrDefault <ExecutiveSummary>();

                    dataDashboard.lstOutletDetails = context.Database.SqlQuery <OutletDetails>("sp_OutletDashboard @pi_GroupId, @pi_Date", new SqlParameter("@pi_GroupId", GroupId), new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd"))).ToList <OutletDetails>();
                }
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, GroupId);
            }
            return(dataDashboard);
        }