Example #1
0
        public ProductsController(ILogger <ProductsController> logger)
        {
            dbGet  = new DataGetter();
            dbEdit = new DateEditor();

            _logger = logger;
        }
Example #2
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         DateEditor.Dispose();
     }
     base.Dispose(disposing);
 }
 public static void SetDateTime(DateEditor frmDateeditor, DateEditor todateeditor)
 {
     if (frmDateeditor.Text == string.Empty)
     {
         DefaultFromDate = DateTime.MinValue;
     }
     else
     {
         DefaultFromDate = frmDateeditor.DateTime.Date;
     }
     if (todateeditor.Text == string.Empty)
     {
         DefaultToDate = DateTime.MinValue;
     }
     else
     {
         DefaultToDate = todateeditor.DateTime.Date;
     }
 }
Example #4
0
        private void setDateTime(object sender, string valueFor)
        {
            DateEditor de = (DateEditor)sender;

            if (de.EditValue == null || de.DateTime == DateTime.MinValue)
            {
                SelectedCriteria ob = (SelectedCriteria)this.DataContext;
                if (valueFor == "FromDate")
                {
                    ob.frmdateval = BasePage.GetSystemDefaultDate();
                    de.EditValue  = null;
                }
                if (valueFor == "ToDate")
                {
                    ob.todateval = BasePage.GetSystemDefaultDate();
                    de.EditValue = null;
                }
            }
        }
Example #5
0
        public static void SetDateTime(DateEditor frmDateeditor, DateEditor todateeditor)
        {
            var now = BasePage.GetSystemDefaultDate();

            if (frmDateeditor.Text == string.Empty)
            {
                var fromDate = new DateTime(now.Year, now.Month, 1);
                fromDate        = fromDate.AddMonths(-1);
                DefaultFromDate = fromDate;
            }
            else
            {
                DefaultFromDate = frmDateeditor.DateTime.Date;
            }

            if (todateeditor.Text == string.Empty)
            {
                DefaultToDate = DefaultFromDate.AddMonths(1).AddDays(-1);
            }
            else
            {
                DefaultToDate = todateeditor.DateTime.Date;
            }
        }
Example #6
0
        private void DateEditor_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
        {
            DateEditor de = (DateEditor)sender;

            ItemRateAfterDate.IsEnabled = ItemRate2AfterDate.IsEnabled = de.EditValue == null ? false : true;
        }
Example #7
0
        protected override void CreateChildControls()
        {
            Panel container = new Panel();

            container.CssClass = this.CssClass;
            Controls.Add(container);
            Panel header = new Panel();

            header.CssClass = "pHead";
            container.Controls.Add(header);
            headerText = new Literal();
            header.Controls.Add(headerText);
            Panel content = new Panel();

            content.CssClass = "pContent";
            container.Controls.Add(content);
            #region Tab Strip

            tabstrip = new ComponentArt.Web.UI.TabStrip();

            // Create the DefaultTabLook instance and add it to the ItemLooks collection
            ComponentArt.Web.UI.ItemLook defaultTabLook = new ComponentArt.Web.UI.ItemLook();
            defaultTabLook.LookId             = "DefaultTabLook";
            defaultTabLook.CssClass           = "DefaultTab";
            defaultTabLook.HoverCssClass      = "DefaultTabHover";
            defaultTabLook.LabelPaddingLeft   = Unit.Parse("10");
            defaultTabLook.LabelPaddingRight  = Unit.Parse("10");
            defaultTabLook.LabelPaddingTop    = Unit.Parse("5");
            defaultTabLook.LabelPaddingBottom = Unit.Parse("4");
            defaultTabLook.LeftIconUrl        = "tab_left_icon.gif";
            defaultTabLook.RightIconUrl       = "tab_right_icon.gif";
            defaultTabLook.HoverLeftIconUrl   = "hover_tab_left_icon.gif";
            defaultTabLook.HoverRightIconUrl  = "hover_tab_right_icon.gif";
            defaultTabLook.LeftIconWidth      = Unit.Parse("3");
            defaultTabLook.LeftIconHeight     = Unit.Parse("21");
            defaultTabLook.RightIconWidth     = Unit.Parse("3");
            defaultTabLook.RightIconHeight    = Unit.Parse("21");
            tabstrip.ItemLooks.Add(defaultTabLook);

            // Create the SelectedTabLook instance and add it to the ItemLooks collection
            ComponentArt.Web.UI.ItemLook selectedTabLook = new ComponentArt.Web.UI.ItemLook();
            selectedTabLook.LookId             = "SelectedTabLook";
            selectedTabLook.CssClass           = "SelectedTab";
            selectedTabLook.LabelPaddingLeft   = Unit.Parse("10");
            selectedTabLook.LabelPaddingRight  = Unit.Parse("10");
            selectedTabLook.LabelPaddingTop    = Unit.Parse("5");
            selectedTabLook.LabelPaddingBottom = Unit.Parse("4");
            selectedTabLook.LeftIconUrl        = "selected_tab_left_icon.gif";
            selectedTabLook.RightIconUrl       = "selected_tab_right_icon.gif";
            selectedTabLook.LeftIconWidth      = Unit.Parse("3");
            selectedTabLook.LeftIconHeight     = Unit.Parse("21");
            selectedTabLook.RightIconWidth     = Unit.Parse("3");
            selectedTabLook.RightIconHeight    = Unit.Parse("21");
            tabstrip.ItemLooks.Add(selectedTabLook);

            tabstrip.ID                        = this.ID + "_TabStrip";
            tabstrip.CssClass                  = "TopGroup";
            tabstrip.DefaultItemLookId         = "DefaultTabLook";
            tabstrip.DefaultSelectedItemLookId = "SelectedTabLook";
            tabstrip.DefaultGroupTabSpacing    = 1;
            tabstrip.ImagesBaseUrl             = "tabstrip_images/";
            tabstrip.MultiPageId               = this.ID + "_MultiPage";
            // tabstrip.EnableViewState = false;  // ComponentArt ComboBox does not yet work with ViewState off!
            content.Controls.Add(tabstrip);

            #endregion

            #region MultiPage

            multipage          = new ComponentArt.Web.UI.MultiPage();
            multipage.ID       = this.ID + "_MultiPage";
            multipage.CssClass = "MultiPage";
            // multipage.EnableViewState = false; // ComponentArt ComboBox does not yet work with ViewState off!
            content.Controls.Add(multipage);

            #endregion

            #region Child Controls for General Folder

            ComponentArt.Web.UI.PageView GeneralView = new ComponentArt.Web.UI.PageView();
            GeneralView.CssClass = "PageContent";
            multipage.PageViews.Add(GeneralView);

            TabStripTab GeneralTab = new TabStripTab();
            GeneralTab.Text       = "General";
            GeneralTab.PageViewId = GeneralView.ID;
            tabstrip.Tabs.Add(GeneralTab);

            comboMember                      = new ComponentArt.Web.UI.ComboBox();
            comboMember.ID                   = "comboMember";
            comboMember.CssClass             = "comboBox";
            comboMember.HoverCssClass        = "comboBoxHover";
            comboMember.FocusedCssClass      = "comboBoxHover";
            comboMember.TextBoxCssClass      = "comboTextBox";
            comboMember.DropDownCssClass     = "comboDropDown";
            comboMember.ItemCssClass         = "comboItem";
            comboMember.ItemHoverCssClass    = "comboItemHover";
            comboMember.SelectedItemCssClass = "comboItemHover";
            comboMember.DropHoverImageUrl    = "combobox_images/drop_hover.gif";
            comboMember.DropImageUrl         = "combobox_images/drop.gif";
            comboMember.Width                = Unit.Pixel(300);
            // comboMember.EnableViewState = false;      // This is not  yet possible, ComponentArt's ComboBox Requires ViewState!!!
            registerControl(GeneralView, "Member", comboMember);

            deStartDate                 = new DateEditor();
            deStartDate.ID              = this.ID + "_de";
            deStartDate.AutoAdjust      = true;
            deStartDate.EnableViewState = false;
            registerControl(GeneralView, "StartDate", deStartDate);

            deEndDate                 = new DateEditor();
            deStartDate.ID            = this.ID + "_de";
            deStartDate.AutoAdjust    = true;
            deEndDate.EnableViewState = false;
            registerControl(GeneralView, "EndDate", deEndDate);

            comboOrganization                      = new ComponentArt.Web.UI.ComboBox();
            comboOrganization.ID                   = "comboOrganization";
            comboOrganization.CssClass             = "comboBox";
            comboOrganization.HoverCssClass        = "comboBoxHover";
            comboOrganization.FocusedCssClass      = "comboBoxHover";
            comboOrganization.TextBoxCssClass      = "comboTextBox";
            comboOrganization.DropDownCssClass     = "comboDropDown";
            comboOrganization.ItemCssClass         = "comboItem";
            comboOrganization.ItemHoverCssClass    = "comboItemHover";
            comboOrganization.SelectedItemCssClass = "comboItemHover";
            comboOrganization.DropHoverImageUrl    = "combobox_images/drop_hover.gif";
            comboOrganization.DropImageUrl         = "combobox_images/drop.gif";
            comboOrganization.Width                = Unit.Pixel(300);
            // comboOrganization.EnableViewState = false;      // This is not  yet possible, ComponentArt's ComboBox Requires ViewState!!!
            registerControl(GeneralView, "Organization", comboOrganization);

            tbOrganizationMemberID    = new TextBox();
            tbOrganizationMemberID.ID = "tbOrganizationMemberID";
            tbOrganizationMemberID.EnableViewState = false;
            registerControl(GeneralView, "OrganizationMemberID", tbOrganizationMemberID);

            ddParent    = new DropDownList();
            ddParent.ID = "ddParent";
            ddParent.EnableViewState = false;
            registerControl(GeneralView, "Parent Membership", ddParent);

            comboMemberTypeTemplate                      = new ComponentArt.Web.UI.ComboBox();
            comboMemberTypeTemplate.ID                   = "comboMemberTypeTemplate";
            comboMemberTypeTemplate.CssClass             = "comboBox";
            comboMemberTypeTemplate.HoverCssClass        = "comboBoxHover";
            comboMemberTypeTemplate.FocusedCssClass      = "comboBoxHover";
            comboMemberTypeTemplate.TextBoxCssClass      = "comboTextBox";
            comboMemberTypeTemplate.DropDownCssClass     = "comboDropDown";
            comboMemberTypeTemplate.ItemCssClass         = "comboItem";
            comboMemberTypeTemplate.ItemHoverCssClass    = "comboItemHover";
            comboMemberTypeTemplate.SelectedItemCssClass = "comboItemHover";
            comboMemberTypeTemplate.DropHoverImageUrl    = "combobox_images/drop_hover.gif";
            comboMemberTypeTemplate.DropImageUrl         = "combobox_images/drop.gif";
            comboMemberTypeTemplate.Width                = Unit.Pixel(300);
            // comboMemberTypeTemplate.EnableViewState = false;      // This is not  yet possible, ComponentArt's ComboBox Requires ViewState!!!
            registerControl(GeneralView, "Parent Template Group", comboMemberTypeTemplate);

            comboMembershipTemplate                      = new ComponentArt.Web.UI.ComboBox();
            comboMembershipTemplate.ID                   = "comboMembershipTemplate";
            comboMembershipTemplate.CssClass             = "comboBox";
            comboMembershipTemplate.HoverCssClass        = "comboBoxHover";
            comboMembershipTemplate.FocusedCssClass      = "comboBoxHover";
            comboMembershipTemplate.TextBoxCssClass      = "comboTextBox";
            comboMembershipTemplate.DropDownCssClass     = "comboDropDown";
            comboMembershipTemplate.ItemCssClass         = "comboItem";
            comboMembershipTemplate.ItemHoverCssClass    = "comboItemHover";
            comboMembershipTemplate.SelectedItemCssClass = "comboItemHover";
            comboMembershipTemplate.DropHoverImageUrl    = "combobox_images/drop_hover.gif";
            comboMembershipTemplate.DropImageUrl         = "combobox_images/drop.gif";
            comboMembershipTemplate.Width                = Unit.Pixel(300);
            // comboMembershipTemplate.EnableViewState = false;      // This is not  yet possible, ComponentArt's ComboBox Requires ViewState!!!
            registerControl(GeneralView, "Parent Template", comboMembershipTemplate);

            ltSessionID = new Literal();
            registerControl(GeneralView, "SessionID", ltSessionID);

            tbFee    = new TextBox();
            tbFee.ID = "tbFee";
            tbFee.EnableViewState = false;
            reqFee    = new RequiredFieldValidator();
            reqFee.ID = "reqFee";
            reqFee.ControlToValidate = tbFee.ID;
            reqFee.ErrorMessage      = "*";
            reqFee.Display           = ValidatorDisplay.Dynamic;
            rngFee    = new RangeValidator();
            rngFee.ID = "rngFee";
            rngFee.ControlToValidate = tbFee.ID;
            rngFee.ErrorMessage      = "*";
            rngFee.Display           = ValidatorDisplay.Dynamic;
            rngFee.Type         = ValidationDataType.Double;
            rngFee.MinimumValue = "0";
            rngFee.MaximumValue = "79228162514264337593543950335";
            registerControl(GeneralView, "Fee", tbFee, reqFee, rngFee);

            ltPriorMembership = new Literal();
            registerControl(GeneralView, "PriorMembership", ltPriorMembership);

            tbPaymentAmount    = new TextBox();
            tbPaymentAmount.ID = "tbPaymentAmount";
            tbPaymentAmount.EnableViewState = false;
            reqPaymentAmount    = new RequiredFieldValidator();
            reqPaymentAmount.ID = "reqPaymentAmount";
            reqPaymentAmount.ControlToValidate = tbPaymentAmount.ID;
            reqPaymentAmount.ErrorMessage      = "*";
            reqPaymentAmount.Display           = ValidatorDisplay.Dynamic;
            rngPaymentAmount    = new RangeValidator();
            rngPaymentAmount.ID = "rngPaymentAmount";
            rngPaymentAmount.ControlToValidate = tbPaymentAmount.ID;
            rngPaymentAmount.ErrorMessage      = "*";
            rngPaymentAmount.Display           = ValidatorDisplay.Dynamic;
            rngPaymentAmount.Type         = ValidationDataType.Double;
            rngPaymentAmount.MinimumValue = "0";
            rngPaymentAmount.MaximumValue = "79228162514264337593543950335";
            registerControl(GeneralView, "PaymentAmount", tbPaymentAmount, reqPaymentAmount, rngPaymentAmount);

            cbIsProRated    = new CheckBox();
            cbIsProRated.ID = "cbIsProRated";
            cbIsProRated.EnableViewState = false;
            registerControl(GeneralView, "IsProRated", cbIsProRated);

            #endregion

            #region Child Controls for Rappahanock Folder

            ComponentArt.Web.UI.PageView RappahanockView = new ComponentArt.Web.UI.PageView();
            RappahanockView.CssClass = "PageContent";
            multipage.PageViews.Add(RappahanockView);

            TabStripTab RappahanockTab = new TabStripTab();
            RappahanockTab.Text       = "Rappahanock";
            RappahanockTab.PageViewId = RappahanockView.ID;
            tabstrip.Tabs.Add(RappahanockTab);

            ddInvoiceLine    = new DropDownList();
            ddInvoiceLine.ID = "ddInvoiceLine";
            ddInvoiceLine.EnableViewState = false;
            registerControl(RappahanockView, "InvoiceLine", ddInvoiceLine);

            #endregion

            Panel buttons = new Panel();
            buttons.CssClass = "pButtons";
            content.Controls.Add(buttons);

            btOk                 = new Button();
            btOk.Text            = "OK";
            btOk.Width           = Unit.Pixel(72);
            btOk.EnableViewState = false;
            btOk.Click          += new EventHandler(ok_Click);
            buttons.Controls.Add(btOk);

            btCancel                  = new Button();
            btCancel.Text             = "Cancel";
            btCancel.Width            = Unit.Pixel(72);
            btCancel.EnableViewState  = false;
            btCancel.CausesValidation = false;
            btCancel.Click           += new EventHandler(cancel_Click);
            buttons.Controls.Add(btCancel);

            btDelete                 = new Button();
            btDelete.Text            = "Delete";
            btDelete.Width           = Unit.Pixel(72);
            btDelete.EnableViewState = false;
            btDelete.Click          += new EventHandler(delete_Click);
            buttons.Controls.Add(btDelete);

            bind();
            ChildControlsCreated = true;
        }
Example #8
0
        protected virtual EditorItem GetEditorItem(CustomDataType type, string custom, PropertyInfo property)
        {
            RequiredAttribute required = property.GetCustomAttributes(typeof(RequiredAttribute), true).FirstOrDefault() as RequiredAttribute;
            EditorItem        item;

            switch (type)
            {
            case CustomDataType.Boolean:
                item = new BoolEditor(Frame);
                break;

            case CustomDataType.Currency:
                item = new CurrencyEditor(Frame);
                break;

            case CustomDataType.Date:
                item = new DateEditor(Frame);
                break;

            case CustomDataType.DateTime:
                item = new DateTimeEditor(Frame);
                break;

            case CustomDataType.Default:
                item = new DefaultEditor(Frame);
                if (required != null)
                {
                    ((DefaultEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
                }
                break;

            case CustomDataType.EmailAddress:
                item = new EmailAddressEditor(Frame);
                break;

            case CustomDataType.Html:
                item = new HtmlEditor(Frame);
                break;

            case CustomDataType.ImageUrl:
                item = new ImageUrlEditor(Frame);
                break;

            case CustomDataType.Image:
                item = new ImageEditor(Frame);
                break;

            case CustomDataType.Integer:
                item = new IntegerEditor(Frame);
                break;

            case CustomDataType.MultilineText:
                item = new MultilineTextEditor(Frame);
                if (required != null)
                {
                    ((MultilineTextEditor)item).IsAllowdEmpty = required.AllowEmptyStrings;
                }
                break;

            case CustomDataType.Number:
                item = new NumberEditor(Frame);
                break;

            case CustomDataType.Password:
                item = new PasswordEditor(Frame);
                break;

            case CustomDataType.PhoneNumber:
                item = new PhoneNumberEditor(Frame);
                break;

            case CustomDataType.Sex:
                item = new SexEditor(Frame);
                break;

            case CustomDataType.Text:
                item = new DefaultEditor(Frame);
                break;

            case CustomDataType.Time:
                item = new TimeEditor(Frame);
                break;

            case CustomDataType.Url:
                item = new UrlEditor(Frame);
                break;

            default:
                switch (custom)
                {
                case "Enum":
                    item = GetEnumEditorItem(property.PropertyType);
                    break;

                case "Entity":
                    item = new EntityEditor(Frame, property.PropertyType);
                    break;

                case "Collection":
                    item = new CollectionEditor(Frame, property.PropertyType.GetGenericArguments()[0]);
                    break;

                default:
                    throw new NotSupportedException("不支持自定义类型编辑器。");
                }
                break;
            }
            if (required != null)
            {
                item.IsRequired = true;
            }
            return(item);
        }