public static bool Delete(string fieldName, int modelId) { fieldName = fieldName.ToLower(); FieldInfo fieldInfoByFieldName = GetFieldInfoByFieldName(modelId, fieldName); if (fieldInfoByFieldName != null) { if (fieldInfoByFieldName.FieldLevel == 0) { return(false); } if (((fieldInfoByFieldName.FieldType == FieldType.FileType) && !DataConverter.CBoolean(fieldInfoByFieldName.Settings[3])) && !string.IsNullOrEmpty(fieldInfoByFieldName.Settings[4])) { Delete(fieldInfoByFieldName.Settings[4], modelId); } } ModelInfo modelInfoById = ModelManager.GetModelInfoById(modelId); XmlManage manage = XmlManage.Instance(modelInfoById.Field, XmlType.Content); string nodeName = "/ArrayOfFieldInfo/FieldInfo[@Id=\"" + fieldName + "\"]"; manage.Remove(nodeName); if (!UpdateField(modelId, manage.Xml)) { return(false); } return(((fieldInfoByFieldName != null) && (fieldInfoByFieldName.FieldType == FieldType.Property)) || ModelManager.DeleteTableField(fieldName, modelInfoById.TableName)); }
public static bool Delete(int surveyId, int questionId) { SurveyFieldInfo fieldInfoById = new SurveyFieldInfo(); fieldInfoById = GetFieldInfoById(surveyId, questionId); XmlManage manage = XmlManage.Instance(GetXmlFieldBySurveyId(surveyId), XmlType.Content); manage.Remove(GetNodePath(questionId)); bool flag = dal.Delete(surveyId, manage.Xml); if (flag) { SurveyVote.Delete(surveyId, questionId); DeleteColumn(questionId, surveyId); if ((fieldInfoById.QuestionType != 2) && (fieldInfoById.QuestionType != 3)) { return(flag); } if (fieldInfoById.InputType != 0) { DeleteInputColumn(questionId, surveyId); } } return(flag); }
public static bool BatchDelete(int surveyId, string questionIds) { bool flag = false; if (!string.IsNullOrEmpty(questionIds)) { XmlManage manage = XmlManage.Instance(GetXmlFieldBySurveyId(surveyId), XmlType.Content); string[] strArray = questionIds.Split(new char[] { ',' }); for (int i = 0; i < strArray.Length; i++) { SurveyFieldInfo fieldInfoById = new SurveyFieldInfo(); fieldInfoById = GetFieldInfoById(surveyId, DataConverter.CLng(strArray[i])); manage.Remove(GetNodePath(DataConverter.CLng(strArray[i]))); DeleteColumn(DataConverter.CLng(strArray[i]), surveyId); if (((fieldInfoById.QuestionType == 2) || (fieldInfoById.QuestionType == 3)) && (fieldInfoById.InputType != 0)) { DeleteInputColumn(DataConverter.CLng(strArray[i]), surveyId); } } flag = dal.Update(surveyId, manage.Xml); if (flag) { SurveyVote.Delete(surveyId, questionIds); } } return(flag); }
protected void BtnStopCreate_Click(object sender, EventArgs e) { string nodeValue = XmlManage.Instance("Config/CreateCollectionWork.config", XmlType.File).GetNodeValue("CollectionWork/WorkId"); if (base.Application[nodeValue] != null) { CollectionProgress progress = base.Application[nodeValue] as CollectionProgress; progress.CreateThread.Abort(); base.Application.Remove(nodeValue); if (DataConverter.CBoolean(this.HdnIsCreateHtml.Value)) { string nodeIds = ""; string str3 = BasePage.RequestString("ItemIds"); if (!string.IsNullOrEmpty(str3)) { if (str3.Contains(",")) { foreach (string str4 in str3.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { nodeIds = GetNodeIs(nodeIds, str4); } } else { nodeIds = GetNodeIs(nodeIds, str3); } } HtmlContent content = new HtmlContent(); content.CreateMethod = CreateContentType.CreateByNotCreate; content.NodeIdArray = nodeIds; content.CommonCreateHtml(); } } }
public static bool SetOrderId(string fieldName, int modelId, int orderId) { XmlManage manage = XmlManage.Instance(GetXmlFieldList(modelId), XmlType.Content); string nodeName = "/ArrayOfFieldInfo/FieldInfo[@Id=\"" + fieldName.ToLower() + "\"]"; manage.SetAttributesValue(nodeName, "OrderId", orderId.ToString()); return(UpdateField(modelId, manage.Xml)); }
public static bool SetOrderId(IList <FieldInfo> fieldInfoList, int modelId) { XmlManage manage = XmlManage.Instance(GetXmlFieldList(modelId), XmlType.Content); foreach (FieldInfo info in fieldInfoList) { string nodeName = "/ArrayOfFieldInfo/FieldInfo[@Id=\"" + info.Id.ToLower() + "\"]"; manage.SetAttributesValue(nodeName, "OrderId", info.OrderId.ToString()); } return(UpdateField(modelId, manage.Xml)); }
public static bool FieldExists(int modelId, string fieldName) { string xmlFieldList = GetXmlFieldList(modelId); if (string.IsNullOrEmpty(xmlFieldList)) { return(false); } string nodeName = "/ArrayOfFieldInfo/FieldInfo[@Id='" + fieldName.ToLower() + "']"; return(XmlManage.Instance(xmlFieldList, XmlType.Content).ExistsNode(nodeName)); }
public static bool Delete(string fieldName, int templateId) { if (GetFieldInfoByFieldName(templateId, fieldName).FieldLevel == 0) { return(false); } XmlManage manage = XmlManage.Instance(ModelTemplate.GetField(templateId), XmlType.Content); string nodeName = "/ArrayOfFieldInfo/FieldInfo[@Id=\"" + fieldName.ToLower() + "\"]"; manage.Remove(nodeName); return(ModelTemplate.UpdateField(templateId, manage.Xml)); }
public static FieldInfo GetFieldInfoByFieldName(int templateId, string fieldName) { string str2 = XmlManage.Instance(ModelTemplate.GetField(templateId), XmlType.Content).SelectNode("/ArrayOfFieldInfo/FieldInfo[@Id=\"" + fieldName.ToLower() + "\"]"); FieldInfo info = null; if (!string.IsNullOrEmpty(str2)) { TextReader textReader = new StringReader(str2); XmlSerializer serializer = new XmlSerializer(typeof(FieldInfo)); info = (FieldInfo)serializer.Deserialize(textReader); textReader.Close(); } return(info); }
protected void Page_Load(object sender, EventArgs e) { RolePermissions.BusinessAccessCheck(OperateCode.CreateHtmlManage); this.HdnIsCreateHtml.Value = BasePage.RequestString("isCreateHtml"); string nodeValue = XmlManage.Instance("Config/CreateCollectionWork.config", XmlType.File).GetNodeValue("CollectionWork/WorkId"); this.m_UrlReferrer = base.Request.UrlReferrer.ToString(); if (base.Application[nodeValue] != null) { this.BtnStopCreate.Visible = true; } else { this.BtnStopCreate.Visible = false; } }
public static FieldInfo GetFieldInfoByFieldName(int modelId, string fieldName) { string xmlField = XmlManage.Instance(GetXmlFieldList(modelId), XmlType.Content).SelectNode("/ArrayOfFieldInfo/FieldInfo[@Id=\"" + fieldName.ToLower() + "\"]"); return(ser.DeserializeField(xmlField)); }
public ProgressInfo AcquireProgress() { ProgressInfo info = new ProgressInfo(); string nodeValue = XmlManage.Instance("Config/CreateCollectionWork.config", XmlType.File).GetNodeValue("CollectionWork/WorkId"); if (base.Application[nodeValue] == null) { return(null); } CollectionProgress progress = (CollectionProgress)base.Application[nodeValue]; info.IsInput = progress.IsInput; info.Message = progress.CollectionMessage; info.CollectionEnd = false; info.ErrorMessage = progress.ErrorInfo; info.IsCreateHtml = progress.IsCreateHtml; info.ItemId = progress.ItemId; if (!string.IsNullOrEmpty(info.ErrorMessage)) { info.CollectionEnd = true; base.Application.Remove(nodeValue); return(info); } if (progress.IsInput) { if (progress.CollectionCompleted == progress.CollectionCount) { info.Completed = progress.CollectionCompleted; info.ExecutionTime = ((TimeSpan)(DateTime.Now - progress.CollectionStartTime)).ToString(); info.Id = progress.CreateId; info.Count = progress.CollectionCount; info.Completed = progress.CollectionCompleted; info.Progress = "100%"; if (progress.ItemCompleted == progress.ItemCount) { info.CollectionEnd = true; base.Application.Remove(nodeValue); } if (info.IsCreateHtml) { string nodeIds = ""; string itemId = info.ItemId; if (!string.IsNullOrEmpty(itemId)) { if (itemId.Contains(",")) { foreach (string str4 in itemId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { nodeIds = GetNodeIs(nodeIds, str4); } } else { nodeIds = GetNodeIs(nodeIds, itemId); } } info.Message = "请稍后,准备生成采集文章..."; HtmlContent content = new HtmlContent(); content.CreateMethod = CreateContentType.CreateByNotCreate; content.NodeIdArray = nodeIds; info.CreateWorkId = Guid.NewGuid().ToString(); content.CommonCreateHtml(); } return(info); } info.Completed = progress.CollectionCompleted; info.Id = progress.CreateId; info.Count = progress.CollectionCount; info.ExecutionTime = "0:00:00"; info.Progress = "0"; if (progress.CollectionCompleted != 0) { info.Progress = (((double)progress.CollectionCompleted) / ((double)progress.CollectionCount)).ToString("p"); TimeSpan span2 = (TimeSpan)(DateTime.Now - progress.CollectionStartTime); info.ExecutionTime = span2.Hours.ToString() + ":" + span2.Minutes.ToString() + ":" + span2.Seconds.ToString(); } } return(info); }
public static SurveyFieldInfo GetFieldInfoById(int surveyId, int questionId) { return(DeserializeField(XmlManage.Instance(GetXmlFieldBySurveyId(surveyId), XmlType.Content).SelectNode(GetNodePath(questionId)))); }