Example #1
0
        public override DatePicker Create(DeterministicRandom random)
        {
            DatePicker datePicker = new DatePicker();

            if (DisplayDate != null)
            {
                datePicker.DisplayDate = (DateTime)DisplayDate.GetData(random);
            }

            if (DisplayDateEnd != null)
            {
                datePicker.DisplayDateEnd = (DateTime)DisplayDateEnd.GetData(random);
            }

            if (DisplayDateStart != null)
            {
                datePicker.DisplayDateStart = (DateTime)DisplayDateStart.GetData(random);
            }

            datePicker.FirstDayOfWeek     = FirstDayOfWeek;
            datePicker.IsTodayHighlighted = IsTodayHighlighted;

            if (SelectedDate != null)
            {
                datePicker.SelectedDate = (DateTime)SelectedDate.GetData(random);
            }

            datePicker.SelectedDateFormat = SelectedDateFormat;
            return(datePicker);
        }
Example #2
0
 void Awake()
 {
     displayMoney = FindObjectOfType <DisplayMoney>();
     displayDate  = FindObjectOfType <DisplayDate>();
     UpdateMoney();
     UpdateDate();
 }
        private void UpdateComponents()
        {
            var culture            = Language.GetSpecificCulture();
            var dateTimeFormatInfo = culture.GetDateFormat();
            var minDateTime        = dateTimeFormatInfo.Calendar.MinSupportedDateTime;
            var maxDateTime        = dateTimeFormatInfo.Calendar.MaxSupportedDateTime;

            if (DisplayDate < minDateTime)
            {
                SetDisplayDateOfCalendar(minDateTime);

                // return to avoid second formatting of the same value
                return;
            }

            if (DisplayDate > maxDateTime)
            {
                SetDisplayDateOfCalendar(maxDateTime);

                // return to avoid second formatting of the same value
                return;
            }

            ComponentOneContent   = DisplayDate.ToString(dateTimeFormatInfo.MonthDayPattern.Replace("MMMM", "MMM"), culture).ToTitleCase(culture); //Day Month following culture order. We don't want the month to take too much space
            ComponentTwoContent   = DisplayDate.ToString("ddd,", culture).ToTitleCase(culture);                                                    // Day of week first
            ComponentThreeContent = DisplayDate.ToString("yyyy", culture).ToTitleCase(culture);                                                    // Year always top
        }
Example #4
0
        protected override void OnRender(DrawingContext dc)
        {
            var size = RenderSize;

            new CalendarGridPainter(dc, DisplayDate.FirstDayOnCalendar(), DisplayDate.Month, size,
                                    VisualTreeHelper.GetDpi(this).PixelsPerDip, rowHeights).PaintCalendar();
        }
        private void UpdateTitle()
        {
            if (mBtnTitle == null)
            {
                return;
            }
            switch (DisplayMode)
            {
            case CalendarMode.Month:
                mBtnTitle.Content = DisplayDate.ToString("yyyy-MM");
                break;

            case CalendarMode.Year:
                mBtnTitle.Content = DisplayDate.ToString("yyyy");
                break;

            case CalendarMode.Decade:
                var beginY = DisplayDate.Year - (DisplayDate.Year % 10);
                var endY   = beginY + 9;
                mBtnTitle.Content = beginY + "-" + endY;
                break;

            default:
                break;
            }
        }
Example #6
0
        //      ----------------

        protected override void OnProvideDefaultValues(out double displayValue, out double displayValueRange)
        {
            TraceWpf.Line(">>>>> LegendXDate.OnProvideDefaultValues()");
            DisplayDate       = DateTime.Now.AddDays(-7);
            displayValue      = DisplayDate.ToDouble();
            DisplayDateRange  = TimeSpan.FromDays(1);
            displayValueRange = DisplayDateRange.ToDouble();
        }
Example #7
0
        //FrameworkElement.LanguageProperty.OverrideMetadata(typeof (Calendar), (PropertyMetadata) new FrameworkPropertyMetadata(new PropertyChangedCallback(Calendar.OnLanguageChanged)));
        private void UpdateComponents()
        {
            var culture            = Language.GetSpecificCulture();
            var dateTimeFormatInfo = culture.GetDateFormat();

            ComponentOneContent   = DisplayDate.ToString(dateTimeFormatInfo.MonthDayPattern.Replace("MMMM", "MMM"), culture).ToTitleCase(culture); //Day Month folowing culture order. We don't want the month to take too much space
            ComponentTwoContent   = DisplayDate.ToString("ddd,", culture).ToTitleCase(culture);                                                    // Day of week first
            ComponentThreeContent = DisplayDate.ToString("yyyy", culture).ToTitleCase(culture);                                                    // Year always top
        }
        //FrameworkElement.LanguageProperty.OverrideMetadata(typeof (Calendar), (PropertyMetadata) new FrameworkPropertyMetadata(new PropertyChangedCallback(Calendar.OnLanguageChanged)));
        private void UpdateComponents()
        {
            var dateTimeFormatInfo = CultureInfo.CurrentUICulture.GetDateFormat();

            foreach (var component in dateTimeFormatInfo.ShortDatePattern.Split(new[] { dateTimeFormatInfo.DateSeparator },
                                                                                StringSplitOptions.RemoveEmptyEntries).Select((s, index) => new { code = s.ToLower()[0], index }))
            {
                if (component.index == 0)
                {
                    IsDayInFirstComponent = component.code == 'd';
                }
                _setters[component.index](DisplayDate.ToString(_formats[component.code], CultureInfo.CurrentUICulture).ToTitleCase());
            }
        }
Example #9
0
        private static void runInterfaceImplementaion()
        {
            /* Prepare all menus */

            //Menu Item 1
            Interfaces.SubMenuItem actionsAndInfo = new Interfaces.SubMenuItem("Actions and Info");

            //Menu Item 1.1
            IExecuteFlowLogic displayVersion = new DisplayVersion();

            actionsAndInfo.AddMenuItem(new ExecuteFlowMenueItem("Display Version", displayVersion));

            //Menu Item 1.2
            Interfaces.SubMenuItem actions = new Interfaces.SubMenuItem("Actions");

            //Menu Item 1.2.1
            IExecuteFlowLogic spaceCounter = new SpaceCounter();

            actions.AddMenuItem(new ExecuteFlowMenueItem("Count Spaces", spaceCounter));

            //Menu Item 1.2.2
            IExecuteFlowLogic charsCounter = new CharsCounter();

            actions.AddMenuItem(new ExecuteFlowMenueItem("Chars Count", charsCounter));
            actionsAndInfo.AddMenuItem(actions);

            //Menu Item 2
            Interfaces.SubMenuItem dateAndTime = new Interfaces.SubMenuItem("Show Date/Time");

            //Menu Item 2.1
            IExecuteFlowLogic showTime = new DisplayTime();

            dateAndTime.AddMenuItem(new ExecuteFlowMenueItem("Show Time", showTime));

            //Menu Item 2.2
            IExecuteFlowLogic showDate = new DisplayDate();

            dateAndTime.AddMenuItem(new ExecuteFlowMenueItem("Show Date", showDate));

            /* Prepare main menu */
            Interfaces.SubMenuItem mainMenu = new Interfaces.SubMenuItem("Main Menu - Interface Implemented");
            mainMenu.AddMenuItem(actionsAndInfo);
            mainMenu.AddMenuItem(dateAndTime);
            Interfaces.MainMenu interfaceMainMenu = new Interfaces.MainMenu(mainMenu);

            /* execute */
            interfaceMainMenu.Show();
        }
Example #10
0
        /// <summary>
        /// Createa a Calendar.
        /// </summary>
        /// <param name="random"></param>
        /// <returns></returns>
        public override Calendar Create(DeterministicRandom random)
        {
            Calendar calendar = new Calendar();

            if (DisplayDate != null)
            {
                calendar.DisplayDate = (DateTime)DisplayDate.GetData(random);
            }

            if (DisplayDateEnd != null)
            {
                calendar.DisplayDateEnd = (DateTime)DisplayDateEnd.GetData(random);
            }

            if (DisplayDateStart != null)
            {
                calendar.DisplayDateStart = (DateTime)DisplayDateStart.GetData(random);
            }

            calendar.FirstDayOfWeek     = FirstDayOfWeek;
            calendar.IsTodayHighlighted = IsTodayHighlighted;
            calendar.SelectionMode      = SelectionMode;
            calendar.DisplayMode        = DisplayMode;
            HomelessTestHelpers.Merge(calendar.BlackoutDates, BlackoutDates);

            //SelectedDate property cannot be set when the selection mode is None.
            // and
            //BlackoutDates cannot contain the SelectedDate.
            if (SelectedDate != null && calendar.SelectionMode != CalendarSelectionMode.None)
            {
                DateTime date = (DateTime)SelectedDate.GetData(random);
                if (!calendar.BlackoutDates.Contains(date))
                {
                    calendar.SelectedDate = date;
                }
            }

            return(calendar);
        }
        public AutoBackupItem(string fileName)
        {
            FullPath    = fileName;
            DisplayDate = Path.GetFileName(fileName).Substring(0, 19).Replace('_', ' ');
            DisplayDate = DisplayDate.Remove(13, 1).Insert(13, ":");
            DisplayDate = DisplayDate.Remove(16, 1).Insert(16, ":");

            FileName = Path.GetFileName(fileName).Remove(0, 20);
            if (FileName == "srt")
            {
                FileName = "Untitled.srt";
            }

            Extension = Path.GetExtension(fileName);

            try
            {
                DisplaySize = new FileInfo(fileName).Length + " bytes";
            }
            catch
            {
                DisplaySize = "?";
            }
        }
Example #12
0
        void WriteTitle(HtmlTextWriter writer, bool enabled)
        {
            TableCell cellNextPrev = null;
            TableCell titleCell    = new TableCell();
            Table     tableTitle   = new Table();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            titleCell.ColumnSpan = HasWeekSelectors(SelectionMode) ? 8 : 7;

            if (titleStyle != null && !titleStyle.IsEmpty && !titleStyle.BackColor.IsEmpty)
            {
                titleCell.BackColor = titleStyle.BackColor;
            }
            else
            {
                titleCell.BackColor = Color.Silver;
            }

            titleCell.RenderBeginTag(writer);

            // Table
            tableTitle.Width = Unit.Percentage(100);
            if (titleStyle != null && !titleStyle.IsEmpty)
            {
                tableTitle.ApplyStyle(titleStyle);
            }

            tableTitle.RenderBeginTag(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Tr);

            if (ShowNextPrevMonth)               // Previous Table Data
            {
                cellNextPrev = new TableCell();
                cellNextPrev.ApplyStyle(nextPrevStyle);
                cellNextPrev.Width = Unit.Percentage(15);

                DateTime date = GetGlobalCalendar().AddMonths(DisplayDate, -1);
                date = GetGlobalCalendar().AddDays(date, -date.Day + 1);
                cellNextPrev.RenderBeginTag(writer);
                writer.Write(BuildLink("V" + GetDaysFromZenith(date), GetNextPrevFormatText(date, false), cellNextPrev.ForeColor, enabled));
                cellNextPrev.RenderEndTag(writer);
            }

            // Current Month Table Data
            {
                DateTimeFormatInfo dti = DateInfo;
                string             str;
                TableCell          cellMonth = new TableCell();
                cellMonth.Width           = Unit.Percentage(70);
                cellMonth.HorizontalAlign = HorizontalAlign.Center;

                cellMonth.RenderBeginTag(writer);

                if (TitleFormat == TitleFormat.MonthYear)
                {
                    str = DisplayDate.ToString(dti.YearMonthPattern, dti);
                }
                else
                {
                    str = dti.GetMonthName(GetGlobalCalendar().GetMonth(DisplayDate));
                }

                writer.Write(str);
                cellMonth.RenderEndTag(writer);
            }

            if (ShowNextPrevMonth)               // Next Table Data
            {
                DateTime date = GetGlobalCalendar().AddMonths(DisplayDate, +1);
                date = GetGlobalCalendar().AddDays(date, -date.Day + 1);

                cellNextPrev.HorizontalAlign = HorizontalAlign.Right;
                cellNextPrev.RenderBeginTag(writer);
                writer.Write(BuildLink("V" + GetDaysFromZenith(date), GetNextPrevFormatText(date, true), cellNextPrev.ForeColor, enabled));
                cellNextPrev.RenderEndTag(writer);
            }

            writer.RenderEndTag();
            tableTitle.RenderEndTag(writer);
            titleCell.RenderEndTag(writer);
            writer.RenderEndTag();              //tr
        }
Example #13
0
        protected void UpdateData()
        {
            try
            {
                //Detect Empty Text
                if (this.txtProductName.Text == "")
                {
                    this.lblError.Text    = Localization.GetString("errEmptyName.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }

                string strLead         = txtLead.Text;
                string strCode         = txtCode.Text;
                string strSummary      = txtSummary.Text;
                string straddRichInfo1 = txtaddRichInfo1.Text;
                string straddRichInfo2 = txtaddRichInfo2.Text;
                string straddRichInfo3 = txtaddRichInfo3.Text;
                string strWeight       = txtWeight.Text;
                double fWeight         = -1;
                if (!double.TryParse(strWeight, out fWeight))
                {
                    this.lblError.Text    = Localization.GetString("errFormatWeight.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }
                int    iPrice   = -1;
                string strPrice = txtPrice.Text;
                if (!int.TryParse(strPrice, out iPrice))
                {
                    this.lblError.Text    = Localization.GetString("errFormatPrice.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }
                int    iPriceOld   = -1;
                string strPriceOld = txtPriceOld.Text;
                if (!int.TryParse(strPriceOld, out iPriceOld))
                {
                    this.lblError.Text    = Localization.GetString("errFormatPriceOld.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }
                int    iOrder   = -1;
                string strOrder = txtOrder.Text;
                if (!int.TryParse(strOrder, out iOrder))
                {
                    this.lblError.Text    = Localization.GetString("errFormatOrder.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }

                string strStatusProduct = txtStatusProduct.Text;
                string straddInfo1      = txtaddInfo1.Text;
                string straddInfo2      = txtaddInfo2.Text;
                string straddInfo3      = txtaddInfo3.Text;
                string straddInfo4      = txtaddInfo4.Text;
                string straddInfo5      = txtaddInfo5.Text;
                string straddInfo6      = txtaddInfo6.Text;
                //Detect Role
                if (!((m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.Create) && m_ProductId == -1) || ((m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.EditAfter) || m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.EditAll)) && m_ProductId != -1)))
                {
                    this.lblError.Text = Localization.GetString("errNoRole.Text", this.LocalResourceFile);
                    //this.lblError.Text = m_objRole.HasRole((int)THCore.CoreRole.Create).ToString();
                    this.lblError.Visible = true;
                    return;
                }

                string strSmallimage = "";
                string strLargeimage = "";

                string strImageAdd1 = "";
                string strImageAdd2 = "";
                string strImageAdd3 = "";

                string strFolderName = m_strCategories;

                strSmallimage = DNNRelatedProvider.GetFilePath(urlSmallImage.Url, this.PortalId);
                strLargeimage = DNNRelatedProvider.GetFilePath(urlLargeImage.Url, this.PortalId);
                strImageAdd1  = DNNRelatedProvider.GetFilePath(urlSmallImageImgAdd1.Url, this.PortalId);
                strImageAdd2  = DNNRelatedProvider.GetFilePath(urlSmallImageImgAdd2.Url, this.PortalId);
                strImageAdd3  = DNNRelatedProvider.GetFilePath(urlSmallImageImgAdd3.Url, this.PortalId);

                /*
                 * strFolderName = CategoryProvider.GetDefaultFolderPath(TH.Utils.UIProvider.GetListBoxSelectedItems(",", chkCategoryList), this.PortalId);
                 * if (strFolderName == "" || strFolderName == null || strFolderName.Length == 0)
                 * {
                 *  strFolderName = "Folder";
                 * }
                 * string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 * if (!System.IO.Directory.Exists(strFolderPath))
                 *  strFolderName = m_strFolderName;
                 #region
                 * if (txtSmallimage.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtSmallimage.PostedFile.FileName.Substring(txtSmallimage.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strSmallimage = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtSmallimage.PostedFile, false);
                 *
                 * }
                 * if (strSmallimage == "")
                 *  strSmallimage = txtSmallimageOld.Text;
                 #endregion
                 #region
                 * if (txtLargeimage.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtLargeimage.PostedFile.FileName.Substring(txtLargeimage.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strLargeimage = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtLargeimage.PostedFile, false);
                 * }
                 *
                 * if (strLargeimage == "")
                 *  strLargeimage = txtLargeimageOld.Text;
                 #endregion
                 #region imageAdd1
                 *
                 * if (txtAddImage1.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtAddImage1.PostedFile.FileName.Substring(txtAddImage1.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strImageAdd1 = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtAddImage1.PostedFile, false);
                 * }
                 *
                 * if (strImageAdd1 == "")
                 *  strImageAdd1 = txtImageAdd1Old.Text;
                 #endregion
                 #region imageAdd2
                 *
                 * if (txtAddImage2.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtAddImage2.PostedFile.FileName.Substring(txtAddImage2.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strImageAdd2 = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtAddImage2.PostedFile, false);
                 * }
                 *
                 * if (strImageAdd2 == "")
                 *  strImageAdd2 = txtImageAdd2Old.Text;
                 #endregion
                 #region imageAdd3
                 *
                 * if (txtAddImage3.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtAddImage3.PostedFile.FileName.Substring(txtAddImage3.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strImageAdd3 = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtAddImage3.PostedFile, false);
                 * }
                 *
                 * if (strImageAdd3 == "")
                 *  strImageAdd3 = txtImageAdd3Old.Text;
                 #endregion
                 */
                DateTime ProducedDate;

                ProducedDate = DateTime.ParseExact(txtProducedDate.Text, "dd/MM/yyyy", null);

                DateTime ExpiredDate;
                ExpiredDate = DateTime.ParseExact(txtExpiredDate.Text, "dd/MM/yyyy", null);


                DateTime DisplayDate;
                if (txtDisplayDate.Text == "")
                {
                    DisplayDate = DateTime.Today;
                }
                else
                {
                    DisplayDate = DateTime.ParseExact(txtDisplayDate.Text, "dd/MM/yyyy", null);
                }
                DisplayDate.AddHours(DateTime.Now.Hour);
                DisplayDate.AddMinutes(DateTime.Now.Minute);
                DisplayDate.AddSeconds(DateTime.Now.Second);
                // Get Hot Period
                int intPeriod;
                if (!int.TryParse(this.txtHotPeriod.Text, out intPeriod))
                {
                    intPeriod = 0;
                }
                // DyncmicForm
                string strExtendedSettings = GetValueDynamic(strFolderName);

                m_strCategories = UIProvider.GetListBoxSelectedItems(",", chkCategoryList);
                m_strTags       = UIProvider.GetListBoxSelectedItems(",", chkTags);
                if (m_strCategories.Equals(""))
                {
                    this.lblError.Text    = "Chưa chọn chuyên mục";
                    this.lblError.Visible = true;
                    return;
                }

                //Going into action.
                int result = 1;

                if (m_ProductId == -1)
                {
                    string realProductName = "";
                    realProductName = DataProcessingProvider.RemoveTags(this.txtProductName.Text);
                    result          = ProductProvider.InsertProduct(realProductName, strLead, DataProcessingProvider.RemoveTags(strSummary), strSmallimage, strLargeimage, fWeight, DateTime.Now, ExpiredDate, DateTime.Now, ProducedDate, true, false, chkIsHot.Checked, intPeriod, this.UserId, this.PortalId, false, iPrice, iPriceOld, strStatusProduct, strExtendedSettings, iOrder, m_strCategories, strCode, strImageAdd1, strImageAdd2, strImageAdd3, DisplayDate, straddInfo1, straddInfo2, straddInfo3, straddInfo4, straddInfo5, straddInfo6, DataProcessingProvider.RemoveTags(straddRichInfo1), DataProcessingProvider.RemoveTags(straddRichInfo2), DataProcessingProvider.RemoveTags(straddRichInfo3), m_strTags, 1);

                    if (result > 0)
                    {
                        #region danh dau them moi


                        try
                        {
                            File.WriteAllText(Server.MapPath("/DesktopModules/TH.NUCE.Utils/Configuration/ResetCache.txt"), "1");
                            File.WriteAllText(Server.MapPath("/DesktopModules/TH.NUCE.Utils/Configuration/ResetCache_" + this.PortalId + ".txt"), "1");
                        }
                        catch (Exception ex)
                        {
                        }


                        #endregion

                        LogProvider.InsertLogAction(result, ProductProvider.TypeId, "", this.PortalId, (int)Connection.UtilsProvider.LogAction.Create, this.UserInfo.Username, this.UserId, this.txtProductName.Text, true, m_strCategories);
                    }
                }
                else
                {
                    DateTime CreateDate = DateTime.Parse(txtCreatedDateOld.Text);
                    string   realTitle  = "";
                    realTitle = DataProcessingProvider.RemoveTags(this.txtProductName.Text);
                    ProductProvider.UpdateProduct(m_ProductId, realTitle, strLead, DataProcessingProvider.RemoveTags(strSummary), strSmallimage, strLargeimage, fWeight, CreateDate, ExpiredDate, DateTime.Now, ProducedDate, true, false, chkIsHot.Checked, intPeriod, this.UserId, this.PortalId, false, iPrice, iPriceOld, strStatusProduct, iOrder, strExtendedSettings, m_strCategories, strCode, strImageAdd1, strImageAdd2, strImageAdd3, DisplayDate, straddInfo1, straddInfo2, straddInfo3, straddInfo4, straddInfo5, straddInfo6, DataProcessingProvider.RemoveTags(straddRichInfo1), DataProcessingProvider.RemoveTags(straddRichInfo2), DataProcessingProvider.RemoveTags(straddRichInfo3), m_strTags, 1);
                    result = m_ProductId;
                    if (result > 0)
                    {
                        #region danh dau them moi


                        try
                        {
                            File.WriteAllText(Server.MapPath("/DesktopModules/TH.NUCE.Utils/Configuration/ResetCache.txt"), "1");
                            File.WriteAllText(Server.MapPath("/DesktopModules/TH.NUCE.Utils/Configuration/ResetCache_" + this.PortalId + ".txt"), "1");
                        }
                        catch (Exception ex)
                        {
                        }


                        #endregion

                        LogProvider.InsertLogAction(result, ProductProvider.TypeId, "", this.PortalId, (int)Connection.UtilsProvider.LogAction.Update, this.UserInfo.Username, this.UserId, this.txtProductName.Text, true, m_strCategories);
                    }
                }


                if (result == -2)
                {
                    this.lblError.Text    = Localization.GetString("errSameName.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                }
                else if (result <= 0)
                {
                    this.lblError.Text    = Localization.GetString("errSomeError.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                }
                else
                {
                    JumpBack(false, result);
                }
            }
            catch (Exception ex)
            {
                //this.lblError.Text = ex.GetType().ToString();
                this.lblError.Text    = ex.ToString();
                this.lblError.Visible = true;
            }
        }
Example #14
0
        protected void UpdateData()
        {
            try
            {
                //Detect Empty Text
                if (this.txtTitle.Text == "")
                {
                    this.lblError.Text    = Localization.GetString("errEmptyName.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }

                //string strSummary = txtSummary.Text;


                string strSummary      = DataProcessingProvider.RemoveTags(this.txtSummary.Text);
                string strContent      = DataProcessingProvider.RemoveTags(this.htmlContent.Text);
                string strAddRichInfo1 = DataProcessingProvider.RemoveTags(this.txtAddRichInfo1.Text);
                string strAddRichInfo2 = DataProcessingProvider.RemoveTags(this.txtAddRichInfo2.Text);
                string strAddRichInfo3 = DataProcessingProvider.RemoveTags(this.txtAddRichInfo3.Text);
                bool   blIsOpenNewTab  = chIsUrlWeb.Checked;
                //Detect Role

                if (!((m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.Create) && m_Serviced == -1) || ((m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.EditAfter) || m_objRole.HasRole((int)Connection.UtilsProvider.CoreRole.EditAll)) && m_Serviced != -1)))
                {
                    this.lblError.Text = Localization.GetString("errNoRole.Text", this.LocalResourceFile);
                    //this.lblError.Text = m_objRole.HasRole((int)THCore.CoreRole.Create).ToString();
                    this.lblError.Visible = true;
                    return;
                }

                string strImageFile = "";
                string strAvatar    = "";

                string strFolderName = m_strCategories;
                strFolderName = CategoryProvider.GetDefaultFolderPath(UIProvider.GetListBoxSelectedItems(",", chkCategoryList), this.PortalId);
                if (strFolderName == "" || strFolderName == null || strFolderName.Length == 0)
                {
                    strFolderName = "Folder";
                }
                string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                if (!System.IO.Directory.Exists(strFolderPath))
                {
                    strFolderName = m_strFolderName;
                }

                /*
                 * if (txtImageFile.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtImageFile.PostedFile.FileName.Substring(txtImageFile.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strImageFile = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileProvider.Upload(this.PortalId, strFolderName, strFileName,
                 *      txtImageFile.PostedFile.InputStream);
                 *  //FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtImageFile.PostedFile, false);
                 * }*/
                strImageFile = DNNRelatedProvider.GetFilePath(urlImageFile.Url, this.PortalId);
                if (strImageFile == "")
                {
                    strImageFile = txtImageFileOld.Text;
                }

                /*
                 * if (txtAvatar.PostedFile.FileName.Length != 0) //&& chkUseImage.Checked
                 * {
                 *  string strFileName = txtAvatar.PostedFile.FileName.Substring(txtAvatar.PostedFile.FileName.LastIndexOf(@"\") + 1);
                 *  strAvatar = string.Format("{0}{1}", strFolderName, strFileName);
                 *  string strParentFolder = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, strFolderName);
                 *  FileProvider.Upload(this.PortalId, strFolderName, strFileName,
                 *      txtAvatar.PostedFile.InputStream);
                 * // FileSystemUtils.UploadFile(strParentFolder.Replace("/", @"\"), txtAvatar.PostedFile, false);
                 * }*/
                strAvatar = DNNRelatedProvider.GetFilePath(urlAvatar.Url, this.PortalId);
                if (strAvatar == "")
                {
                    strAvatar = txtAvatarOld.Text;
                }

                int    iOrder   = -1;
                string strOrder = txtOrder.Text;
                if (!int.TryParse(strOrder, out iOrder))
                {
                    this.lblError.Text    = Localization.GetString("errFormatOrder.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                    return;
                }

                DateTime ExpiredDate;
                ExpiredDate = DateTime.ParseExact(txtExpiredDate.Text, "dd/MM/yyyy", null);


                DateTime DisplayDate;
                if (txtDisplayDate.Text == "")
                {
                    DisplayDate = DateTime.Today;
                }
                else
                {
                    DisplayDate = DateTime.ParseExact(txtDisplayDate.Text, "dd/MM/yyyy", null);
                }


                DisplayDate.AddHours(DateTime.Now.Hour);
                DisplayDate.AddMinutes(DateTime.Now.Minute);
                DisplayDate.AddSeconds(DateTime.Now.Second);



                // Get Hot Period
                int intPeriod;
                if (!int.TryParse(this.txtHotPeriod.Text, out intPeriod))
                {
                    intPeriod = 0;
                }

                m_strCategories = UIProvider.GetListBoxSelectedItems(",", chkCategoryList);
                if (m_strCategories.Equals(""))
                {
                    this.lblError.Text    = "Chưa chọn chuyên mục";
                    this.lblError.Visible = true;
                    return;
                }

                string strAddInfo1 = txtAddInfo1.Text;
                string strAddInfo2 = txtAddInfo2.Text;
                string strAddInfo3 = txtAddInfo3.Text;
                string strAddInfo4 = txtAddInfo4.Text;
                string strAddInfo5 = txtAddInfo5.Text;
                //Going into action.
                int result = 1;

                if (m_Serviced == -1)
                {
                    string realTitle = "";
                    realTitle = DataProcessingProvider.RemoveTags(this.txtTitle.Text);
                    result    = ServiceProvider.InsertImage(realTitle, strSummary, strImageFile, strAvatar, blIsOpenNewTab, strContent, DateTime.Now, ExpiredDate, DisplayDate, DateTime.Now, this.UserId, chkIsHot.Checked, intPeriod, this.PortalId, false, iOrder, m_strCategories, strAddInfo1, strAddInfo2, strAddInfo3, strAddInfo4, strAddInfo5, strAddRichInfo1, strAddRichInfo2, strAddRichInfo3);
                    if (result > 0)
                    {
                        LogProvider.InsertLogAction(result, ServiceProvider.TypeId, "", this.PortalId, (int)Connection.UtilsProvider.LogAction.Create, this.UserInfo.Username, this.UserId, realTitle, true, m_strCategories);
                    }
                }
                else
                {
                    string realTitle = "";
                    realTitle = DataProcessingProvider.RemoveTags(this.txtTitle.Text);
                    DateTime CreateDate = DateTime.Parse(txtCreatedDateOld.Text);
                    //ServiceProvider.UpdateImage(m_Serviced, txtTitleOld.Text, strSummary, strImageFile, strAvatar, blIsOpenNewTab, strContent, CreateDate, ExpiredDate, DisplayDate, DateTime.Now, this.UserId, chkIsHot.Checked, intPeriod, this.PortalId, false, iOrder, TH.Utils.UIProvider.GetListBoxSelectedItems(",", chkCategoryList));
                    ServiceProvider.UpdateImage(m_Serviced, realTitle, strSummary, strImageFile, strAvatar, blIsOpenNewTab, strContent, CreateDate, ExpiredDate, DisplayDate, DateTime.Now, this.UserId, chkIsHot.Checked, intPeriod, this.PortalId, false, iOrder, m_strCategories, strAddInfo1, strAddInfo2, strAddInfo3, strAddInfo4, strAddInfo5, strAddRichInfo1, strAddRichInfo2, strAddRichInfo3);
                    result = m_Serviced;
                    if (result > 0)
                    {
                        LogProvider.InsertLogAction(result, ServiceProvider.TypeId, "", this.PortalId, (int)Connection.UtilsProvider.LogAction.Update, this.UserInfo.Username, this.UserId, this.txtTitleOld.Text, true, m_strCategories);
                    }
                }


                if (result == -2)
                {
                    this.lblError.Text    = Localization.GetString("errSameName.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                }
                else if (result <= 0)
                {
                    this.lblError.Text    = Localization.GetString("errSomeError.Text", this.LocalResourceFile);
                    this.lblError.Visible = true;
                }
                else
                {
                    JumpBack(false, result);
                }
            }
            catch (Exception ex)
            {
                this.lblError.Text    = ex.GetType().ToString();
                this.lblError.Visible = true;
            }
        }
Example #15
0
 private void UpdateYearMonthLabel()
 {
     YearMonthLabel = DisplayDate.ToString("Y", DateTimeFormatInfo);
 }
Example #16
0
 private void UpdateYearLabel()
 {
     YearLabel = DisplayDate.ToString("yyyy", DateTimeFormatInfo);
 }
Example #17
0
 private MonthSorter <FrameworkElement> CalendarBarSorter(
     Func <FrameworkElement, int, int, double, double> target) =>
 new MonthSorter <FrameworkElement>(DisplayDate.FirstDayOnCalendar(), 22.0,
                                    i => (CalendarBar)(i.DataContext), target);
Example #18
0
 public IClickToDayComputer ClickToDayComputer() =>
 new ClickToDayComputer(DisplayDate.FirstDayOnCalendar(), ActualWidth, rowHeights);