📄 content.cs
字号:
this.EChklUserGroupList.Items.Clear();
IList<UserGroupsInfo> userGroupList = UserGroups.GetUserGroupList(0, 0);
userGroupList.RemoveAt(0);
this.EChklUserGroupList.DataSource = userGroupList;
this.EChklUserGroupList.DataTextField = "GroupName";
this.EChklUserGroupList.DataValueField = "GroupId";
this.EChklUserGroupList.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_ModelId = BasePage.RequestInt32("ModelID");
this.m_NodeId = BasePage.RequestInt32("NodeID");
this.m_Action = BasePage.RequestStringToLower("Action");
if (this.m_Action == "modify")
{
this.EBtnSubmit.Text = " 修改项目 ";
this.EBtnNewAddItem.Visible = true;
}
this.InitializePage();
}
protected void RepModel_OnItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
FieldControl control = (FieldControl) e.Item.FindControl("Field");
FieldInfo dataItem = (FieldInfo) e.Item.DataItem;
FieldType controlType = control.ControlType;
switch (controlType)
{
case FieldType.LookType:
{
int modelId = DataConverter.CLng(dataItem.Settings[0]);
if (!Field.FieldExists(modelId, dataItem.Settings[1]))
{
Field.SetDisabled(dataItem.FieldName, modelId, true);
e.Item.Visible = false;
}
break;
}
case FieldType.NodeType:
control.Value = this.m_NodeId.ToString();
break;
case FieldType.ContentType:
((ContentType) control.FindControl("PowerEasy2007")).IsUpload = true;
break;
}
HtmlControl control2 = this.InitTabByFieldType(e, dataItem);
if (this.m_Action == "modify")
{
if (((BasePage.RequestInt32("LinkType") == 1) && (dataItem.FieldLevel == 1)) && control.FindControl("PowerEasy2007").Visible)
{
if (this.arrTrs0.Length > (control2.ClientID.Length + 3))
{
this.arrTrs0.Remove((this.arrTrs0.Length - control2.ClientID.Length) - 3, control2.ClientID.Length + 3);
}
else
{
this.arrTrs0.Remove((this.arrTrs0.Length - control2.ClientID.Length) - 2, control2.ClientID.Length + 2);
}
control.FindControl("PowerEasy2007").Visible = false;
}
if (controlType == FieldType.ContentType)
{
ContentType type2 = (ContentType) control.FindControl("PowerEasy2007");
type2.Content = ContentManage.ToFieldType(this.m_ContentDataTable.Rows[0][dataItem.FieldName].ToString(), dataItem.FieldType, 1);
type2.DefaultPicurl = ContentManage.ToFieldType(this.m_ContentDataTable.Rows[0]["DefaultPicurl"].ToString(), FieldType.TextType, 0);
}
else
{
control.Value = ContentManage.ToFieldType(this.m_ContentDataTable.Rows[0][dataItem.FieldName].ToString(), dataItem.FieldType, 1);
}
if ((controlType == FieldType.PictureType) && (dataItem.FieldLevel == 0))
{
PictureType type3 = (PictureType) control.FindControl("PowerEasy2007");
type3.UploadFiles = ContentManage.ToFieldType(this.m_ContentDataTable.Rows[0]["UploadFiles"].ToString(), FieldType.TextType, 0);
}
if (controlType == FieldType.FileType)
{
FileType type4 = (FileType) control.FindControl("PowerEasy2007");
type4.FileSize = ContentManage.ToFieldType(this.m_ContentDataTable.Rows[0][dataItem.Settings[4]].ToString(), dataItem.FieldType, 1);
}
if (controlType == FieldType.MultiplePhotoType)
{
MultiplePhotoType type5 = (MultiplePhotoType) control.FindControl("PowerEasy2007");
if (DataConverter.CBool(dataItem.Settings[2]))
{
type5.ThumbFieldValue = ContentManage.ToFieldType(this.m_ContentDataTable.Rows[0][dataItem.Settings[3]].ToString(), dataItem.FieldType, 1);
}
}
}
}
}
private void SaveKeywordToTable(string txtKeyWord, int generalId)
{
foreach (string str in txtKeyWord.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries))
{
if (PowerEasy.Accessories.Keywords.Exists(str))
{
KeywordInfo keywordByKeywordName = PowerEasy.Accessories.Keywords.GetKeywordByKeywordName(str);
string str2 = ContentManage.RebuildArr(keywordByKeywordName.ArrayGeneralId + "," + generalId.ToString());
int length = str2.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Length;
keywordByKeywordName.ArrayGeneralId = str2;
keywordByKeywordName.QuoteTimes = length;
PowerEasy.Accessories.Keywords.Update(keywordByKeywordName);
}
else
{
KeywordInfo keywordInfo = new KeywordInfo();
keywordInfo.KeywordText = str;
keywordInfo.KeywordType = 1;
keywordInfo.LastUseTime = DateTime.Now;
keywordInfo.Priority = 0;
keywordInfo.ArrayGeneralId = generalId.ToString();
keywordInfo.QuoteTimes = 1;
PowerEasy.Accessories.Keywords.Add(keywordInfo);
}
}
}
private void SavePresentExp(DataTable dataTable, bool isAdd)
{
string userName = PEContext.Current.Admin.UserName;
CommonModelInfo commonModelInfoById = null;
if (!isAdd)
{
commonModelInfoById = ContentManage.GetCommonModelInfoById(BasePage.RequestInt32("GeneralID"));
userName = commonModelInfoById.Inputer;
}
UserInfo usersByUserName = Users.GetUsersByUserName(userName);
if (!usersByUserName.IsNull)
{
int statusFromDataTable = GetStatusFromDataTable(dataTable);
UserPurviewInfo userPurview = usersByUserName.UserPurview;
if (userPurview.IsNull)
{
userPurview.MaxPublicInfoOneDay = -1;
userPurview.GetExp = 1;
}
if (userPurview.GetExp == 0)
{
userPurview.GetExp = 1;
}
int num3 = PowerEasy.Contents.Nodes.GetCacheNodeById(this.m_NodeId).Settings.PresentExp * userPurview.GetExp;
if (isAdd)
{
int generalId = GetGeneralId(dataTable);
if (statusFromDataTable == 0x63)
{
usersByUserName.UserExp += num3;
usersByUserName.PostItems++;
}
}
else
{
if ((statusFromDataTable == 0x63) && (commonModelInfoById.Status < 0x63))
{
usersByUserName.UserExp += num3;
usersByUserName.PostItems++;
}
if ((commonModelInfoById.Status == 0x63) && (statusFromDataTable < 0x63))
{
usersByUserName.UserExp -= num3;
}
}
Users.Update(usersByUserName);
}
}
private void Update()
{
DataTable dataTableFromRepeater = this.GetDataTableFromRepeater();
int generalId = BasePage.RequestInt32("GeneralID");
this.SavePresentExp(dataTableFromRepeater, false);
if (ContentManage.Update(generalId, ContentManage.GetNewContentData(dataTableFromRepeater)))
{
ModelInfo modelInfoById = ModelManager.GetModelInfoById(this.m_ModelId);
int num2 = this.AddPermissionAndCharge(dataTableFromRepeater, modelInfoById.EnableCharge);
if (modelInfoById.EnableSignin)
{
this.UpdateSignin(generalId, dataTableFromRepeater);
}
if (!modelInfoById.EnableSignin || (num2 <= 0))
{
HtmlContent.CreateHtml(dataTableFromRepeater);
}
this.UpdateKeywordsToTable(generalId, dataTableFromRepeater);
if (modelInfoById.EnbaleVote)
{
this.Vote.Add(generalId);
}
SiteCache.Remove("CK_Page_Category_" + this.m_NodeId.ToString());
BasePage.ResponseRedirect(AdminPage.AppendSecurityCode("ContentShowSuccess.aspx?Action=Modify&GeneralID=" + generalId.ToString() + "&NodeID=" + this.m_NodeId.ToString() + "&ModelID=" + this.m_ModelId.ToString() + "&ContentFieldName=" + this.m_ContentFieldName));
}
else
{
AdminPage.WriteErrMsg("修改失败!");
}
}
private void UpdateKeywordsToTable(int generalId, DataTable dataTable)
{
DataRow[] rowArray = dataTable.Select("FieldName = 'keyword'");
if (rowArray.Length > 0)
{
string str = rowArray[0]["FieldValue"].ToString();
if (!string.IsNullOrEmpty(str))
{
KeywordInfo keywordById = PowerEasy.Accessories.Keywords.GetKeywordById(generalId);
if (str != keywordById.KeywordText)
{
this.SaveKeywordToTable(str, generalId);
}
}
}
}
private void UpdateSignin(int generalId, DataTable dataTable)
{
if (!string.IsNullOrEmpty(this.TxtSigninUser.Text))
{
string str = dataTable.Select("FieldName = 'title'")[0]["FieldValue"].ToString();
SigninContentInfo signinContentInfo = new SigninContentInfo();
signinContentInfo.GeneralId = generalId;
signinContentInfo.EndTime = this.DpkEndTime.Date;
signinContentInfo.Priority = DataConverter.CLng(this.TxtPriority.Text);
signinContentInfo.SigninType = (SigninType) Enum.Parse(typeof(SigninType), this.DrpSigninType.SelectedValue);
signinContentInfo.Title = str;
SigninContent.UpdateSigninContent(signinContentInfo);
SigninContent.UpdateContentSigninType(generalId, signinContentInfo.SigninType);
SigninLog.Update(generalId, this.TxtSigninUser.Text);
}
else
{
SigninContent.Delete(generalId);
SigninLog.Delete(generalId);
SigninContent.UpdateContentSigninType(generalId, SigninType.DisableSignin);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -