/// <summary>
        /// Get individual rows for editing in the checkpoint report.
        /// </summary>
        /// <param name="StarsId"></param>
        /// <returns>Checkpoint Report Model</returns>
        public CheckpointReportModel GetCheckpointInfoByStarsId(string StarsId)
        {
            CheckpointReportModel model = new CheckpointReportModel();

            using (LBCData context = new LBCData(ConnectionHelper.getConnectionString()))
            {
                var lst = from pr in context.LBC_PROFILE
                          join chc in context.LBC_CHECKPOINT_COMPLETED on pr.STARS_ID equals chc.STARS_ID
                          join ch in context.LBC_CHECKPOINT on chc.CHECKPOINT_ID equals ch.CHECKPOINT_ID
                          where pr.STARS_ID == StarsId
                          select new CheckpointReportModel
                {
                    STARS_ID        = pr.STARS_ID,
                    PA_CODE         = pr.PA_CODE,
                    FIRST_NAME      = pr.FIRST_NAME,
                    LAST_NAME       = pr.LAST_NAME,
                    DLR_NAME        = pr.DLR_NAME,
                    DLR_ADDRESS     = pr.DLR_ADDRESS,
                    DLR_CITY        = pr.DLR_CITY,
                    DLR_STATE       = pr.DLR_STATE,
                    DLR_ZIP         = pr.DLR_ZIP,
                    DLR_PHONE       = pr.DLR_PHONE,
                    CHECKPOINT_ID   = chc.CHECKPOINT_ID,
                    TOOL_ORDERED    = chc.TOOL_ORDERED,
                    EMAIL_ID        = chc.EMAIL_ID,
                    SHIPPING_STATUS = chc.SHIPPING_STATUS,
                    CREATED_DATE    = chc.CREATED_DATE
                };

                model = lst.SingleOrDefault();
            }
            return(model);
        }
        /// <summary>
        /// Updates the shipping status in the checkpointCompleted entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateCheckpointStatus(CheckpointReportModel model)
        {
            bool save = true;

            try
            {
                using (LBCData context = new LBCData(ConnectionHelper.getConnectionString()))
                {
                    var _chk = (from lcc in context.LBC_CHECKPOINT_COMPLETED
                                where lcc.STARS_ID == model.STARS_ID && lcc.CHECKPOINT_ID == model.CHECKPOINT_ID
                                select lcc).FirstOrDefault();

                    _chk.SHIPPING_STATUS = model.SHIPPING_STATUS;
                    _chk.UPDATED_DATE    = DateTime.Now;
                    _chk.UPDATED_BY      = System.Web.HttpContext.Current.Session["w_user"].ToString();

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
                // save = false;
            }
            return(save);
        }
예제 #3
0
        public static void SendCheckpointEmailAdmin(CheckpointReportModel model)
        {
            try
            {
                MailMessage mail = new MailMessage();
                mail.IsBodyHtml = true;
                mail.To.Add(new MailAddress(ConfigurationManager.AppSettings["EmailCancelTo"].ToString()));
                mail.From    = new MailAddress("*****@*****.**", "Lincoln Brand Champion");
                mail.Subject = "Checkpoint One Order Submission";
                //string Body = File.ReadAllText(System.Web.Hosting.HostingEnvironment.MapPath("~/data/lbc-emails/confirmation-email/LBC_Confirm.html"));

                //using (System.IO.StreamReader myFile = new System.IO.StreamReader("~/data/lbc-emails/confirmation-email/LBC_Confirm.html"))
                //{
                //    myString = myFile.ReadToEnd();
                //}
                string htmlbody = "<body><p>The Following person has placed a toolkit order. <p>" +
                                  "<b>First Last Name: " + model.FIRST_NAME + " " + model.LAST_NAME + "</b><br>" +
                                  "<b>Dealership Name: " + model.DLR_NAME + "</b><br>" +
                                  "<b>Dealership Address: " + model.DLR_ADDRESS + "</b><br>" +
                                  "<b>Dealership Address: " + model.DLR_CITY + " " + model.DLR_STATE + " " + model.DLR_ZIP + "</b><br>" +
                                  //"<b>Email Address: " + model.EMAIL_ID + "</b><br>" +
                                  "<b>Dealership Phone: " + model.DLR_PHONE + "</b><br>" +
                                  "<b>Order Time: " + model.CREATED_DATE + "</b><br>" +
                                  "<b>Checkpoint: " + model.CHECKPOINT_ID + "</b><br>" +
                                  "</body>";
                //htmlbody = htmlbody.Replace("%emailUrl%", emailUrl);
                mail.Body = htmlbody;
                SendMail(mail);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public ActionResult Presentation(FormCollection frm)
        {
            if (Session["StarsIdProfile"] != null)
            {
                CheckpointBL    _chkBL     = new CheckpointBL();
                CheckpointModel chkpPModel = new CheckpointModel();
                chkpPModel = _chkBL.GetActiveCheckpoint();

                CheckpointCompletedModel chkModel = new CheckpointCompletedModel();
                chkModel.STARS_ID      = frm["STARS_ID"];
                chkModel.PA_CODE       = frm["PA_CODE"];
                chkModel.CHECKPOINT_ID = chkpPModel.CHECKPOINT_ID;//Convert.ToDecimal(frm["CHECKPOINT_ID"]);
                chkModel.TOOL_ORDERED  = frm["TOOL_ORDERED"];
                chkModel.EMAIL_ID      = frm["EMAIL_ID"];
                chkModel.CREATED_BY    = Session["w_user"].ToString().ToUpper();
                chkModel.CREATED_DATE  = DateTime.Now;

                if (!(_chkBL.CheckCheckpointCompleted(chkModel.PA_CODE, chkModel.CHECKPOINT_ID)))
                {
                    _chkBL.SaveCheckpointOrder(chkModel);
                    EmailHelper.SendCheckpointEmail(chkModel.EMAIL_ID, chkModel.TOOL_ORDERED);
                    CheckpointReportBL    _chkrBL   = new CheckpointReportBL();
                    CheckpointReportModel chkrmodel = new CheckpointReportModel();
                    chkrmodel = _chkrBL.GetCheckpointInfoByStarsId(chkModel.STARS_ID);
                    //removed this as part of request: 20262 - 0024482 Dashboard Updates - 4.7.15
                    //EmailHelper.SendCheckpointEmailAdmin(chkrmodel);

                    return(Json(new
                    {
                        redirectUrl = Url.Action("Completed", "Toolkit"),
                        isRedirect = true
                    }));
                }
                return(Json(new
                {
                    redirectUrl = Url.Action("Completed", "Toolkit"),
                    isRedirect = true
                }));
            }
            return(RedirectToAction("Welcome", "LBC"));
        }
예제 #5
0
        public bool UpdateCheckpointStatus(CheckpointReportModel model)
        {
            CheckpointRepository _chk = new CheckpointRepository();

            return(_chk.UpdateCheckpointStatus(model));
        }