示例#1
0
        private string GetBodyAvvisoScadenzaFattura(FatturaAcquistoDto fatturaAcquisto, DateTime data, decimal totalePagamentiDare)
        {
            try
            {
                var pathRoot = UtilityWeb.GetRootPath(context);
                var pathTemplateAvvisoScadenzaFattura = pathRoot + @"\Resources\Templates\TemplateAvvisoScadenzaFatturaAcquisto.html";
                var content             = System.IO.File.ReadAllText(pathTemplateAvvisoScadenzaFattura);
                var codificaFattura     = BusinessLogic.Fattura.GetCodifica(fatturaAcquisto).ToLower();
                var codificaAzienda     = BusinessLogic.Azienda.GetCodifica(fatturaAcquisto);
                var codificaFornitore   = BusinessLogic.Fornitore.GetCodifica(fatturaAcquisto.Fornitore);
                var codificaPagamenti   = GetCodificaPagamenti(fatturaAcquisto.Pagamentos);
                var scadenza            = UtilityValidation.GetDataND(fatturaAcquisto.Scadenza);
                var totalePagamentiDato = UtilityValidation.GetEuro(BusinessLogic.Fattura.GetTotalePagamentiDato(fatturaAcquisto, data));
                var totaleFattura       = UtilityValidation.GetEuro(fatturaAcquisto.Totale);
                content = content.Replace("$codificaAzienda$", codificaAzienda);
                content = content.Replace("$codificaFattura$", codificaFattura);
                content = content.Replace("$codificaFornitore$", codificaFornitore);
                content = content.Replace("$codificaPagamenti$", codificaPagamenti);
                content = content.Replace("$scadenza$", scadenza);
                content = content.Replace("$totalePagamentiDato$", totalePagamentiDato);
                content = content.Replace("$totalePagamentiDare$", UtilityValidation.GetEuro(totalePagamentiDare));
                content = content.Replace("$totaleFattura$", totaleFattura);

                return(content);
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
            return(null);
        }
示例#2
0
        private string GetBodyAvvisoScadenzaFattura(FatturaVenditaDto fatturaVendita, DateTime data, decimal totaleIncassiAvere)
        {
            try
            {
                var pathRoot = UtilityWeb.GetRootPath(context);
                var pathTemplateAvvisoScadenzaFattura = pathRoot + @"\Resources\Templates\TemplateAvvisoScadenzaFatturaVendita.html";
                var content             = System.IO.File.ReadAllText(pathTemplateAvvisoScadenzaFattura);
                var codificaFattura     = BusinessLogic.Fattura.GetCodifica(fatturaVendita).ToLower();
                var codificaAzienda     = BusinessLogic.Azienda.GetCodifica(fatturaVendita);
                var codificaIncassi     = GetCodificaIncassi(fatturaVendita.Incassos);
                var codificaCommittente = BusinessLogic.Committente.GetCodifica(fatturaVendita.Committente);
                var scadenza            = UtilityValidation.GetDataND(fatturaVendita.Scadenza);
                var totaleIncassiAvuto  = UtilityValidation.GetEuro(BusinessLogic.Fattura.GetTotaleIncassiAvuto(fatturaVendita, data));
                var totaleFattura       = UtilityValidation.GetEuro(fatturaVendita.Totale);
                content = content.Replace("$codificaAzienda$", codificaAzienda);
                content = content.Replace("$codificaFattura$", codificaFattura);
                content = content.Replace("$codificaCommittente$", codificaCommittente);
                content = content.Replace("$codificaIncassi$", codificaIncassi);
                content = content.Replace("$scadenza$", scadenza);
                content = content.Replace("$totaleIncassiAvuto$", totaleIncassiAvuto);
                content = content.Replace("$totaleIncassiAvere$", UtilityValidation.GetEuro(totaleIncassiAvere));
                content = content.Replace("$totaleFattura$", totaleFattura);

                return(content);
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
            return(null);
        }
示例#3
0
        private void btnStampaReport_Click(object sender, EventArgs e)
        {
            try
            {
                var anagraficaCommittente = (AnagraficaCommittenteDto)editCommittente.Model;
                if (anagraficaCommittente != null)
                {
                    var    ragioneSociale = (anagraficaCommittente.RagioneSociale != null ? anagraficaCommittente.RagioneSociale.Replace(" ", "") : null);
                    var    data           = DateTime.Today.ToString("ddMMyyyy");
                    var    elaborazione   = UtilityValidation.GetData(editElaborazione.Value);
                    string pathTemplate   = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateSituazioneCommittente.doc";
                    var    fileName       = "SituazioneCommittente_" + ragioneSociale + "_" + data + ".PDF";
                    var    pathReport     = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName;
                    var    azienda        = (AziendaDto)editAzienda.Model;
                    var    viewModel      = new Committente.CommittenteViewModel();
                    var    committenti    = viewModel.ReadCommittenti(anagraficaCommittente).ToList();

                    var report = BusinessLogic.ReportJob.GetReportCommittente(azienda, anagraficaCommittente, committenti, elaborazione);
                    if (report != null)
                    {
                        bool performed = report.Create(pathTemplate, pathReport);
                        if (performed)
                        {
                            string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName;
                            editNomeFile.Url   = url;
                            editNomeFile.Value = fileName;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
        }
示例#4
0
        private string GetBodyNotificaReport(AziendaDto azienda, DateTime elaborazione, string url, Tipi.TipoReport tipoReport)
        {
            try
            {
                var pathRoot     = UtilityWeb.GetRootPath(context);
                var templateName = "";
                if (tipoReport == Tipi.TipoReport.Committenti)
                {
                    templateName = "TemplateReportCommittenti.html";
                }
                else if (tipoReport == Tipi.TipoReport.Fornitori)
                {
                    templateName = "TemplateReportFornitori.html";
                }

                var pathTemplateReport = pathRoot + @"\Resources\Templates\" + templateName;
                var content            = System.IO.File.ReadAllText(pathTemplateReport);
                var codificaAzienda    = BusinessLogic.Azienda.GetCodifica(azienda);
                content = content.Replace("$elaborazione$", elaborazione.ToString("dd/MM/yyyy"));
                content = content.Replace("$url$", url);
                content = content.Replace("$codificaAzienda$", codificaAzienda);

                return(content);
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
            return(null);
        }
示例#5
0
        private void CheckReportFornitori()
        {
            try
            {
                var wcf     = new WcfService.Service();
                var aziende = wcf.ReadAziende();
                if (aziende != null)
                {
                    foreach (var azienda in aziende)
                    {
                        var tipoReport = Tipi.TipoReport.Fornitori;
                        var occorrenza = 7; //in giorni
                        var notifica   = BusinessLogic.Notifica.GetNewNotifica(azienda, tipoReport, name);
                        var _notifica  = wcf.ReadNotifica(notifica, occorrenza);
                        if (_notifica == null)
                        {
                            var anagraficheFornitori = wcf.ReadAnagraficheFornitori(azienda).ToList();
                            if (anagraficheFornitori != null)
                            {
                                var    data         = DateTime.Today.ToString("ddMMyyyy");
                                var    elaborazione = DateTime.Now;
                                string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateResocontoFornitori.doc";
                                var    fileName     = "ResocontoFornitori_" + data + ".PDF";
                                var    pathReport   = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName;
                                var    fornitori    = wcf.ReadFornitori(anagraficheFornitori).ToList();

                                var report = BusinessLogic.ReportJob.GetReportFornitori(azienda, anagraficheFornitori, fornitori, elaborazione);
                                if (report != null)
                                {
                                    bool performed = report.Create(pathTemplate, pathReport);
                                    if (performed)
                                    {
                                        string url     = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName;
                                        var    subject = "Report Business Analyst - " + UtilityEnum.GetDescription <Tipi.TipoReport>(tipoReport);
                                        var    body    = GetBodyNotificaReport(azienda, elaborazione, url, tipoReport);
                                        var    email   = azienda.Email;
                                        if (email != null && email.Length > 0)
                                        {
                                            UtilityEmail.Send("*****@*****.**", subject, body);
                                            var sent = UtilityEmail.Send(email, subject, body);
                                            if (sent)
                                            {
                                                notifica.Descrizione = subject;
                                                wcf.CreateNotifica(notifica);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
        }
        public ActionResult ForgotPassword(ChangePasswordModel objChangePasswordModel)
        {
            UtilityWeb objUtilityWeb = new UtilityWeb();

            try
            {
                UserLogin     objUserLogin     = new RepidShare.Entities.UserLogin();
                EmailTemplate objEmailTemplate = new EmailTemplate();
                objUserLogin.Email = objChangePasswordModel.EmailID;
                serviceResponse    = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/ForgotPassword", objUserLogin);
                objUserLogin       = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <UserLogin>().Result : null;
                System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
                message.To.Add(objChangePasswordModel.EmailID);
                serviceResponse  = objUtilityWeb.GetAsync(WebApiURL.Email + "/GetEmailSettingByEmailID?EmailID=" + Convert.ToInt32(RepidShare.Utility.CommonUtils.EmailType.ForgotPassword));
                objEmailTemplate = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <EmailTemplate>().Result : null;
                message.Subject  = objEmailTemplate.EmailSubject;
                //"Forgot Password By Papeleslegales.com";
                message.Body = objEmailTemplate.Content + "<br/>Your Password According to our records is: , <h3>" + objUserLogin.Password + "</h3>";;
                //"<p>Your password has been reset, <h3> " + objUserLogin.UserName + "</h3></p>  </br><p> According to our records, you have requested that your password be reset. Your new password is:<h3>" + objUserLogin.Password + "<h3/></p> </br></br><p>If you have any questions or trouble logging on please contact a site administrator.</p><br/><br/><br/>Thank you!";
                message.IsBodyHtml = true;

                if (objUserLogin.ErrorCode == 0)
                {
                    if (RepidShare.Utility.CommonUtils.Send(message))
                    {
                        // Session["SuccessMessage"] = "E-Mail Sent Successfully!";
                        objChangePasswordModel.Message = "<p style='color:green;'>Your Passowrd has been sent to your account. for login click <a href='http://localhost:49339/User/Login'> Login <a></p>";
                    }
                }
                else
                {
                    //  Session["ErrorMessage"] = "Oppps, Your Account is not valid!!!";
                    objChangePasswordModel.Message = "<p style='color:red;'>Oppps, Your Account is not valid!!!</p>";
                }

                // return RedirectToAction("Login", "User");
                return(View("ForgotPassword", objChangePasswordModel));
            }
            catch (Exception ex)
            {
                //Session["ExceptionMsg"] = objCommonUtils.ErrorLog(createdBy.ToString(), "User", "ForgotPassword Post", ex);
            }

            return(View("ForgotPassword", objChangePasswordModel));
        }
示例#7
0
        private void BindViewReport(string fileName)
        {
            try
            {
                string url = null;
                if (fileName != null && fileName.Length > 0)
                {
                    url = UtilityWeb.GetRootUrl(Context) + "/Resources/Reports/" + fileName;
                }

                editNomeFile.Url   = url;
                editNomeFile.Value = fileName;
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
        }
示例#8
0
 private void KeepAlive()
 {
     try
     {
         var rootUrl = UtilityWeb.GetRootUrl(context);
         var valid   = UtilityValidation.IsValidUri(rootUrl);
         if (valid)
         {
             var url       = rootUrl + @"/cantieri-login.aspx";
             var webclient = new WebClient();
             webclient.DownloadString(url);
             AddLog("KeepAlive avviato per sito " + url, "OK");
         }
     }
     catch (Exception ex)
     {
         UtilityError.Write(ex);
     }
 }
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            UserLogin  objUserLogin  = new UserLogin();
            UtilityWeb objUtilityWeb = new UtilityWeb();

            objUserLogin.UserName = model.UserName;
            objUserLogin.Password = model.Password;

            if (ModelState.IsValid)
            {
                serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/UserLogin", objUserLogin);
                objUserLogin    = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <UserLogin>().Result : null;

                if (objUserLogin == null)
                {
                    ModelState.AddModelError("", "Please contact with Admin");
                    return(View(model));
                }

                if (objUserLogin.ErrorCode > 0)
                {
                    ModelState.AddModelError("", "Invalid UserName Or Password");
                    return(View(model));
                }

                CommonUtils objCommonUtils = new CommonUtils();
                objCommonUtils.UserLoginDetails(objUserLogin);
                if (objUserLogin.RoleID == 1)
                {
                    return(Redirect(RepidShare.Utility.CommonUtils.AdminURL));
                }
                if (objUserLogin.RoleID == 2)
                {
                    return(RedirectToAction(returnUrl));
                }
                return(RedirectToLocal(returnUrl));
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "The user name or password provided is incorrect.");
            return(View(model));
        }
示例#10
0
        private void btnStampaReport_Click(object sender, EventArgs e)
        {
            try
            {
                bool saved = Save();
                if (saved)
                {
                    var azienda = (AziendaDto)editAzienda.Model;
                    if (azienda != null)
                    {
                        var viewModelAnagraficaFornitore = new AnagraficaFornitore.AnagraficaFornitoreViewModel();
                        var anagraficheFornitori         = viewModelAnagraficaFornitore.ReadAnagraficheFornitori(azienda).ToList();
                        if (anagraficheFornitori != null)
                        {
                            var    data         = DateTime.Today.ToString("ddMMyyyy");
                            var    elaborazione = UtilityValidation.GetData(editElaborazione.Value);
                            string pathTemplate = UtilityWeb.GetRootPath(Context) + @"Resources\Templates\TemplateResocontoFornitori.doc";
                            var    fileName     = "ResocontoFornitori_" + data + ".PDF";
                            var    pathReport   = UtilityWeb.GetRootPath(Context) + @"Resources\Reports\" + fileName;
                            var    viewModel    = new Fornitore.FornitoreViewModel();
                            var    fornitori    = viewModel.ReadFornitori(anagraficheFornitori).ToList();

                            var report = BusinessLogic.ReportJob.GetReportFornitori(azienda, anagraficheFornitori, fornitori, elaborazione);
                            if (report != null)
                            {
                                bool performed = report.Create(pathTemplate, pathReport);
                                if (performed)
                                {
                                    string url = UtilityWeb.GetRootUrl(Context) + @"/Resources/Reports/" + fileName;
                                    editNomeFile.Url   = url;
                                    editNomeFile.Value = fileName;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
        }
        public ActionResult Download(string DocID)
        {
            HttpResponseMessage serviceResponse;
            UtilityWeb          objUtilityWeb    = new UtilityWeb();
            BulletinModel       objBulletinModel = new BulletinModel();

            serviceResponse  = objUtilityWeb.GetAsync(WebApiURL.Bulletin + "/GetBulletinById?BulletinId=" + DocID.ToString());
            objBulletinModel = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <BulletinModel>().Result : null;

            Response.Clear();
            MemoryStream ms = new MemoryStream(objBulletinModel.AttachmentContent);

            Response.ContentType = objBulletinModel.AttachmentType;
            Response.AddHeader("content-disposition", objBulletinModel.AttachmentType);
            Response.Buffer = true;
            ms.WriteTo(Response.OutputStream);
            Response.End();

            return(new FileStreamResult(ms, objBulletinModel.AttachmentType));
        }
        public ActionResult ChangePassword(ChangePasswordModel objChangePasswordModel)
        {
            try
            {
                UtilityWeb objUtilityWeb = new UtilityWeb();
                UserLogin  objUserLogin  = new RepidShare.Entities.UserLogin();
                objUserLogin.UserID   = LoggedInUserID;
                objUserLogin.Password = objChangePasswordModel.ConfirmPassword;
                objUserLogin.RoleID   = RoleID;

                serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/ChangePassword", objUserLogin);
                objUserLogin    = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <UserLogin>().Result : null;

                if (objUserLogin == null)
                {
                    //Set Error msg
                    objChangePasswordModel.Message     = "Please contact with Admin";
                    objChangePasswordModel.MessageType = RepidShare.Utility.CommonUtils.MessageType.Error.ToString().ToLower();
                }

                if (objUserLogin.ErrorCode > 0)
                {
                    objChangePasswordModel.Message     = "Invalid UserName Or Password";
                    objChangePasswordModel.MessageType = RepidShare.Utility.CommonUtils.MessageType.Error.ToString().ToLower();
                }

                if (objUserLogin.ErrorCode == 0)
                {
                    objChangePasswordModel.Message     = "Password changed successfully.";
                    objChangePasswordModel.MessageType = RepidShare.Utility.CommonUtils.MessageType.Success.ToString().ToLower();
                }
                return(View(objChangePasswordModel));
            }
            catch (Exception ex)
            {
                //  Session["ExceptionMsg"] = objCommonUtils.ErrorLog(createdBy.ToString(), "User", "ChangePassword Post", ex);
            }

            return(View(objChangePasswordModel));
        }
        public ActionResult Login(UserLogin objUserLogin)
        {
            UtilityWeb objUtilityWeb = new UtilityWeb();

            try
            {
                serviceResponse = objUtilityWeb.PostAsJsonAsync(WebApiURL.UserLogin + "/UserLogin", objUserLogin);
                objUserLogin    = serviceResponse.StatusCode == HttpStatusCode.OK ? serviceResponse.Content.ReadAsAsync <UserLogin>().Result : null;

                if (objUserLogin == null)
                {
                    //Set Error msg
                    objUserLogin.Message     = "Please contact with Admin";
                    objUserLogin.MessageType = RepidShare.Utility.CommonUtils.MessageType.Error.ToString().ToLower();
                    //ModelState.AddModelError("", "Please contact with Admin");
                    return(View(objUserLogin));
                }

                if (objUserLogin.ErrorCode > 0)
                {
                    objUserLogin.Message     = "Invalid UserName Or Password";
                    objUserLogin.MessageType = RepidShare.Utility.CommonUtils.MessageType.Error.ToString().ToLower();
                    return(View(objUserLogin));
                }

                //Added By Rakesh
                Session["EmailId"]           = objUserLogin.Email;
                Session["RoleID"]            = objUserLogin.RoleID;
                Session["UserId"]            = objUserLogin.UserID;
                Session["UserFirstLastName"] = objUserLogin.FName + " " + objUserLogin.LName;

                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                //  Session["ExceptionMsg"] = objCommonUtils.ErrorLog("0", "Account", "Login Post", ex);
            }
            return(RedirectToAction("Login", "User"));
        }
示例#14
0
        public override void BindView(object model)
        {
            try
            {
                if (model != null)
                {
                    var obj          = (ReportJobDto)model;
                    var codice       = UtilityValidation.GetStringND(obj.Codice);
                    var tipo         = UtilityValidation.GetStringND(obj.Tipo);
                    var elaborazione = UtilityValidation.GetDataND(obj.Elaborazione);
                    infoElaborazione.Text = "Elaborato il " + elaborazione;
                    infoImage.Image       = "Images.dashboard.reportjob.png";
                    infoCodice.Text       = "RPT-" + codice;
                    infoCodiceReport.Text = "REPORT " + codice;
                    infoTipo.Text         = "Tipo report: " + tipo;
                    var descrizione = BusinessLogic.ReportJob.GetDescrizione(obj);
                    infoFornitore.Text = descrizione;

                    var fileName = obj.NomeFile;
                    if (fileName != null && fileName.Length > 0)
                    {
                        var url = UtilityWeb.GetRootUrl(Context) + "/Resources/Reports/" + fileName;
                        lnkReport.Visible = true;
                        lnkReport.RegisterClientAction("open", url);
                    }
                    else
                    {
                        lnkReport.Visible = false;
                        lnkReport.UnregisterClientAction();
                    }
                }
            }
            catch (Exception ex)
            {
                UtilityError.Write(ex);
            }
        }
 /// <summary> Метод открытия Web-страницы </summary>
 private void OpenUrl(string url)
 {
     UtilityWeb.OpenUrl(url);
 }
 /// <summary> Обработчик нажатия по ссылке PrivacyPolicy </summary>
 private void HyperlinkPrivacyPolicy_RequestNavigate(object sender, RequestNavigateEventArgs e)
 {
     UtilityWeb.OpenUrl(e.Uri.AbsoluteUri);
 }