private int AddData()
        {
            int    SkinPackage_ID = Convert.ToInt32(ddlPackageList.SelectedValue);
            string ControlKey     = txtControlKey.Text;

            HttpPostedFile File_ControlSrc = FileInput.PostedFile;
            string         ControlSrc      = "";

            if ((File_ControlSrc != null) && (File_ControlSrc.ContentLength > 0))
            {
                ControlSrc = System.IO.Path.GetDirectoryName(File_ControlSrc.FileName);
            }


            /*** UPLOAD *************************************************************************************************************/
            HttpPostedFile icon_file = FileInput.PostedFile;
            string         IconFile  = "";

            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                IconFile = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                string savePath = Path.Combine(skin_img_path, IconFile);
                icon_file.SaveAs(savePath);
            }
            /************************************************************************************************************************/

            SkinControl skin_control_obj = new SkinControl();
            int         i = skin_control_obj.Insert(SkinPackage_ID, ControlKey, ControlSrc, IconFile);

            return(i);
        }
예제 #2
0
        private int AddData()
        {
            string userid      = Session["UserId"].ToString();
            int    portalid    = Convert.ToInt32(ddlPortalList.SelectedValue);
            int    typeid      = Convert.ToInt32(ddlMediaTypeList.SelectedValue);
            string title       = txtTitle.Text;
            string description = txtDescription.Text;

            /*** UPLOAD *************************************************************************************************************/
            string         dir_path    = "~/" + System.Configuration.ConfigurationManager.AppSettings["upload_background_audio_dir"];
            HttpPostedFile posted_file = FileInput.PostedFile;
            string         filename    = "";

            if (posted_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                filename = module_obj.GetEncodeString(System.IO.Path.GetFileName(posted_file.FileName));
                string savePath = Server.MapPath(dir_path + "/" + filename);
                posted_file.SaveAs(savePath);
            }
            /************************************************************************************************************************/

            MediaFiles media_obj = new MediaFiles();
            //int i = media_obj.Insert(userid,portalid,typeid,filename, title, description);
            int i = 0;

            return(i);
        }
예제 #3
0
        private int UpdateData()
        {
            int    PortalId             = Convert.ToInt32(ddlPortalList.SelectedValue);
            string SkinType             = ddlSkinTypeList.SelectedValue;
            string SkinName             = txtSkinName.Text;
            string LastModifiedByUserId = Session["UserId"].ToString();

            /*** UPLOAD *************************************************************************************************************/
            string         SkinIcon = string.Empty;
            string         upload_image_physical_path = Server.MapPath(upload_image_dir);
            HttpPostedFile icon_file = FileInput.PostedFile;

            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                module_obj.deleteFile(ViewState["SkinIcon"].ToString(), upload_image_physical_path);

                SkinIcon = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                string savePath = System.IO.Path.Combine(upload_image_physical_path, SkinIcon);
                icon_file.SaveAs(savePath);
            }
            else
            {
                SkinIcon = ViewState["SkinIcon"].ToString();
            }
            /************************************************************************************************************************/

            SkinPackages skin_package_obj = new SkinPackages();
            int          i = skin_package_obj.Update(_idx, PortalId, SkinName, SkinType, SkinIcon, LastModifiedByUserId);

            return(i);
        }
        private int UpdateData()
        {
            int    SkinPackage_ID = Convert.ToInt32(ddlPackageList.SelectedValue);
            string ControlKey     = txtControlKey.Text;

            HttpPostedFile File_ControlSrc = FileInput.PostedFile;
            string         ControlSrc      = "";

            if ((File_ControlSrc != null) && (File_ControlSrc.ContentLength > 0))
            {
                ControlSrc = System.IO.Path.GetDirectoryName(File_ControlSrc.FileName);
            }
            else
            {
                ControlSrc = txtControlSrc.Text;
            }


            /*** UPLOAD *************************************************************************************************************/
            string         physical_path = Server.MapPath(skin_img_path);
            HttpPostedFile icon_file     = FileInput.PostedFile;
            string         IconFile      = "";

            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                module_obj.deleteFile(ViewState["IconFile"].ToString(), physical_path);

                IconFile = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                string savePath = Path.Combine(physical_path, IconFile);
                icon_file.SaveAs(savePath);
            }
            else
            {
                IconFile = ViewState["IconFile"].ToString();
            }
            /************************************************************************************************************************/

            SkinControl skin_control_obj = new SkinControl();
            int         i = skin_control_obj.Update(_idx, SkinPackage_ID, ControlKey, ControlSrc, IconFile);

            return(i);
        }
        private int UpdateData()
        {
            int    SkinPackage_ID              = Convert.ToInt32(ddlPackageList.SelectedValue);
            string SkinBackground_Name         = txtTitle.Text;
            string SkinBackground_Url          = txtUrl.Text;
            bool   bStatus                     = ChkBoxStatus.Checked;
            int    SkinBackground_Discontinued = 0;

            if (bStatus == true)
            {
                SkinBackground_Discontinued = 1;
            }
            else
            {
                SkinBackground_Discontinued = 0;
            }


            /*** UPLOAD *************************************************************************************************************/
            string         dir_path  = "~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/background_images/";
            HttpPostedFile icon_file = FileInput.PostedFile;
            string         SkinBackground_FileName = "";

            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                module_obj.deleteFile(txtFileName.Text, dir_path);

                SkinBackground_FileName = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                string savePath = Server.MapPath(dir_path + SkinBackground_FileName);
                icon_file.SaveAs(savePath);
            }
            else
            {
                SkinBackground_FileName = txtFileName.Text;
            }
            /************************************************************************************************************************/

            SkinBackgrounds background_obj = new SkinBackgrounds();
            int             i = background_obj.Update(_idx, SkinPackage_ID, SkinBackground_Name, SkinBackground_FileName, SkinBackground_Url, SkinBackground_Discontinued);

            return(i);
        }
예제 #6
0
        private int AddData()
        {
            int    PortalId        = Convert.ToInt32(ddlPortalList.SelectedValue);
            string SkinType        = ddlSkinTypeList.SelectedValue;
            string SkinName        = txtSkinName.Text;
            string CreatedByUserId = Session["UserId"].ToString();
            /*** UPLOAD *************************************************************************************************************/
            HttpPostedFile icon_file = FileInput.PostedFile;
            string         SkinIcon  = "";

            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                SkinIcon = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                string savePath = Server.MapPath(upload_image_dir + "/" + SkinIcon);
                icon_file.SaveAs(savePath);
            }
            /************************************************************************************************************************/

            SkinPackages skin_package_obj = new SkinPackages();
            int          i = skin_package_obj.Insert(PortalId, SkinName, SkinType, SkinIcon, CreatedByUserId);

            return(i);
        }
        private int UpdateData()
        {
            int    PortalId      = Convert.ToInt32(ddlPortalList.SelectedValue);
            int    ContentItemId = int.Parse(ddlContentItem.SelectedValue);
            int    ParentId      = int.Parse(ddlParentTab.SelectedValue);
            int    RouteId       = int.Parse(ddlRouterList.SelectedValue);
            string TabName       = txt_TabName.Text;
            string Title         = txt_Title.Text;
            string Description   = txt_Desc.Text;
            string Keywords      = txt_Keywords.Text;


            string  Url             = txt_Url.Text;
            string  TabPath         = txt_Path.Text;
            decimal SiteMapPriority = Convert.ToDecimal(txtSiteMapPriority.Text) / 10;

            string PageHeadText   = txt_PageHeadText.Text;
            string PageFooterText = txt_PageFooterText.Text;
            string PageControlBar = txt_PageControlBar.Text;
            string CssClass       = txt_CssClass.Text;
            string CultureCode    = ddlCultureCode.SelectedValue;

            #region xu ly thoi gian  ====================================================================================
            System.Globalization.DateTimeFormatInfo MyDateTimeFormatInfo = new System.Globalization.DateTimeFormatInfo();
            MyDateTimeFormatInfo.ShortDatePattern = "dd/MM/yyyy";

            string StartDate = null, EndDate = null;

            if (txt_StartDate.Text != string.Empty)
            {
                DateTime _start_date = DateTime.Parse(txt_StartDate.Text, MyDateTimeFormatInfo);
                StartDate = _start_date.ToString("yyyy-MM-dd");
            }
            if (txt_EndDate.Text != string.Empty)
            {
                DateTime _end_date = DateTime.Parse(txt_EndDate.Text, MyDateTimeFormatInfo);
                EndDate = _end_date.ToString("yyyy-MM-dd");
            }
            if (txt_StartDate.Text != string.Empty && txt_EndDate.Text != string.Empty)
            {
                DateTime _start_date = DateTime.Parse(txt_StartDate.Text, MyDateTimeFormatInfo);
                DateTime _end_date   = DateTime.Parse(txt_EndDate.Text, MyDateTimeFormatInfo);

                if (DateTime.Compare(_start_date, _end_date) > 0)
                {
                    string scriptCode = "<script>alert('Thời điểm bắt đầu phải nhỏ hơn thời điểm kết thúc');</script>";
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", scriptCode);
                }
            }
            #endregion ================================================================================================

            /*** UPLOAD *************************************************************************************************************/
            HttpPostedFile icon_file = FileIconInput.PostedFile;
            HttpPostedFile icon_large_file = FileIconLargeInput.PostedFile;
            string         IconFileName = "", IconFileLargeName = "", SmallIconPath = string.Empty, LargeIconPath = string.Empty;
            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                IconFileName  = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                SmallIconPath = Server.MapPath(small_icon_path + "/" + IconFileName);
                icon_file.SaveAs(SmallIconPath);
            }

            if (icon_large_file.ContentLength > 0)
            {
                IconFileLargeName = System.IO.Path.GetFileName(icon_large_file.FileName);
                LargeIconPath     = Server.MapPath(large_icon_path + "/" + IconFileLargeName);
                icon_file.SaveAs(LargeIconPath);
            }
            /************************************************************************************************************************/

            bool IsDeleted = true, IsVisible = true, DisableLink = false, DisplayTitle = false, IsSecure = false, PermanentRedirect = false;
            IsDeleted         = chkIsDelete.Checked;
            IsVisible         = chkIsVisible.Checked;
            DisableLink       = chkDisableLink.Checked;
            DisplayTitle      = chkDisplayTitle.Checked;
            IsSecure          = chkIsSecure.Checked;
            PermanentRedirect = chkPermanentRedirect.Checked;

            int result = tab_obj.Update(_idx, PortalId, ContentItemId, ParentId, TabName, Title, CssClass,
                                        IconFileName, IconFileLargeName, Description, Keywords, DisplayTitle, IsDeleted, IsVisible,
                                        DisableLink, IsSecure, PermanentRedirect, SiteMapPriority, Url, TabPath, RouteId, PageHeadText, PageFooterText, PageControlBar, StartDate, EndDate, CultureCode, UserId);

            return(result);
        }