コード例 #1
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            if (isManager || isDeployer)
            {
                //try
                //{

                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(AppEnv.CMSContentRank.Default);
                            newDist.Distribution_Layout        = "zone";
                            newDist.Distribution_DisableTeaser = false;
                            newDist.Distribution_DisableAvatar = false;
                            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;
                //}
            }
        }
コード例 #2
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;
                //}
            }
        }