예제 #1
0
        public void Delete(int publishmentSystemId, int storeItemId)
        {
            if (storeItemId > 0)
            {
                var categoryIdList = GetCategoryIdList(TranslateUtils.ToIntList(storeItemId));

                string sqlString = $"DELETE FROM {TableName} WHERE ID = {storeItemId}";
                ExecuteNonQuery(sqlString);

                DataProviderWx.StoreCategoryDao.UpdateStoreItemCount(publishmentSystemId);
            }
        }
예제 #2
0
        public void Delete(int publishmentSystemID, int storeItemID)
        {
            if (storeItemID > 0)
            {
                var categoryIDList = GetCategoryIDList(TranslateUtils.ToIntList(storeItemID));

                string sqlString = $"DELETE FROM {TABLE_NAME} WHERE ID = {storeItemID}";
                ExecuteNonQuery(sqlString);

                DataProviderWX.StoreCategoryDAO.UpdateStoreItemCount(publishmentSystemID);
            }
        }
예제 #3
0
파일: ContentUtility.cs 프로젝트: zxbe/cms
        public static void Translate(SiteInfo siteInfo, int channelId, int contentId, int targetSiteId, int targetChannelId, ETranslateContentType translateType)
        {
            if (siteInfo == null || channelId <= 0 || contentId <= 0 || targetSiteId <= 0 || targetChannelId <= 0)
            {
                return;
            }

            var targetSiteInfo = SiteManager.GetSiteInfo(targetSiteId);

            var targetTableName = ChannelManager.GetTableName(targetSiteInfo, targetChannelId);

            var channelInfo = ChannelManager.GetChannelInfo(siteInfo.Id, channelId);
            var tableName   = ChannelManager.GetTableName(siteInfo, channelInfo);

            var contentInfo = DataProvider.ContentDao.GetContentInfo(tableName, contentId);

            if (contentInfo == null)
            {
                return;
            }

            if (translateType == ETranslateContentType.Copy)
            {
                FileUtility.MoveFileByContentInfo(siteInfo, targetSiteInfo, contentInfo);

                contentInfo.SiteId    = targetSiteId;
                contentInfo.SourceId  = contentInfo.ChannelId;
                contentInfo.ChannelId = targetChannelId;
                contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.Copy.ToString());
                //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Copy.ToString());
                var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetSiteInfo, contentInfo);

                foreach (var service in PluginManager.Services)
                {
                    try
                    {
                        service.OnContentTranslateCompleted(new ContentTranslateEventArgs(siteInfo.Id, channelInfo.Id, contentId, targetSiteId, targetChannelId, theContentId));
                    }
                    catch (Exception ex)
                    {
                        LogUtils.AddErrorLog(service.PluginId, ex, nameof(service.OnContentTranslateCompleted));
                    }
                }

                CreateManager.CreateContentAndTrigger(targetSiteInfo.Id, contentInfo.ChannelId, theContentId);
            }
            else if (translateType == ETranslateContentType.Cut)
            {
                FileUtility.MoveFileByContentInfo(siteInfo, targetSiteInfo, contentInfo);

                contentInfo.SiteId    = targetSiteId;
                contentInfo.SourceId  = contentInfo.ChannelId;
                contentInfo.ChannelId = targetChannelId;
                contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.Cut.ToString());
                //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Cut.ToString());

                var newContentId = DataProvider.ContentDao.Insert(targetTableName, targetSiteInfo, contentInfo);
                DataProvider.ContentDao.DeleteContents(siteInfo.Id, tableName, TranslateUtils.ToIntList(contentId), channelId);

                DataProvider.ChannelDao.UpdateContentNum(siteInfo, channelId, true);
                DataProvider.ChannelDao.UpdateContentNum(targetSiteInfo, targetChannelId, true);

                foreach (var service in PluginManager.Services)
                {
                    try
                    {
                        service.OnContentTranslateCompleted(new ContentTranslateEventArgs(siteInfo.Id, channelInfo.Id, contentId, targetSiteId, targetChannelId, newContentId));
                    }
                    catch (Exception ex)
                    {
                        LogUtils.AddErrorLog(service.PluginId, ex, nameof(service.OnContentTranslateCompleted));
                    }

                    try
                    {
                        service.OnContentDeleteCompleted(new ContentEventArgs(siteInfo.Id, channelInfo.Id, contentId));
                    }
                    catch (Exception ex)
                    {
                        LogUtils.AddErrorLog(service.PluginId, ex, nameof(service.OnContentDeleteCompleted));
                    }
                }

                CreateManager.CreateContentAndTrigger(targetSiteInfo.Id, contentInfo.ChannelId, newContentId);
            }
            else if (translateType == ETranslateContentType.Reference)
            {
                if (contentInfo.ReferenceId != 0)
                {
                    return;
                }

                contentInfo.SiteId      = targetSiteId;
                contentInfo.SourceId    = contentInfo.ChannelId;
                contentInfo.ChannelId   = targetChannelId;
                contentInfo.ReferenceId = contentId;
                contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.Reference.ToString());
                //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Reference.ToString());
                DataProvider.ContentDao.Insert(targetTableName, targetSiteInfo, contentInfo);
            }
            else if (translateType == ETranslateContentType.ReferenceContent)
            {
                if (contentInfo.ReferenceId != 0)
                {
                    return;
                }

                FileUtility.MoveFileByContentInfo(siteInfo, targetSiteInfo, contentInfo);

                contentInfo.SiteId      = targetSiteId;
                contentInfo.SourceId    = contentInfo.ChannelId;
                contentInfo.ChannelId   = targetChannelId;
                contentInfo.ReferenceId = contentId;
                contentInfo.Set(ContentAttribute.TranslateContentType, ETranslateContentType.ReferenceContent.ToString());
                var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetSiteInfo, contentInfo);

                foreach (var service in PluginManager.Services)
                {
                    try
                    {
                        service.OnContentTranslateCompleted(new ContentTranslateEventArgs(siteInfo.Id, channelInfo.Id, contentId, targetSiteId, targetChannelId, theContentId));
                    }
                    catch (Exception ex)
                    {
                        LogUtils.AddErrorLog(service.PluginId, ex, nameof(service.OnContentTranslateCompleted));
                    }
                }

                CreateManager.CreateContentAndTrigger(targetSiteInfo.Id, contentInfo.ChannelId, theContentId);
            }
        }
예제 #4
0
        public static void Translate(string administratorName, PublishmentSystemInfo publishmentSystemInfo, int nodeId, int contentId, int targetPublishmentSystemId, int targetNodeId, ETranslateContentType translateType)
        {
            if (publishmentSystemInfo == null || nodeId <= 0 || contentId <= 0 || targetPublishmentSystemId <= 0 || targetNodeId <= 0)
            {
                return;
            }

            var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId);

            var targetTableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeId);

            var nodeInfo   = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeId);
            var tableStyle = NodeManager.GetTableStyle(publishmentSystemInfo, nodeInfo);
            var tableName  = NodeManager.GetTableName(publishmentSystemInfo, nodeInfo);

            var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, contentId);

            if (contentInfo == null)
            {
                return;
            }

            if (translateType == ETranslateContentType.Copy)
            {
                FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo);

                contentInfo.PublishmentSystemId = targetPublishmentSystemId;
                contentInfo.SourceId            = contentInfo.NodeId;
                contentInfo.NodeId = targetNodeId;
                contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Copy.ToString();
                //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Copy.ToString());
                var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo);
                if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId))
                {
                    var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId);
                    if (photoInfoList.Count > 0)
                    {
                        foreach (var photoInfo in photoInfoList)
                        {
                            photoInfo.PublishmentSystemID = targetPublishmentSystemId;
                            photoInfo.ContentID           = theContentId;

                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl);
                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl);
                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl);

                            DataProvider.PhotoDao.Insert(photoInfo);
                        }
                    }
                }
                if (contentInfo.IsChecked)
                {
                    CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentId);
                }
            }
            else if (translateType == ETranslateContentType.Cut)
            {
                FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo);

                contentInfo.PublishmentSystemId = targetPublishmentSystemId;
                contentInfo.SourceId            = contentInfo.NodeId;
                contentInfo.NodeId = targetNodeId;
                contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Cut.ToString();
                //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Cut.ToString());
                if (StringUtils.EqualsIgnoreCase(tableName, targetTableName))
                {
                    contentInfo.Taxis = DataProvider.ContentDao.GetTaxisToInsert(targetTableName, targetNodeId, contentInfo.IsTop);
                    DataProvider.ContentDao.Update(targetTableName, targetPublishmentSystemInfo, contentInfo);
                }
                else
                {
                    DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo);
                    DataProvider.ContentDao.DeleteContents(publishmentSystemInfo.PublishmentSystemId, tableName, TranslateUtils.ToIntList(contentId), nodeId);
                }

                DataProvider.NodeDao.UpdateContentNum(publishmentSystemInfo, nodeId, true);
                DataProvider.NodeDao.UpdateContentNum(targetPublishmentSystemInfo, targetNodeId, true);

                if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId))
                {
                    var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId);
                    if (photoInfoList.Count > 0)
                    {
                        foreach (var photoInfo in photoInfoList)
                        {
                            photoInfo.PublishmentSystemID = targetPublishmentSystemId;

                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl);
                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl);
                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl);

                            DataProvider.PhotoDao.Update(photoInfo);
                        }
                    }
                }
                if (contentInfo.IsChecked)
                {
                    CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id);
                }
            }
            else if (translateType == ETranslateContentType.Reference)
            {
                if (contentInfo.ReferenceId != 0)
                {
                    return;
                }

                contentInfo.PublishmentSystemId = targetPublishmentSystemId;
                contentInfo.SourceId            = contentInfo.NodeId;
                contentInfo.NodeId      = targetNodeId;
                contentInfo.ReferenceId = contentId;
                contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.Reference.ToString();
                //contentInfo.Attributes.Add(ContentAttribute.TranslateContentType, ETranslateContentType.Reference.ToString());
                DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo);
            }
            else if (translateType == ETranslateContentType.ReferenceContent)
            {
                if (contentInfo.ReferenceId != 0)
                {
                    return;
                }

                FileUtility.MoveFileByContentInfo(publishmentSystemInfo, targetPublishmentSystemInfo, contentInfo);

                contentInfo.PublishmentSystemId = targetPublishmentSystemId;
                contentInfo.SourceId            = contentInfo.NodeId;
                contentInfo.NodeId      = targetNodeId;
                contentInfo.ReferenceId = contentId;
                contentInfo.Attributes[ContentAttribute.TranslateContentType] = ETranslateContentType.ReferenceContent.ToString();
                var theContentId = DataProvider.ContentDao.Insert(targetTableName, targetPublishmentSystemInfo, contentInfo);
                if (EContentModelTypeUtils.IsPhoto(nodeInfo.ContentModelId))
                {
                    var photoInfoList = DataProvider.PhotoDao.GetPhotoInfoList(publishmentSystemInfo.PublishmentSystemId, contentId);
                    if (photoInfoList.Count > 0)
                    {
                        foreach (var photoInfo in photoInfoList)
                        {
                            photoInfo.PublishmentSystemID = targetPublishmentSystemId;
                            photoInfo.ContentID           = theContentId;

                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.SmallUrl);
                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.MiddleUrl);
                            FileUtility.MoveFileByVirtaulUrl(publishmentSystemInfo, targetPublishmentSystemInfo, photoInfo.LargeUrl);

                            DataProvider.PhotoDao.Insert(photoInfo);
                        }
                    }
                }

                if (contentInfo.IsChecked)
                {
                    CreateManager.CreateContentAndTrigger(targetPublishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, theContentId);
                }
            }
        }
예제 #5
0
        public void Page_Load(object sender, EventArgs e)
        {
            var contentID = TranslateUtils.ToInt(Request.QueryString["contentID"]);

            if (contentID > 0)
            {
                _contentInfo = DataProvider.ResumeContentDao.GetContentInfo(contentID);
                if (_contentInfo != null)
                {
                    DataProvider.ResumeContentDao.SetIsView(TranslateUtils.ToIntList(contentID), true);
                }
            }
            else
            {
                _contentInfo = DataProvider.ResumeContentDao.GetContentInfo(PublishmentSystemId, Request.Form);
            }

            ltlRealName.Text       = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.RealName);
            ltlNationality.Text    = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Nationality);
            ltlGender.Text         = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Gender);
            ltlEmail.Text          = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Email);
            ltlMobilePhone.Text    = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.MobilePhone);
            ltlHomePhone.Text      = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.HomePhone);
            ltlLastSchoolName.Text = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.LastSchoolName);
            ltlEducation.Text      = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Education);
            ltlIDCardType.Text     = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.IdCardType);
            ltlIDCardNo.Text       = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.IdCardNo);
            ltlBirthday.Text       = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Birthday);
            ltlMarriage.Text       = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Marriage);
            ltlWorkYear.Text       = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.WorkYear);
            ltlProfession.Text     = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Profession);
            ltlExpectSalary.Text   = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.ExpectSalary);
            ltlAvailabelTime.Text  = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.AvailabelTime);
            ltlLocation.Text       = _contentInfo.GetExtendedAttribute(ResumeContentAttribute.Location);

            if (!string.IsNullOrEmpty(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.ImageUrl)))
            {
                ltlImageUrl.Text =
                    $@"<img src=""{PageUtility.ParseNavigationUrl(PublishmentSystemInfo,
                        _contentInfo.GetExtendedAttribute(ResumeContentAttribute.ImageUrl))}"" width=""120"" height=""150"" />";
            }
            else
            {
                ltlImageUrl.Text = @"<img src=""images/resume_picture.jpg"" width=""120"" height=""150"" />";
            }
            ltlSummary.Text = StringUtils.ReplaceNewlineToBr(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.Summary));

            var count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.ExpCount));
            var array = new int[count];

            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptExp.DataSource     = array;
            rptExp.ItemDataBound += rptExp_ItemDataBound;
            rptExp.DataBind();

            count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.ProCount));
            array = new int[count];
            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptPro.DataSource     = array;
            rptPro.ItemDataBound += rptPro_ItemDataBound;
            rptPro.DataBind();

            count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.EduCount));
            array = new int[count];
            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptEdu.DataSource     = array;
            rptEdu.ItemDataBound += rptEdu_ItemDataBound;
            rptEdu.DataBind();

            count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.TraCount));
            array = new int[count];
            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptTra.DataSource     = array;
            rptTra.ItemDataBound += rptTra_ItemDataBound;
            rptTra.DataBind();

            count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.LanCount));
            array = new int[count];
            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptLan.DataSource     = array;
            rptLan.ItemDataBound += rptLan_ItemDataBound;
            rptLan.DataBind();

            count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.SkiCount));
            array = new int[count];
            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptSki.DataSource     = array;
            rptSki.ItemDataBound += rptSki_ItemDataBound;
            rptSki.DataBind();

            count = TranslateUtils.ToInt(_contentInfo.GetExtendedAttribute(ResumeContentAttribute.CerCount));
            array = new int[count];
            for (var i = 0; i < count; i++)
            {
                array[i] = i + 1;
            }
            rptCer.DataSource     = array;
            rptCer.ItemDataBound += rptCer_ItemDataBound;
            rptCer.DataBind();
        }