private void AddCatalogDataRow(DataTable catalogsTable, CatalogInfo item) { DataRow row = catalogsTable.NewRow(); row.SetField("Id", item.Id); row.SetField("UID", item.UID); row.SetField("Code", item.Code); row.SetField("Article", item.Article); row.SetField("Name", item.Name); row.SetField("BrandName", item.BrandName); row.SetField("Unit", item.Unit); row.SetField("EnterpriceNormPack", item.EnterpriceNormPack); row.SetField("BatchOfSales", item.BatchOfSales); row.SetField("Balance", item.Balance); row.SetField("Price", item.Price); row.SetField("Currency", item.Currency); row.SetField("Multiplicity", item.Multiplicity); row.SetField("HasPhotos", item.HasPhotos); row.SetField("Status", item.Status); row.SetField("LastUpdatedStatus", item.LastUpdatedStatus); row.SetField("DateOfCreation", item.DateOfCreation); row.SetField("LastUpdated", item.LastUpdated); row.SetField("ForceUpdated", item.ForceUpdated); row.SetField("Brand_Id", item.BrandId); row.SetField("Directory_Id", item.DirectoryId); catalogsTable.Rows.Add(row); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="Rest.ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (CatalogInfo != null) { CatalogInfo.Validate(); } if (CustomSetupScriptProperties != null) { CustomSetupScriptProperties.Validate(); } if (PackageStores != null) { foreach (var element in PackageStores) { if (element != null) { element.Validate(); } } } if (Credential != null) { Credential.Validate(); } }
public ViewResultBase Details() { if (!string.IsNullOrEmpty(Request["isTooltip"])) { Guid id; if (Guid.TryParse(Request["id"], out id)) { var data = CatalogInfo.Create(base.EntityType.GetData(id)); return(new PartialViewResult { ViewName = "Partials/Details", ViewData = new ViewDataDictionary(data) }); } else { throw new ValidationException("非法的Guid标识" + Request["id"]); } } else if (!string.IsNullOrEmpty(Request["isInner"])) { return(new PartialViewResult { ViewName = "Partials/Details" }); } else { return(this.View()); } }
// ------------------------------------------------------- // 保存 删除 // ------------------------------------------------------- #region 函数:Save(CatalogInfo param) /// <summary>保存记录</summary> /// <param name="param">实例<see cref="CatalogInfo"/>详细信息</param> /// <returns>实例<see cref="CatalogInfo"/>详细信息</returns> public CatalogInfo Save(CatalogInfo param) { if (string.IsNullOrEmpty(param.Id)) { throw new ApplicationException("分组类别树的标识不能为空。"); } CatalogItemInfo node = new CatalogItemInfo(); node.Id = param.Id; node.Name = param.Name; node.ParentId = Guid.Empty.ToString(); node.IsKey = true; MembershipManagement.Instance.CatalogItemService.Save(node); param.RootCatalogItemId = param.Id; provider.Save(param); return(param); }
public static CatalogItemEntity Assemble(CatalogInfo catalogInfo, BrandItemEntity brandItem, List <PhotoItemEntity> photos, DirectoryEntity directory) { CatalogItemEntity catalogItem = new CatalogItemEntity { Id = catalogInfo.Id, UID = catalogInfo.UID, Code = catalogInfo.Code, Article = catalogInfo.Article, Brand = brandItem, BrandName = brandItem?.Name, Name = catalogInfo.Name, Unit = catalogInfo.Unit, EnterpriceNormPack = catalogInfo.EnterpriceNormPack, BatchOfSales = catalogInfo.BatchOfSales, Balance = catalogInfo.Balance, Price = catalogInfo.Price, Currency = catalogInfo.Currency, Multiplicity = catalogInfo.Multiplicity, HasPhotos = catalogInfo.HasPhotos, Photos = photos, DateOfCreation = catalogInfo.DateOfCreation, LastUpdated = catalogInfo.LastUpdated, ForceUpdated = catalogInfo.ForceUpdated, Status = Convert(catalogInfo.Status), LastUpdatedStatus = catalogInfo.LastUpdatedStatus, Directory = directory }; return(catalogItem); }
private void Update(CatalogItemEntity entity, CatalogInfo catalogInfo) { BrandItemEntity brandItem = GetBrandWithLoad(catalogInfo.BrandId); DirectoryEntity directory = GetDirectoryWithLoad(catalogInfo.DirectoryId); List <PhotoItemEntity> photos = GetPhotosWithLoad(catalogInfo.Photos); entity.Id = catalogInfo.Id; entity.UID = catalogInfo.UID; entity.Code = catalogInfo.Code; entity.Article = catalogInfo.Article; entity.Brand = brandItem; entity.BrandName = brandItem?.Name; entity.Name = catalogInfo.Name; entity.Unit = catalogInfo.Unit; entity.EnterpriceNormPack = catalogInfo.EnterpriceNormPack; entity.BatchOfSales = catalogInfo.BatchOfSales; entity.Balance = catalogInfo.Balance; entity.Price = catalogInfo.Price; entity.Currency = catalogInfo.Currency; entity.Multiplicity = catalogInfo.Multiplicity; entity.HasPhotos = catalogInfo.HasPhotos; entity.Photos = photos; entity.DateOfCreation = catalogInfo.DateOfCreation; entity.LastUpdated = catalogInfo.LastUpdated; entity.ForceUpdated = catalogInfo.ForceUpdated; entity.Status = LoadAssembler.Convert(catalogInfo.Status); entity.LastUpdatedStatus = catalogInfo.LastUpdatedStatus; entity.Directory = directory; }
private void AddLinkToPhotoDataRows(DataTable linkToPhotosTable, CatalogInfo item) { if (linkToPhotosTable != null) { item?.Photos.ToList().ForEach(x => AddLinkToPhotoDataRow(linkToPhotosTable, item.Id, x)); } }
/// <summary> /// 添加目录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddTreeViewItem_Click(object sender, RoutedEventArgs e) { if (treeCatalog.SelectedItem != null) { TreeNode <CatalogInfo> selectnode = treeCatalog.SelectedItem as TreeNode <CatalogInfo>; if (selectnode.Level < 2) { TreeNode <CatalogInfo> newcatalog = new TreeNode <CatalogInfo>(); CatalogInfo catalog = new CatalogInfo(); catalog.Guid = Guid.NewGuid().ToString(); catalog.Activity_guid = activity.Guid; catalog.Parent_guid = selectnode.Value.Guid; catalog.Name = CreateCatalogName(); catalog.CreateDate = DateTime.Now; newcatalog.Value = catalog; string error = string.Empty; bool result = FileManageHelper.SaveCatalog(newcatalog.Value, out error); if (result) { selectnode.SubTreeNodes.Add(newcatalog); } else { MessageBox.Show(error, "目录添加失败"); } } else { MessageBox.Show("只可以创建三层目录"); } } }
protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); CatalogInfo cacheCatalogById = Catalog.GetCacheCatalogById(@int); if (cacheCatalogById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "没有找到此栏目,栏目不存在或者已删除"); } else if (cacheCatalogById.IsSystem) { base.ShowAjaxMsg(this.UpdatePanel1, "系统栏目不可删除"); } else if (Catalog.ExistsChildModule(@int)) { base.ShowAjaxMsg(this.UpdatePanel1, "栏目正被子模块引用"); } else if (Catalog.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除栏目[" + cacheCatalogById.CatalogName + "] thành công"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } }
/// <summary> /// Initializes a new instance of the <see cref="UPCatalog"/> class. /// </summary> /// <param name="catNo"> /// The cat no. /// </param> /// <param name="crmDatabase"> /// The CRM database. /// </param> /// <param name="isFixed"> /// if set to <c>true</c> [is fixed]. /// </param> public UPCatalog(int catNo, CRMDatabase crmDatabase, bool isFixed) { this.catNo = catNo; this._fixed = isFixed; this.catInitialized = false; this.catalogInfo = null; this.crmDatabase = crmDatabase; }
private CatalogItemEntity Create(CatalogInfo catalogInfo) { BrandItemEntity brandItem = GetBrandWithLoad(catalogInfo.BrandId); DirectoryEntity directory = GetDirectoryWithLoad(catalogInfo.DirectoryId); List <PhotoItemEntity> photos = GetPhotosWithLoad(catalogInfo.Photos); CatalogItemEntity entity = LoadAssembler.Assemble(catalogInfo, brandItem, photos, directory); return(entity); }
private void InitForModify() { CatalogInfo dataById = Catalog.GetDataById(base.OpID); this.TextBox1.Text = dataById.CatalogName; this.TextBox2.Text = dataById.CatalogCode; this.TextBox2.Enabled = false; this.TextBox3.Text = dataById.Remark; }
// ------------------------------------------------------- // 查询 // ------------------------------------------------------- #region 函数:FindOne(string id) /// <summary>查询某条记录</summary> /// <param name="id">标识</param> /// <returns>返回实例<see cref="CatalogInfo"/>的详细信息</returns> public CatalogInfo FindOne(string id) { Dictionary <string, object> args = new Dictionary <string, object>(); args.Add("Id", StringHelper.ToSafeSQL(id)); CatalogInfo param = this.ibatisMapper.QueryForObject <CatalogInfo>(StringHelper.ToProcedurePrefix(string.Format("{0}_FindOne", tableName)), args); return(param); }
// ------------------------------------------------------- // 保存 删除 // ------------------------------------------------------- #region 函数:Save(XmlDocument doc) /// <summary>保存记录</summary> /// <param name="doc">Xml 文档对象</param> /// <returns>返回操作结果</returns> public string Save(XmlDocument doc) { CatalogInfo param = new CatalogInfo(); param = (CatalogInfo)AjaxUtil.Deserialize(param, doc); this.service.Save(param); return(MessageObject.Stringify("0", I18n.Strings["msg_save_success"])); }
/// <summary> /// Retreives the CatalogInfo object data from the Parameters Dictionary /// </summary> /// <param name="Parameters"></param> /// <returns>CatalogInfo object</returns> private CatalogInfo GetCatalogInfoParamaters(NameValueCollection Parameters) { CatalogInfo catalogInfo = new CatalogInfo(); catalogInfo.FileName = GetValue(Parameters, "fileName", ""); catalogInfo.AppId = GetValue(Parameters, "AppId", ""); catalogInfo.ItemTypeNames = GetValue(Parameters, "itemTypeNames", ""); catalogInfo.IpAddress = GetValue(Parameters, "ipAddress", ""); return(catalogInfo); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="Rest.ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (CatalogInfo != null) { CatalogInfo.Validate(); } if (CustomSetupScriptProperties != null) { CustomSetupScriptProperties.Validate(); } }
public CatalogInfo GetCatalog(SecurityInfo securityInfo, long id) { CatalogInfo catalogInfo = null; if (ValidatePassword(securityInfo)) { IShapingCatalogs shaping = new ShapingCatalogs(dataService, optionService, priceService); catalogInfo = shaping.GetItem(securityInfo.Login, id); } return(catalogInfo); }
/// <summary> /// 创建目录信息 /// </summary> /// <returns></returns> private TreeNode <CatalogInfo> CreateRootTreeNode() { TreeNode <CatalogInfo> node = new TreeNode <CatalogInfo>(); CatalogInfo catalog = new CatalogInfo(); catalog.Guid = CO_IA.Client.Utility.NewGuid(); catalog.Activity_guid = activity.Guid; catalog.Name = string.Format("{0}", activity.Name); node.Value = catalog; catalog.CreateDate = DateTime.Now; return(node); }
// ------------------------------------------------------- // 添加 删除 修改 // ------------------------------------------------------- #region 函数:Save(CatalogInfo param) /// <summary>保存记录</summary> /// <param name="param">实例<see cref="CatalogInfo"/>详细信息</param> /// <returns>实例<see cref="CatalogInfo"/>详细信息</returns> public CatalogInfo Save(CatalogInfo param) { if (!IsExist(param.Id)) { Insert(param); } else { Update(param); } return((CatalogInfo)param); }
// ------------------------------------------------------- // 查询 // ------------------------------------------------------- #region 函数:FindOne(XmlDocument doc) /// <summary>获取详细信息</summary> /// <param name="doc">Xml 文档对象</param> /// <returns>返回操作结果</returns> public string FindOne(XmlDocument doc) { StringBuilder outString = new StringBuilder(); string id = XmlHelper.Fetch("id", doc); CatalogInfo param = this.service.FindOne(id); outString.Append("{\"data\":" + AjaxUtil.Parse <CatalogInfo>(param) + ","); outString.Append(MessageObject.Stringify("0", I18n.Strings["msg_query_success"], true) + "}"); return(outString.ToString()); }
/// <summary> /// Cats the initialize. /// </summary> private void CatInit() { var dataModel = this.crmDatabase.DataModel; this.catInitialized = true; if (this._fixed) { this.catalogInfo = dataModel.GetFixCat(this.catNo); } else { this.catalogInfo = dataModel.GetVarCat(this.catNo); } }
public async Task <ActionResult <CatalogInfo> > AddCatalogInfoAsync(CatalogInfo catalogInfo) { TryValidateModel(catalogInfo); if (ModelState.IsValid) { await catalogContext.CatalogInfo.InsertOneAsync(catalogInfo); return(catalogInfo); } else { return(BadRequest(ModelState)); } }
public ActionResult GetInfo(Guid?id) { if (id.HasValue) { FunctionState function; if (AcDomain.FunctionSet.TryGetFunction(id.Value, out function)) { EntityTypeState functionEntityType; if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Ac", "Function"), out functionEntityType)) { throw new GeneralException(); } var functionInfo = FunctionInfo.Create(functionEntityType.GetData(id.Value)); functionInfo.Add("Name", functionInfo["Description"]); CatalogState parentCatalog; if (!AcDomain.CatalogSet.TryGetCatalog((Guid)functionInfo["ResourceTypeId"], out parentCatalog)) { throw new GeneralException(); } functionInfo.Add("ParentCode", parentCatalog.Code); functionInfo.Add("ParentName", parentCatalog.Name); functionInfo.Add("CategoryCode", "operation"); functionInfo.Add("CategoryName", "绑定在资源类型上的操作"); return(this.JsonResult(functionInfo)); } var recordInfo = CatalogInfo.Create(base.EntityType.GetData(id.Value)); if (recordInfo == null) { return(this.JsonResult(GetEmptyCatalogInfo())); } AppSystemState appSystem; if (AcDomain.AppSystemSet.TryGetAppSystem(id.Value, out appSystem)) { EntityTypeState appSystemEntityType; if (!AcDomain.EntityTypeSet.TryGetEntityType(new Coder("Ac", "AppSystem"), out appSystemEntityType)) { throw new GeneralException(); } recordInfo.Add("data", AppSystemInfo.Create(appSystemEntityType.GetData(id.Value))); } return(this.JsonResult(recordInfo)); } else { return(this.JsonResult(GetEmptyCatalogInfo())); } }
/// <summary> /// 保存目录信息 /// </summary> /// <param name="catalog"></param> public static bool SaveCatalog(CatalogInfo catalog, out string errormsg) { errormsg = null; try { BeOperationInvoker.Invoke <I_CO_IA_ActivityManage>(channel => { channel.SaveCatalog(catalog); }); return(true); } catch (Exception ex) { errormsg = ex.GetExceptionMessage(); return(false); } }
/// <summary>创建新的对象</summary> /// <param name="doc">Xml 文档对象</param> /// <returns>返回操作结果</returns> public string CreateNewObject(XmlDocument doc) { StringBuilder outString = new StringBuilder(); CatalogInfo param = new CatalogInfo(); param.Id = DigitalNumberContext.Generate("Key_Guid"); param.Status = 1; param.ModifiedDate = param.CreatedDate = DateTime.Now; outString.Append("{\"data\":" + AjaxUtil.Parse <CatalogInfo>(param) + ","); outString.Append(MessageObject.Stringify("0", I18n.Strings["msg_query_success"], true) + "}"); return(outString.ToString()); }
public static bool Update(CatalogInfo entity) { bool result; if (entity == null) { result = false; } else if (BizBase.dbo.UpdateModel <CatalogInfo>(entity)) { CacheUtils.Del("JsonLeeCMS_CacheForGetCMSCatalog"); result = true; } else { result = false; } return(result); }
public static int Add(CatalogInfo entity) { int result; if (entity == null) { result = 0; } else { int num = BizBase.dbo.InsertModel <CatalogInfo>(entity); if (num > 0) { CacheUtils.Del("JsonLeeCMS_CacheForGetCMSCatalog"); } result = num; } return(result); }
/// <summary> /// Writes the fix cat information. /// </summary> /// <param name="statement"> /// The statement. /// </param> /// <param name="catalogInfo"> /// The catalog information. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public int WriteFixCatInfo(DatabaseStatement statement, CatalogInfo catalogInfo) { if (statement == null) { return(0); } try { statement.Reset(); statement.Bind(1, catalogInfo.CatalogNr); statement.ExecuteNonQuery(); return(0); } catch (Exception) { return(1); } }
private void SaveMediaItems(IVideo video) { try { var artist = video.GetArtist(securityContext, mediaFactory, mediaItemRepository); mediaItemRepository.Save(new List <IArtist> { artist }); tagRepository.Save(artist.GetTags()); var album = video.GetAlbum(securityContext, mediaFactory, mediaItemRepository, artist); mediaItemRepository.Save(new List <IAlbum> { album }); tagRepository.Save(album.GetTags()); var clip = video.GetClip(securityContext, mediaFactory, mediaItemRepository, artist, album); mediaItemRepository.Save(new List <IClip> { clip }); tagRepository.Save(clip.GetTags()); var clipDate = clip.FromDate > DateTime.MinValue ? clip.FromDate : clip.ToDate; if (album.FromDate == DateTime.MinValue && clipDate != DateTime.MinValue) { var identityInfo = new IdentityInfo(album.Location, album.Type, album.Name, album.Summary, clipDate, clipDate, album.Number); var sizeInfo = new SizeInfo(album.Duration, album.Height, album.Width); var creatorInfo = new CreatorInfo(album.Creator, album.CreatorName); var catalogInfo = new CatalogInfo(album.Catalog, album.CatalogName); var targetInfo = new TargetInfo(album.Target, album.TargetType); var userInfo = new UserInfo(album.User, album.UserName); var thumbnailInfo = new ThumbnailInfo(album.Thumbnail, album.ThumbnailData); album = new Album(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo); mediaItemRepository.Save(new List <IAlbum> { album }); } } catch (Exception ex) { logger.Error(" CatalogSpider.SaveMediaItems", ex); } }
protected virtual T ReadItem <T>(IDataRecord record) where T : class, IMetadata { var location = record.GetUri("Location"); var defaultItem = GetDefaultItem <T>(); if (defaultItem != null && defaultItem.Location.ToString() == location.ToString()) { return(defaultItem); } var name = record.GetString("Name"); var summary = record.GetString("Summary"); var fromDate = record.GetDateTime("FromDate"); var toDate = record.GetDateTime("ToDate"); var number = record.GetUInt32("Number"); var duration = record.GetTimeSpan("Duration"); var height = record.GetUInt32("Height"); var width = record.GetUInt32("Width"); var creator = record.GetUri("Creator"); var creatorName = record.GetString("CreatorName"); var catalog = record.GetUri("Catalog"); var catalogName = record.GetString("CatalogName"); var target = record.GetUri("Target"); var targetType = record.GetString("TargetType"); var user = record.GetUri("User"); var userName = record.GetString("UserName"); var thumbnail = record.GetUri("Thumbnail"); var thumbnailData = record.GetBytes("ThumbnailData"); var identityInfo = new IdentityInfo(location, defaultItem.Type, name, summary, fromDate, toDate, number); var sizeInfo = new SizeInfo(duration, height, width); var creatorInfo = new CreatorInfo(creator, creatorName); var catalogInfo = new CatalogInfo(catalog, catalogName); var targetInfo = new TargetInfo(target, targetType); var userInfo = new UserInfo(user, userName); var thumbnailInfo = new ThumbnailInfo(thumbnail, thumbnailData); return(BuildItem <T>(identityInfo, sizeInfo, creatorInfo, catalogInfo, targetInfo, userInfo, thumbnailInfo)); }