Exemple #1
0
        public ActionResult SaveData(FOOTER sp)
        {
            if (ModelState.IsValid)
            {
                var dao        = new FooterDAO();
                var txtContent = Request.Unvalidated.Form.Get("txtContent");

                sp.CREATEBY   = ((UserLogin)Session[CommonStants.USER_SESSION]).userName;
                sp.CREATEDATE = DateTime.Now;
                // decimal id = dao.Insert(sp);

                // var namenew = dao.getIDLastChild();
                //string exePath = System.AppContext.BaseDirectory + "\\Data\\Content\\" + namenew + ".html";
                string     exePath = Server.MapPath("\\Data\\Footer\\" + "ft" + 2 + ".cshtml");
                FileStream fs      = new FileStream(exePath, FileMode.Create);
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    foreach (var s in txtContent)
                    {
                        sw.Write(s);
                    }
                    sw.Flush();
                }
                fs.Close();
                //sp.NOIDUNG = "/Data/Footer/" + "ft" + 2 + ".html";
                //dao.updatenoidung(sp);

                return(RedirectToAction("Index", "Footer"));
            }


            return(View("Index"));
        }
        // GET: Admin/Footer
        public ActionResult Index(int page = 1, int pagesize = 10)
        {
            var dao   = new FooterDAO();
            var model = dao.ListAllPage(page, pagesize);

            return(View(model));
        }
Exemple #3
0
        public ActionResult xacnhanxoa(string ID)
        {
            var result = new FooterDAO().Delete(ID);

            SetAlert("Xóa thông tin  thành công", "success");
            return(RedirectToAction("Index", "Footer"));
        }
Exemple #4
0
        // GET: Admin/Footer
        public ActionResult Index(string searchString, int page = 1, int pagesize = 10)
        {
            var dao        = new FooterDAO();
            var listFooter = dao.ListAll(searchString, page, pagesize);

            return(View(listFooter));
        }
        public ActionResult Footer()
        {
            var dao   = new FooterDAO();
            var model = dao.GetFooter();

            return(PartialView(model));
        }
Exemple #6
0
        private void removeFileTypeButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to delete this File Type?", "Remove File Type", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

            if (result == DialogResult.OK)
            {
                int fileTypeID;

                DataGridViewRow fileTypeRow;

                if (fileTypeGridView.Rows.Count > 0)
                {
                    fileTypeRow = fileTypeGridView.CurrentRow;

                    fileTypeID = Convert.ToInt32(fileTypeRow.Cells["fileTypeID"].Value);

                    try
                    {
                        FileTypeDAO fileTypeDAO = new FileTypeDAO(ConfigurationDatabase);
                        fileTypeDAO.Delete(fileTypeID);

                        SettingsDAO settingsDAO = new SettingsDAO(ConfigurationDatabase);
                        settingsDAO.Delete(fileTypeID);

                        ColumnDAO columnDAO = new ColumnDAO(ConfigurationDatabase);
                        columnDAO.DeleteAll(fileTypeID);

                        HeaderDAO headerDAO = new HeaderDAO(ConfigurationDatabase);
                        headerDAO.DeleteAll(fileTypeID);

                        FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase);
                        footerDAO.DeleteAll(fileTypeID);

                        FileTypes = fileTypeDAO.GetAllFileTypes();

                        if (FileTypes != null)
                        {
                            fileTypeGridView.Rows.Remove(fileTypeRow);
                            fileTypeGridView.Refresh();
                        }
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show("Failed to remove File Source. " + exception.Message, "File Source Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Exemple #7
0
        public ActionResult Xoa(string ID)
        {
            var model = new FooterDAO().GetByID(ID);

            if (model.Status == true)
            {
                ViewBag.status       = "Đang sử dụng";
                ViewBag.status_class = "bg-green";
            }
            else
            {
                ViewBag.status       = "Đã khóa";
                ViewBag.status_class = "bg-red";
            }
            return(View(model));
        }
        public ActionResult Edit(Footer footer)
        {
            if (ModelState.IsValid)
            {
                var dao = new FooterDAO();

                bool result = dao.Update(footer);
                if (result)
                {
                    SetAlert("Cập nhật mới thành công", "success");
                    return(RedirectToAction("Index", "Footer"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật không thành công ! ");
                }
            }
            return(View("Index"));
        }
Exemple #9
0
 public ActionResult CapNhat(Footer entity)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FooterDAO();
         var result = dao.Update(entity);
         if (result)
         {
             SetAlert("Cập nhật kiểu footer thành công", "success");
             return(RedirectToAction("Index", "Footer"));
         }
         else
         {
             SetAlert("Cập nhật kiểu footer không thành công", "error");
             return(RedirectToAction("CapNhat", "Footer"));
         }
     }
     return(View("Index"));
 }
        private void saveFileTypeButton_Click(object sender, EventArgs e)
        {
            try
            {
                SettingsDAO settingsDAO = new SettingsDAO(ConfigurationDatabase);
                settingsDAO.Delete(FileTypeID);

                settingsDAO.Insert(new Settings(FileTypeID, useFileNameCheckBox.Checked, useFileExtensionCheckBox.Checked, textToIgnoreFileNameTextBox.Text, dateTimeFormatFileNameTextBox.Text, textToIgnoreFileExtensionTextBox.Text, dateTimeFormatFileExtensionTextBox.Text, linkDateTimeCheckBox.Checked, dateTimeColumnTextBox.Text, dateTimeFormatLinkDateTextBox.Text, truncateTableCheckBox.Checked));

                ColumnDAO columnDAO = new ColumnDAO(ConfigurationDatabase);
                columnDAO.DeleteAll(FileTypeID);

                foreach (DataGridViewRow row in columnDataGridView.Rows)
                {
                    columnDAO.Insert(new Column(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString(), Convert.ToBoolean(row.Cells[3].Value), Convert.ToBoolean(row.Cells[4].Value)));
                }

                HeaderDAO headerDAO = new HeaderDAO(ConfigurationDatabase);
                headerDAO.DeleteAll(FileTypeID);

                foreach (DataGridViewRow row in headerDataGridView.Rows)
                {
                    headerDAO.Insert(new Header(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString()));
                }

                FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase);
                footerDAO.DeleteAll(FileTypeID);

                foreach (DataGridViewRow row in footerDataGridView.Rows)
                {
                    footerDAO.Insert(new Footer(FileTypeID, Convert.ToInt32(row.Cells[0].Value), row.Cells[1].Value.ToString()));
                }

                MessageBox.Show("Successfully saved File Type Configuration!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                Close();
            }
            catch (Exception exception)
            {
                MessageBox.Show("Failed to save Column data. " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #11
0
        public ActionResult ThemMoi(Footer entity)
        {
            if (ModelState.IsValid)
            {
                var dao = new FooterDAO();

                var result = dao.Insert(entity);
                if (result)
                {
                    SetAlert("Thêm kiểu footer thành công", "success");
                    return(RedirectToAction("Index", "Footer"));
                }
                else
                {
                    SetAlert("Thêm kiểu footer không thành công", "error");
                    return(RedirectToAction("ThemMoi", "Footer"));
                }
            }
            return(View("Index"));
        }
        private void removeFootersButton_Click(object sender, EventArgs e)
        {
            int footerNumber = 0;

            DataGridViewRow footerRow;

            if (footerDataGridView.Rows.Count > 0)
            {
                footerRow = headerDataGridView.CurrentRow;

                footerNumber = Convert.ToInt32(footerRow.Cells["footerNumber"].Value);

                try
                {
                    FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase);
                    footerDAO.Delete(FileTypeID, footerNumber);

                    Footers = footerDAO.GetFootersByFileTypeID(FileTypeID);

                    if (Footers != null)
                    {
                        footerDataGridView.Rows.Remove(footerRow);

                        foreach (DataGridViewRow row in footerDataGridView.Rows)
                        {
                            row.Cells["footerNumber"].Value = row.Cells["footerNumber"].RowIndex;
                        }

                        footerDataGridView.Refresh();
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show("Failed to remove File Source. " + exception.Message, "File Source Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemple #13
0
        public ActionResult CapNhat(string ID)
        {
            var model = new FooterDAO().GetByID(ID);

            return(View(model));
        }
Exemple #14
0
        public ActionResult Footer()
        {
            var model = new FooterDAO().GetFooter();

            return(PartialView("_Footer", model));
        }
        public ActionResult Edit(int id)
        {
            var footer = new FooterDAO().ViewDetail(id);

            return(View(footer));
        }
        public ActionResult Footer()
        {
            var dao = new FooterDAO().GetFooter();

            return(PartialView(dao));
        }
Exemple #17
0
 public static Footer GetFooter()
 {
     return(FooterDAO.GetFooter());
 }
Exemple #18
0
 public ActionResult _FooterPartial()
 {
     var model = new FooterDAO().GetFooter();
     return PartialView(model);
 }
Exemple #19
0
        public void Start()
        {
            try
            {
                if (!EventLog.SourceExists(Name))
                {
                    EventLog.CreateEventSource(Name, "File Reader Service");
                }

                eventLog = new EventLog();

                eventLog.Log    = "File Reader Service";
                eventLog.Source = Name;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Failed to setup event viewer logging. " + exception.Message);
            }

            try
            {
                if (ConfigurationDatabase != null)
                {
                    FileTypeDAO fileTypeDAO = new FileTypeDAO(ConfigurationDatabase);
                    FileType = fileTypeDAO.GetFileType(FileTypeID);

                    SettingsDAO settingsDAO = new SettingsDAO(ConfigurationDatabase);
                    FileType.Settings = settingsDAO.GetSettingsByFileTypeID(FileTypeID);

                    ColumnDAO columnDAO = new ColumnDAO(ConfigurationDatabase);
                    FileType.Columns = columnDAO.Read(FileTypeID);

                    HeaderDAO headerDAO = new HeaderDAO(ConfigurationDatabase);
                    FileType.Headers = headerDAO.GetHeadersByFileTypeID(FileTypeID);

                    FooterDAO footerDAO = new FooterDAO(ConfigurationDatabase);
                    FileType.Footers = footerDAO.GetFootersByFileTypeID(FileTypeID);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Failed to get file type information from configuration database. " + exception.Message);

                if (eventLog != null)
                {
                    eventLog.WriteEntry("Failed to get file type information from configuration database. " + exception.Message, EventLogEntryType.Error);
                }
            }

            try
            {
                FileSystemWatcher                     = new FileSystemWatcher(Directory, "*.*");
                FileSystemWatcher.Changed            += new FileSystemEventHandler(OnChanged);
                FileSystemWatcher.NotifyFilter        = NotifyFilters.LastWrite;
                FileSystemWatcher.EnableRaisingEvents = true;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Failed to setup file system watcher. " + exception.Message);

                if (eventLog != null)
                {
                    eventLog.WriteEntry("Failed to setup file system watcher. " + exception.Message, EventLogEntryType.Error);
                }
            }
        }