Exemple #1
0
        public ActionResult Email_Display()
        {
            try
            {
                if (SessionData.CurrentUser == null)
                {
                    return(Redirect("/"));
                }

                decimal           _total_record = 0;
                Email_BL          _obj_bl       = new Email_BL();
                string            _keySearch    = "ALL" + "|" + "ALL" + "|" + "ALL" + "|" + SessionData.CurrentUser.Type;
                List <Email_Info> _lst          = _obj_bl.Email_Search(SessionData.CurrentUser.Username, _keySearch, ref _total_record);
                string            htmlPaging    = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <Email_Info>((int)_total_record, 1, "Billing");

                ViewBag.Obj       = _lst;
                ViewBag.Paging    = htmlPaging;
                ViewBag.SumRecord = _total_record;

                return(View("~/Areas/Manager/Views/Email/Email_Display.cshtml"));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(View());
            }
        }
        public ActionResult do_delete(decimal p_id)
        {
            try
            {
                if (SessionData.CurrentUser == null)
                {
                    return(Redirect("/"));
                }

                Email_BL _obj_bl = new Email_BL();
                decimal  _re     = _obj_bl.Template_Email_Delete(p_id);

                if (_re > 0)
                {
                    BussinessFacade.ModuleMemoryData.MemoryData.LoadTemplate();
                }

                return(Json(new { success = _re }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { success = "-1" }));
            }
        }
        public ActionResult do_Edit(Template_Email_Info pInfo)
        {
            try
            {
                if (SessionData.CurrentUser == null)
                {
                    return(Redirect("/"));
                }

                Email_BL _obj_bl = new Email_BL();
                pInfo.Modify_By = SessionData.CurrentUser.Username;
                decimal _re = _obj_bl.Template_Email_Update(pInfo);

                if (_re > 0)
                {
                    BussinessFacade.ModuleMemoryData.MemoryData.LoadTemplate();
                }

                return(Json(new { success = _re }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(Json(new { success = "-1" }));
            }
        }
Exemple #4
0
 public static void LoadTemplate()
 {
     try
     {
         Email_BL _Email_BL = new Email_BL();
         c_lst_temEmail = _Email_BL.Template_email_GetAll();
     }
     catch (Exception ex)
     {
         Logger.LogException(ex);
     }
 }
Exemple #5
0
        public ActionResult GetView2View(decimal id, string case_code)
        {
            try
            {
                Email_BL   _obj_bl     = new Email_BL();
                Email_Info _Email_Info = _obj_bl.Email_GetBy_Id(id, case_code, AppsCommon.GetCurrentLang());
                ViewBag.Email_Info = _Email_Info;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }

            return(PartialView("~/Areas/Manager/Views/Email/_PartialView.cshtml"));
        }
        public ActionResult Show_Edit(decimal id)
        {
            if (SessionData.CurrentUser == null)
            {
                return(Redirect("/"));
            }

            try
            {
                Email_BL            _obj_bl = new Email_BL();
                Template_Email_Info _Template_Email_Info = _obj_bl.Template_Email_GetBy_Id(id, AppsCommon.GetCurrentLang());
                ViewBag.Template_Email_Info = _Template_Email_Info;
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            return(View("~/Areas/Manager/Views/TemplateEmail/_PartialEdit.cshtml"));
        }
Exemple #7
0
        public ActionResult Search_Email(string p_keysearch, int p_CurrentPage, string p_column, string p_type_sort)
        {
            try
            {
                decimal           _total_record = 0;
                string            p_to          = "";
                string            p_from        = CommonFuc.Get_From_To_Page(p_CurrentPage, ref p_to);
                Email_BL          _obj_bl       = new Email_BL();
                List <Email_Info> _lst          = _obj_bl.Email_Search(SessionData.CurrentUser.Username, p_keysearch + "|" + SessionData.CurrentUser.Type, ref _total_record, p_from, p_to);
                string            htmlPaging    = WebApps.CommonFunction.AppsCommon.Get_HtmlPaging <Email_Info>((int)_total_record, p_CurrentPage, "Email");

                ViewBag.Paging    = htmlPaging;
                ViewBag.Obj       = _lst;
                ViewBag.SumRecord = _total_record;
                return(PartialView("~/Areas/Manager/Views/Email/_PartialTableEmail.cshtml"));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(PartialView("~/Areas/Manager/Views/Email/_PartialTableEmail.cshtml"));
            }
        }
Exemple #8
0
        void ThreadSendEmail()
        {
            while (true)
            {
                try
                {
                    Email_Info _Email_Info = WebApps.CommonFunction.AppsCommon.Dequeue_SendEmail();
                    if (_Email_Info != null)
                    {
                        _Email_Info.Send_Time = DateTime.Now;
                        bool _ck = EmailHelper.SendMail(_Email_Info.EmailFrom, _Email_Info.Pass, _Email_Info.Display_Name, _Email_Info.EmailTo, _Email_Info.EmailCC, _Email_Info.Subject, _Email_Info.Content, _Email_Info.LstAttachment);
                        if (_ck == false)
                        {
                            WebApps.CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info);
                            _Email_Info.Status = "E";
                        }
                        else
                        {
                            _Email_Info.Status = "S";
                        }

                        Email_BL _bl = new Email_BL();
                        if (_Email_Info.Created_by == null || _Email_Info.Created_by == "")
                        {
                            _Email_Info.Created_by = "System";
                        }
                        _bl.Send_Email_Insert(_Email_Info);
                    }
                    Thread.Sleep(1000);
                }
                catch (Exception ex)
                {
                    Thread.Sleep(2000);
                    Logger.Log().Error(ex.ToString());
                }
            }
        }