Exemple #1
0
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
            #region Request
            m_Serviced = DataProcessingProvider.GetProcessedInt(Request.QueryString["ServiceId"]);
            m_preTabId = DataProcessingProvider.GetProcessedInt(Request.QueryString["PreTabId"]);
            if (m_Serviced == -1)
            {
                m_strCategories = DataProcessingProvider.GetProcessedString(Request.QueryString["Categories"]);
                if (m_strCategories == "")
                {
                    m_strCategories = ",-1,";
                }
                else
                {
                    m_strCategories = DataProcessingProvider.GetProcessedBatchString(m_strCategories);
                }
            }
            else
            {
                m_strCategories = CategoryProvider.GetItemCategoryString(m_Serviced, ServiceProvider.TypeId);
            }

            #endregion

            #region Settings
            //Load Folder
            m_strFolderName = CategoryProvider.GetDefaultFolderPath(m_strCategories, this.PortalId);
            if (m_strFolderName == "")
            {
                m_strFolderName = (string)Settings[ServiceInsertSettings.FOLDER_IMAGE_KEY];
                if (m_strFolderName == null || m_strFolderName.Length == 0)
                {
                    m_strFolderName = ServiceInsertSettings.FOLDER_IMAGE_DEFAULT;
                }
            }
            string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, m_strFolderName);
            if (!System.IO.Directory.Exists(strFolderPath))
            {
                m_strFolderName = ServiceInsertSettings.FOLDER_IMAGE_DEFAULT;
            }

            m_strExtension = LoadStringSetting(ServiceInsertSettings.EXTENSTION_KEY, ServiceInsertSettings.EXTENSTION_VALUE_DEFAULT);
            m_linkUpload   = LoadStringSetting(ServiceInsertSettings.LINKUPLOAD_KEY, ServiceInsertSettings.LINKUPLOAD_VALUE_DEFAULT);
            #endregion

            #region Datetime

            lnkExpiredDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtExpiredDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy");
            //Điền dữ liệu vào các control
            imgExpiredDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath);

            lnkDisplayDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtDisplayDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy");
            //Điền dữ liệu vào các control
            imgDisplayDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath);
            #endregion

            #region Register

            DotNetNuke.UI.Skins.Skin objParentSkin = DotNetNuke.UI.Skins.Skin.GetParentSkin(this);
            if (objParentSkin != null)
            {
                objParentSkin.RegisterModuleActionEvent(this.ModuleId, new ActionEventHandler(ModuleAction_Click));
            }
            if (m_Serviced == -1)
            {
                m_objRole = new Role(this.UserId, GetSuperMode(), this.PortalId, ServiceProvider.TypeId);
            }
            else
            {
                m_objRole = new Role(this.UserId, m_Serviced, GetSuperMode(), this.PortalId, ServiceProvider.TypeId);
            }
            #endregion
        }
Exemple #2
0
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
            #region Request
            m_ProductId = DataProcessingProvider.GetProcessedInt(Request.QueryString["ProductId"]);
            m_preTabId  = DataProcessingProvider.GetProcessedInt(Request.QueryString["PreTabId"]);
            m_strTags   = ",";
            if (m_ProductId == -1)
            {
                m_strCategories = DataProcessingProvider.GetProcessedString(Request.QueryString["Categories"]);
                if (m_strCategories == "")
                {
                    m_strCategories = ",-1,";
                }
                else
                {
                    m_strCategories = DataProcessingProvider.GetProcessedBatchString(m_strCategories);
                }
            }
            else
            {
                DataTable dtTags = DotNetNuke.Data.DataProvider.Instance().ExecuteDataSet("THCore_CM_GetItemTags", m_ProductId, ProductProvider.TypeId).Tables[0];
                if (dtTags.Rows.Count > 0)
                {
                    for (int i = 0; i < dtTags.Rows.Count; i++)
                    {
                        m_strTags = m_strTags + dtTags.Rows[i][0].ToString() + ",";
                    }
                }
                m_strCategories = CategoryProvider.GetItemCategoryString(m_ProductId, ProductProvider.TypeId);
            }
            //Dynamic Form
            string[] arrCategories = m_strCategories.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            int      iCategory     = -1;
            int.TryParse(arrCategories[0].Trim(), out iCategory);

            m_strExtension = LoadStringSetting(ProductInsertSettings.EXTENSTION_KEY, ProductInsertSettings.EXTENSTION_VALUE_DEFAULT);
            //string strExtendedSettings = CategoryProvider.GetExtendedSettings(iCategory);
            string strExtendedSettings = m_strExtension;

            dtConfig = new DataTable();
            dtConfig = XMLProvider.XmlString2DataTable(strExtendedSettings);
            try
            {
                if (dtConfig != null && dtConfig.Rows.Count > 0)
                {
                    CreateDynamicForm(dtConfig);
                }
            }
            catch (Exception ex)
            {
                lblError.Text         = ex.Message;
                this.lblError.Visible = true;
            }
            #endregion
            #region Settings
            //Load Folder
            m_strFolderName = CategoryProvider.GetDefaultFolderPath(m_strCategories, this.PortalId);
            if (m_strFolderName == "")
            {
                m_strFolderName = (string)Settings[ProductInsertSettings.FOLDER_IMAGE_KEY];
                if (m_strFolderName == null || m_strFolderName.Length == 0)
                {
                    m_strFolderName = ProductInsertSettings.FOLDER_IMAGE_DEFAULT;
                }
            }
            string strFolderPath = string.Format("{0}{1}", PortalSettings.HomeDirectoryMapPath, m_strFolderName);
            if (!System.IO.Directory.Exists(strFolderPath))
            {
                m_strFolderName = ProductInsertSettings.FOLDER_IMAGE_DEFAULT;
            }


            #endregion
            #region Datetime
            lnkExpiredDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtExpiredDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy");
            //Điền dữ liệu vào các control
            imgExpiredDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath);

            lnkProducedDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtProducedDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy");
            //Điền dữ liệu vào các control
            imgProducedDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath);

            lnkDisplayDate.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCal(txtDisplayDate).Replace("M/d/yyyy", "MM/dd/yyyy").Replace("d/MM/yyyy", "dd/MM/yyyy").Replace("MM/dd/yyyy", "dd/MM/yyyy");
            //Điền dữ liệu vào các control
            imgDisplayDate.ImageUrl = string.Format("{0}/images/calendar.png", this.ModulePath);



            #endregion
            #region Register
            DotNetNuke.UI.Skins.Skin objParentSkin = DotNetNuke.UI.Skins.Skin.GetParentSkin(this);
            if (objParentSkin != null)
            {
                objParentSkin.RegisterModuleActionEvent(this.ModuleId, new ActionEventHandler(ModuleAction_Click));
            }
            if (m_ProductId == -1)
            {
                m_objRole = new Role(this.UserId, GetSuperMode(), this.PortalId, ProductProvider.TypeId);
            }
            else
            {
                m_objRole = new Role(this.UserId, m_ProductId, GetSuperMode(), this.PortalId, ProductProvider.TypeId);
            }
            #endregion
        }