示例#1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            hddID.Value       = "";
            btnUpdate.Enabled = false;
            btnDelete.Enabled = false;

            if (txtName.Text.Trim() == "")
            {
                lblStatusUpdate.Text = AppEnv.NoticeRequired(lang, "TÊN TRƯỜNG");
                return;
            }

            var info = new ZoneInfo();

            info.Zone_ParentID    = ConvertUtility.ToInt32(dropZones.SelectedValue);
            info.Zone_Name        = txtName.Text.Trim();
            info.Zone_Description = txtDescription.Text;

            info.Zone_FriendlyUrl = UnicodeUtility.UnicodeToFriendlyUrl(txtName.Text);

            info.Zone_RealUrl               = txtRealUrl.Text.Trim();
            info.Zone_Avatar                = txtAvatar.Text.Trim();
            info.Zone_Priority              = ZoneDB.GetChildCount(ConvertUtility.ToInt32(dropZones.SelectedValue));
            info.Zone_MetaDescription       = txtMetaDescription.Text;
            info.Zone_MetaKeywords          = txtMetaKeywords.Text;
            info.Zone_Layout                = dropLayout.SelectedValue;
            info.Zone_SubcategoryDisplay    = dropSubcategoryDisplay.SelectedValue;
            info.Zone_ContentListingDisplay = dropContentDisplay.SelectedValue;
            info.Zone_VisibleInMainNav      = chkMainNav.Checked;
            info.Zone_VisibleInLeftNav      = chkLeftNav.Checked;
            info.Zone_VisibleInTopNav       = chkTopNav.Checked;
            info.Zone_VisibleInFooterNav    = chkFooterNav.Checked;
            info.Zone_ExcludeFromNav        = chkExcludeFromNav.Checked;
            info.Zone_Visible               = chkVisible.Checked;
            info.Zone_Disable               = chkDisable.Checked;
            info.Zone_Lang            = lang;
            info.Zone_IsStandAloneBox = false;

            if (ZoneDB.Insert(info))
            {
                lblStatusUpdate.Text = AppEnv.NoticeAdd(lang, true);
                Reset();
            }
            else
            {
                lblStatusUpdate.Text = AppEnv.NoticeAdd(lang, false);
            }
            LoadZones();
        }
示例#2
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (hddID.Value == "")
            {
                return;
            }

            ZoneInfo info = ZoneDB.GetInfo(ConvertUtility.ToInt32(hddID.Value));

            if (info == null)
            {
                Reset();
                return;
            }

            if (txtName.Text.Trim() == "")
            {
                lblStatusUpdate.Text = AppEnv.NoticeRequired(lang, "TÊN MỤC");
                return;
            }


            info.Zone_ParentID    = ConvertUtility.ToInt32(dropZones.SelectedValue);
            info.Zone_Name        = txtName.Text.Trim();
            info.Zone_Description = txtDescription.Text;
            info.Zone_FriendlyUrl = UnicodeUtility.UnicodeToFriendlyUrl(txtName.Text);
            info.Zone_RealUrl     = txtRealUrl.Text.Trim();
            info.Zone_Avatar      = txtAvatar.Text.Trim();
            //priority field
            info.Zone_MetaDescription       = txtDescription.Text;
            info.Zone_MetaKeywords          = txtMetaKeywords.Text;
            info.Zone_Layout                = dropLayout.SelectedValue;
            info.Zone_SubcategoryDisplay    = dropSubcategoryDisplay.SelectedValue;
            info.Zone_ContentListingDisplay = dropContentDisplay.SelectedValue;
            info.Zone_VisibleInMainNav      = chkMainNav.Checked;
            info.Zone_VisibleInLeftNav      = chkLeftNav.Checked;
            info.Zone_VisibleInTopNav       = chkTopNav.Checked;
            info.Zone_VisibleInFooterNav    = chkFooterNav.Checked;
            info.Zone_ExcludeFromNav        = chkExcludeFromNav.Checked;
            info.Zone_Visible               = chkVisible.Checked;
            info.Zone_Disable               = chkDisable.Checked;
            info.Zone_Lang = lang;

            if (info.Zone_ID == info.Zone_ParentID)
            {
                lblStatusUpdate.Text = "<font color='red'>" + (lang == "vi-VN" ? " Trùng mục cha, chọn mục cha khác !" : "The same Index Parent,Select other index Parent !") + "</font>";
                return;
            }
            if (ZoneDB.Update(info))
            {
                lblStatusUpdate.Text = AppEnv.NoticeEdit(lang, true);
                hddID.Value          = "";
                btnUpdate.Enabled    = false;
                btnDelete.Enabled    = false;
                Reset();
            }
            else
            {
                lblStatusUpdate.Text = AppEnv.NoticeEdit(lang, false);
            }

            LoadZones();
        }
示例#3
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            contentInfo.Content_Name              = txtName.Text;
            contentInfo.Content_Teaser            = txtTeaser.Text;
            contentInfo.Content_Body              = Editor1.HtmlValue;
            contentInfo.Content_CreateDate        = ConvertUtility.ToDateTime(txtCreateDate.Text);
            contentInfo.Content_ModifiedDate      = DateTime.Now;
            contentInfo.Content_OriginalZoneID    = ConvertUtility.ToInt32(dropZones.SelectedValue);
            contentInfo.Content_ModifiedUserID    = CurrentAdminInfo.User_ID;
            contentInfo.Content_Author            = txtAuthor.Text;
            contentInfo.Content_EventDate         = ConvertUtility.ToDateTime(txtEventDate.Text);
            contentInfo.Content_FriendlyUrl       = UnicodeUtility.UnicodeToFriendlyUrl(txtName.Text);
            contentInfo.Content_ExcludeFromSearch = chkExcludeFromSearch.Checked;
            contentInfo.Content_IsPhoto           = chkIsPhoto.Checked;
            contentInfo.Content_IsDownload        = chkIsDownload.Checked;
            contentInfo.Content_IsVideo           = chkIsVideo.Checked;
            contentInfo.Content_IsPoll            = chkIsPoll.Checked;
            contentInfo.Content_IsProduct         = chkIsProduct.Checked;
            contentInfo.Content_Visible           = chkVisible.Checked;
            contentInfo.Content_IsTemp            = false;

            if (isManager || isDeployer)
            {
                //try
                //{
                contentInfo.Content_Status = (int)AppEnv.CMSWorkFlow.Deploy;
                ContentDB.Update(contentInfo);

                lblStatusUpdate.Text = AppEnv.MSG_Deploy + "<br /> ";
                lstZones.Items.FindByValue(dropZones.SelectedValue).Selected = true;
                foreach (ListItem item in lstZones.Items)
                {
                    if (item.Selected)
                    {
                        if (!DistributionDB.CheckContentExist(contentInfo.Content_ID, Convert.ToInt32(item.Value)))
                        {
                            //DistributionDB.RemoverInZoneID(contentInfo.Content_ID, Convert.ToInt32(item.Value));
                            int zoneID  = ConvertUtility.ToInt32(item.Value);
                            var newDist = new DistributionInfo();
                            newDist.Distribution_ContentID     = contentInfo.Content_ID;
                            newDist.Distribution_ZoneID        = zoneID;
                            newDist.Distribution_CreateDate    = DateTime.Now;
                            newDist.Distribution_Rank          = ConvertUtility.ToInt32(rdoContentRanks.SelectedValue);
                            newDist.Distribution_Layout        = dropLayout.SelectedValue;
                            newDist.Distribution_DisableTeaser = chkDisableTeaser.Checked;
                            newDist.Distribution_DisableAvatar = chkDisableAvatar.Checked;
                            DistributionDB.Insert(newDist);
                        }
                        lblStatusUpdate.Text += item.Text + ",<br>";
                    }
                    else
                    {
                        DistributionDB.RemoverInZoneID(contentInfo.Content_ID, Convert.ToInt32(item.Value));
                    }
                }



                lblStatusUpdate.Text  = lblStatusUpdate.Text.Substring(0, lblStatusUpdate.Text.Length - 5) + "</font>";
                lblStatusUpdate2.Text = MiscUtility.UPDATE_SUCCESS;
                //cmdHuy_Click(null, null);
                //}
                //catch
                //{
                //    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
                //}
            }
            else
            {
                //try
                //{
                ContentDB.Update(contentInfo);

                lblStatusUpdate.Text = lblStatusUpdate2.Text = MiscUtility.UPDATE_SUCCESS;
                //}
                //catch
                //{
                //    lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
                //}
            }
        }