private void ImportOneUnit(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, Operations.IFacade exec, ImportContextWrapper wrapper, SchemaObjectBase parent, int totalSteps, AdminUnit unit) { int currentStep = 0; var scopes = (from m in objectSet.Membership where m.ContainerID == unit.ID && m.MemberSchemaType == AUCommon.SchemaAUAdminScope && m.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on m.ID equals o.ID where o.SchemaType == AUCommon.SchemaAUAdminScope && o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal select (AUAdminScope)o).ToArray(); var roles = (from m in objectSet.Membership where m.ContainerID == unit.ID && m.MemberSchemaType == AUCommon.SchemaAdminUnitRole && m.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on m.ID equals o.ID where o.SchemaType == AUCommon.SchemaAdminUnitRole && o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal select (AURole)o).ToArray(); try { currentStep++; wrapper.SetStatusAndLog(currentStep, totalSteps, "正在导入管理单元" + unit.GetQualifiedName()); exec.AddAdminUnitWithMembers(unit, (AdminUnit)parent, roles, scopes); ImportRoleMembers(objectSet, exec, wrapper, totalSteps, unit, currentStep, roles); ImportConditions(objectSet, exec, wrapper, totalSteps, unit, currentStep, scopes); if (this.ImportSubUnits) { wrapper.IncreaseLevel(); var subs = (from r in objectSet.Relations where r.ParentID == unit.ID && r.ChildSchemaType == AUCommon.SchemaAdminUnit && r.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on r.ID equals o.ID where o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal && o.SchemaType == AUCommon.SchemaAdminUnit select (AdminUnit)o).ToArray(); int count = subs.Length; foreach (AdminUnit s in subs) { ImportOneUnit(objectSet, exec, wrapper, unit, count, s); } wrapper.DecreaseLevel(); } } catch (Exception ex) { wrapper.IncreaseError(); wrapper.SetStatusAndLog(currentStep, totalSteps, string.Format("导入单元 {0} 失败,原因是:{1}", unit.GetQualifiedName(), ex.ToString())); } }
public void TestMCSUniqueness() { Dictionary <TagEPCURI_SGTIN, int> TIDmap = new Dictionary <TagEPCURI_SGTIN, int>(); for (int index = 0; index < _NumTags - 1; index++) { object tag = _Reader.SingulateTagAssisted(index); TagEPCURI_SGTIN epc = default(TagEPCURI_SGTIN); taginfo info = _TagInfos[index]; TID tid = default(TID); Console.WriteLine("Testing tag at position {0}", index); DecodeError res0 = default(DecodeError); res0 = _Reader.ReadTID(tag, out tid); Assert.AreEqual(res0, DecodeError.None); res0 = _Reader.ReadEPC_SGTIN(tag, out epc); Assert.AreEqual(res0, DecodeError.None); Console.WriteLine("Generating serial via MCS"); bool resB = false; TagEPCURI_SGTIN epc1 = default(TagEPCURI_SGTIN); resB = MCS.GenerateEPC(ref tid, ref epc, out epc1); Assert.AreEqual(resB, true); // there should not be any equal values Assert.AreEqual(false, TIDmap.ContainsKey(epc1)); TIDmap.Add(epc1, index); } }
public void DoImport(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, IImportContext context) { var exec = this.IgnorePermission ? Operations.Facade.DefaultInstance : Operations.Facade.InstanceWithPermissions; ImportContextWrapper wrapper = new ImportContextWrapper(context); if (string.IsNullOrEmpty(this.ParentID)) throw new InvalidOperationException("操作前必须对ParentID进行赋值"); var parent = AUCommon.DoDbProcess<SchemaObjectBase>(() => PC.Adapters.SchemaObjectAdapter.Instance.Load(this.ParentID)); if (parent == null || parent.Status != Schemas.SchemaProperties.SchemaObjectStatus.Normal) throw new AUObjectException("不存在指定的父级单元,请确认"); if (parent is AUSchema) parent = null; else if (!(parent is AdminUnit)) { throw new AUObjectException("指定的ParentID不是一个AUSchema或者AdminUnit对象的ID"); } var subs = (from r in objectSet.Relations where r.ParentID == this.ParentID && r.ChildSchemaType == AUCommon.SchemaAdminUnit && r.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal join o in objectSet.Objects on r.ID equals o.ID where o.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal && o.SchemaType == AUCommon.SchemaAdminUnit select (AdminUnit)o).ToArray(); int count = subs.Length; foreach (AdminUnit s in subs) { ImportOneUnit(objectSet, exec, wrapper, parent, count, s); } }
public void DoImport(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, IImportContext context) { var exec = this.IgnorePermission ? Operations.Facade.DefaultInstance : Operations.Facade.InstanceWithPermissions; IEnumerable<SchemaObjectBase> schemas; if (string.IsNullOrEmpty(TargetCategory)) schemas = objectSet.Objects.Where(m => m.SchemaType == AUCommon.SchemaAUSchema && m.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal); else schemas = objectSet.Objects.Where(m => m.SchemaType == AUCommon.SchemaAUSchema && m.Status == Schemas.SchemaProperties.SchemaObjectStatus.Normal && ((AUSchema)m).CategoryID == TargetCategory); int allCount = schemas.Count(); int count = 0; foreach (AUSchema item in schemas) { count++; try { context.SetStatusAndLog(count, allCount, "正在导入对象:" + item.GetQualifiedName()); exec.AddAdminSchema(item); ImportSchemaRoles(objectSet, context, exec, item); } catch (Exception ex) { context.ErrorCount++; context.AppendLog("对项的操作失败,原因是:" + ex.Message); } } }
public ImportExecutor(HttpPostedFile file, MCS.Web.WebControls.UploadProgressResult result) { this.file = file; this.result = result; this.log = new System.Text.StringBuilder(4096); this.status = new UploadProgressStatus(); }
public void DoImport(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, IImportContext context) { var exec = Operations.Facade.InstanceWithPermissions; if (string.IsNullOrEmpty(this.AUSchemaID)) throw new InvalidOperationException("操作前必须对SchemaID进行赋值"); var item = (AUSchema)Adapters.AUSnapshotAdapter.Instance.LoadAUSchema(this.AUSchemaID, true, DateTime.MinValue).FirstOrDefault(); if (item == null) throw new AUObjectValidationException("不存在指定的管理架构,或已删除。"); var roles = (from p in objectSet.Membership where p.ContainerID == item.ID && p.MemberSchemaType == AUCommon.SchemaAUSchemaRole join q in objectSet.Objects on p.ID equals q.ID where q.SchemaType == AUCommon.SchemaAUSchemaRole select q); int total = roles.Count(); int roleCount = 0; foreach (AUSchemaRole role in roles) { roleCount++; try { context.SetStatusAndLog(roleCount, total, "正在添加角色:" + role.GetQualifiedName()); exec.AddAdminSchemaRole(role, item); } catch (Exception ex) { context.AppendLog("对角色的操作失败,原因是:" + ex.Message); } } }
private void GuiDataUpdate(long lTime, MCS.GuiDataItem item) { lock (buf) { buf.Enqueue(item); m_ltime64 = lTime; } }
private void ModifyViewCubeLength(double newValue) { var newCornerPoints = Calculations.ComputeCubeCordinates(MCS.ProjectedCubeCenter.ToVector3D(), newValue); var hypotheticalPlanePos = MCS.HypotheticalCubeCenter; var hypotheticalPlaneNormal = -1 * MCS.DetectorPlaneNormal; var hypotheticalCubePoints = Calculations.ProjectCubeCordinates(newCornerPoints, hypotheticalPlanePos, hypotheticalPlaneNormal, true); MCS.ModifyCubeSideLenghts(hypotheticalCubePoints, newCornerPoints); }
public void DCMCheckIn(int fileId, string comment, MCS.Library.SOA.DocServiceContract.DCTCheckinType checkInType) { using (DocLibContext context = new DocLibContext(ServiceHelper.GetDocumentLibraryName())) { File file = getFileById(fileId, context); file.CheckIn(comment, (CheckinType)checkInType); context.ExecuteQuery(); } }
private void LoadNodes(MCS.Web.Responsive.WebControls.DeluxeTreeNode oItem, TreeNode oTreeNode) { oTreeNode.Tag = oItem; foreach (MCS.Web.Responsive.WebControls.DeluxeTreeNode oChild in oItem.Nodes) { TreeNode oChildNode = new TreeNode(oChild.Text); LoadNodes(oChild, oChildNode); oTreeNode.Nodes.Add(oChildNode); } }
protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext) { var subCates = AU.Adapters.SchemaCategoryAdapter.Instance.LoadSubCategories(parentNode.Value); foreach (var item in subCates) { DeluxeTreeNode node = CreateTreeNode(item.ID, item.Name, item.Name, item.Name); node.ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal; node.Expanded = true; result.Add(node); } }
private void LoadNodes(MCS.Web.WebControls.MenuItem oItem, TreeNode oTreeNode) { oTreeNode.Tag = oItem; foreach (MCS.Web.WebControls.MenuItem oChild in oItem.ChildItems) { TreeNode oChildNode = new TreeNode(oChild.Text); LoadNodes(oChild, oChildNode); oTreeNode.Nodes.Add(oChildNode); } }
internal static void SaveSearchCondition(MCS.Web.WebControls.SearchEventArgs e, MCS.Web.WebControls.DeluxeSearch control, string pageKey, object dataToSave) { if (e.IsSaveCondition && string.IsNullOrEmpty(e.ConditionName) == false) { UserCustomSearchCondition condition = Util.NewSearchCondition(pageKey, "Default", e.ConditionName); condition.ConditionContent = JSONSerializerExecute.Serialize(dataToSave); UserCustomSearchConditionAdapter.Instance.Update(condition); control.UserCustomSearchConditions = Util.LoadSearchCondition(pageKey, "Default"); } }
private void ImportConditions(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, Operations.IFacade exec, ImportContextWrapper wrapper, int totalSteps, AdminUnit unit, int currentStep, AUAdminScope[] scopes) { if (this.IncludeScopeConditions) { wrapper.SetStatusAndLog(currentStep, totalSteps, "正在导入管理单元管理范围条件" + unit.GetQualifiedName()); foreach (AUAdminScope sc in scopes) { var conditions = (from c in objectSet.Conditions where c.OwnerID == sc.ID select c); foreach (var c in conditions) { DBTimePointActionContext.Current.DoActions(() => exec.UpdateScopeCondition(sc, c)); } } } }
public static void write(IceInternal.BasicStream os__, MCS.GuiHub.PushData[] v__) { if(v__ == null) { os__.writeSize(0); } else { os__.writeSize(v__.Length); for(int ix__ = 0; ix__ < v__.Length; ++ix__) { os__.writeByte((byte)v__[ix__], 10); } } }
//Явная загрузка (точечная загрузка, удобна когда связь медленная) public static void Expl02() { MCS db = new MCS(); //Загрузка одной вкладки AccessTab tab = db.AccessTab.Where(w => w.intTabID == 1).FirstOrDefault(); addExpl02(tab); //Загрузка связанные данные с этой вкладки // db.Entry(tab).Collection(c => c.AccessUser).Load(); //Console.WriteLine(tab.strTabName); //foreach (var user in tab.AccessUser) //{ // Console.WriteLine("\t--> " + user.intUserId); //} }
public void TestMCS() { Console.WriteLine("Testing MCS"); for (int index = 0; index < _NumTags; index++) { object tag = _Reader.SingulateTagAssisted(index); TID tid = default(TID); TagEPCURI_SGTIN epc = default(TagEPCURI_SGTIN); taginfo info = _TagInfos[index]; Console.WriteLine("Testing tag at position {0}", index); DecodeError res = default(DecodeError); res = _Reader.ReadTID(tag, out tid); Assert.AreEqual(res, DecodeError.None); DecodeError res0 = _Reader.ReadEPC_SGTIN(tag, out epc); Assert.AreEqual(res0, DecodeError.None); Console.WriteLine("Generating a new EPC"); if ((tid.Serial != null) && tid.Serial.Length > 0) { TagEPCURI_SGTIN epc1 = default(TagEPCURI_SGTIN); var res1 = MCS.GenerateEPC(ref tid, ref epc, out epc1); Assert.IsTrue(res1); Console.WriteLine("New EPC SGTIN Pure Identity Tag URI {0}", epc1.Identity.URI); // Round-tripping should produce exactly the data that we want to see //res = _Reader.WriteEPC(tag, epc1) //Assert.IsTrue(res) //Dim epc1 As TagEPCURI_SGTIN //res = _Reader.ReadEPC(tag, epc1) //Assert.IsTrue(res) //Assert.AreEqual(epc, epc1) } else { Console.WriteLine("Skipping, because the TID does not provide a serial number"); } } }
protected object MultiProcessControl1_ExecutePrepareData(object data, MCS.Web.WebControls.IMultiProcessPrepareData owner) { List<int> result = new List<int>(); int i = 0; foreach (string item in (IEnumerable)data) { System.Threading.Thread.Sleep(600); for(int j = 0; j < 10; j++) result.Add(i * 10 + j); owner.ResponsePrepareDataInfo("正在准备数据..." + i++.ToString()); } owner.ResponsePrepareDataInfo(string.Empty); return result.ToArray(); }
protected void BtnSearchClick(object sender, MCS.Web.WebControls.SearchEventArgs e) { DeluxeSearch1.HasCategory = true; if (DeluxeSearch1.IsAdvanceSearching) { DeluxeSearch1.ClearWhereSqlClauses(); } supplierGrid.Condition = DeluxeSearch1.GetCondition();//GetSqlString();//ConnectiveSqlClauses.ToSqlString(TSqlBuilder.Instance); supplierGrid.LastQueryRowCount = -1; relativeLinkGroupGrid.SelectedKeys.Clear(); relativeLinkGroupGrid.PageIndex = 0; relativeLinkGroupGrid.DataBind(); if(e.IsSaveCondition&&!string.IsNullOrEmpty(e.ConditionName)) { UserCustomSearchCondition condition = new UserCustomSearchCondition() { ID = Guid.NewGuid().ToString(), UserID = DeluxeSearch1.User.ID, ResourceID = "12c2e9c8-a6e1-4e48-a3d2-17537c750272", ConditionName = e.ConditionName, ConditiontType = "test", CreateTime = DateTime.Now }; bindingControl.Data = new SupplierSearch(); bindingControl.CollectData(); condition.ConditionContent = JSONSerializerExecute.Serialize(bindingControl.Data); UserCustomSearchConditionAdapter.Instance.Update(condition); } DeluxeSearch1.UserCustomSearchConditions = UserCustomSearchConditionAdapter.Instance.Load(c => { c.AppendItem("RESOURCE_ID", "12c2e9c8-a6e1-4e48-a3d2-17537c750272"); c.AppendItem("CONDITION_TYPE", "test"); }); }
//Прямая загрузка public static void Expl01() { MCS db = new MCS(); db.Database.Log = (s => System.Diagnostics.Debug.WriteLine(s)); int i = 0; foreach (var accessTab in db.AccessTab) { i++; Console.WriteLine(accessTab.strTabName); foreach (var user in accessTab.AccessUser) { Console.WriteLine("\t-->" + user.intUserId); } } List <AccessTab> tabs = db.AccessTab.Include(c => c.AccessUser) //.Include() можно подключать несколько include .ToList(); }
private void ImportSchemaRoles(MCS.Library.SOA.DataObjects.Security.SCObjectSet objectSet, IImportContext context, Operations.IFacade exec, AUSchema item) { if (this.IncludeSchemaRoles) { var roles = (from p in objectSet.Membership where p.ContainerID == item.ID && p.MemberSchemaType == AUCommon.SchemaAUSchemaRole join q in objectSet.Objects on p.ID equals q.ID select q); int total = roles.Count(); int roleCount = 0; foreach (AUSchemaRole role in roles) { roleCount++; try { context.SetSubStatusAndLog(roleCount, total, "正在添加角色:" + role.GetQualifiedName()); exec.AddAdminSchemaRole(role, item); } catch (Exception ex) { context.ErrorCount++; context.AppendLog("对角色的操作失败,原因是:" + ex.Message); } } } }
protected void postControl_DoPostedData(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { string unitID = e.ClientExtraPostedData; var unit = DbUtil.GetEffectiveObject<AU.AdminUnit>(unitID); var status = new UploadProgressStatus(); StringBuilder output = new StringBuilder(); try { status.MinStep = 1; status.MaxStep = e.Steps.Count + 1; status.CurrentStep = 1; AU.AUSchemaRole currentRole = null; foreach (Dictionary<string, object> item in e.Steps) { currentRole = DoAction(unit, status, output, currentRole, item); status.Response(); status.CurrentStep++; } } catch (Exception ex) { status.StatusText = ex.Message; output.AppendLine(ex.ToString()); status.Response(); } finally { output.AppendLine("结束"); e.Result.CloseWindow = false; e.Result.ProcessLog = output.ToString(); } }
protected override void DoRelativeDataOperation(MCS.Library.SOA.DataObjects.Security.AUObjects.Executors.AUObjectOperationContext context) { base.DoRelativeDataOperation(context); this.pendingActions.DoActions(); }
public static PropertyEditorSceneAdapter Create(MCS.Library.SOA.DataObjects.Security.SchemaObjectBase schemaObj) { var category = ObjectSchemaSettings.GetConfig().Schemas[schemaObj.SchemaType].Category; return PropertyEditorSceneAdapter.CreateByCategory(category); }
protected void Processing(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { ProcessProgress.Current.MinStep = 0; ProcessProgress.Current.MaxStep = ProcessProgress.Current.CurrentStep = 1; StepContext context = new StepContext(); try { string fromUnitID = (string)e.Steps[0]; string newName = (string)e.Steps[1]; string newCodeName = (string)e.Steps[2]; string toUnitID = (string)e.Steps[3]; bool copyRoleMembers = (bool)e.Steps[4]; bool copyScopeMembers = (bool)e.Steps[5]; bool copyScopeConditions = (bool)e.Steps[6]; var fromUnit = DbUtil.GetEffectiveObject<AU.AdminUnit>(fromUnitID); string schemaID = fromUnit.AUSchemaID; if (string.IsNullOrEmpty(schemaID)) throw new AUObjectException("无法获取要复制单元的架构ID"); var targetParent = toUnitID == schemaID ? null : DbUtil.GetEffectiveObject<AU.AdminUnit>(toUnitID); if (targetParent != null && fromUnit.AUSchemaID != targetParent.AUSchemaID) throw new AU.AUObjectException("选择的目标父级单元与子级单元架构不同"); DoCopyUnit(context, fromUnit, targetParent, newName, newCodeName, copyRoleMembers, copyScopeMembers, copyScopeConditions); } catch (AUObjectValidationException vex) { ProcessProgress.Current.Output.WriteLine(vex.Message); } catch (Exception ex) { ProcessProgress.Current.Output.WriteLine(ex.ToString()); } e.Result.ProcessLog = context.Logger.ToString(); ProcessProgress.Current.StatusText = "结束"; ProcessProgress.Current.Response(); SCCacheHelper.InvalidateAllCache(); e.Result.DataChanged = true; e.Result.CloseWindow = false; e.Result.ProcessLog = ProcessProgress.Current.GetDefaultOutput(); }
protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext) { var subUnits = AU.Adapters.AUSnapshotAdapter.Instance.LoadSubUnits(callBackContext, parentNode.Value, true, DateTime.MinValue); foreach (AU.AdminUnit item in subUnits) { AddUnitToTree(item, result); } }
private DeluxeTreeNode AddSchemaToTree(AU.AUSchema item, MCS.Web.WebControls.DeluxeTreeNodeCollection treeNodes) { DeluxeTreeNode node = new MCS.Web.WebControls.DeluxeTreeNode(item.Name, item.ID) { NodeOpenImg = ControlResources.OULogoUrl, NodeCloseImg = ControlResources.OULogoUrl, CssClass = "au-catenode", ChildNodesLoadingType = ChildNodesLoadingTypeDefine.Normal, ExtendedData = "Schema", Expanded = true }; treeNodes.Add(node); return node; }
private void AddUnitToTree(AU.AdminUnit item, MCS.Web.WebControls.DeluxeTreeNodeCollection treeNodes) { treeNodes.Add(new MCS.Web.WebControls.DeluxeTreeNode(item.Name, item.ID) { NodeOpenImg = ControlResources.OULogoUrl, NodeCloseImg = ControlResources.OULogoUrl, CssClass = "au-catenode", ChildNodesLoadingType = ChildNodesLoadingTypeDefine.LazyLoading, ExtendedData = "AU", SubNodesLoaded = false }); }
private static string ToMessage(MCS.Library.Validation.ValidationResult validationResult) { return string.Format("属性验证“{0}”:{1}", validationResult.Key, validationResult.Message); }
protected void signInControl_BeforeAuthenticate(MCS.Library.Core.LogOnIdentity loi) { //如果需要验证码认证,将AuthenticationCode放在loi中即可 //loi.Context["AuthenticationCode"] = UuidHelper.NewUuidString(); //loi.Context["AlternativeUserIDs"] = new string[] { "fanhy" }; }
void MyWorkerThread(object request) { var req0 = (OverwriteRequest)request; // parse GTIN14 string, how? // we need to extract CompanyPrefix (as long) and ItemRef (as long) var GTIN14AndGCPLen = req0.GTIN14; IdentityEPCURI_SGTIN primedURI; { var ix = GTIN14AndGCPLen.IndexOf(';'); if (ix == -1) { if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Invalid GTIN-14: " + GTIN14AndGCPLen))); } return; } else { string GTIN14; int GCPLen; GTIN14 = GTIN14AndGCPLen.Substring(0, ix); GCPLen = int.Parse(GTIN14AndGCPLen.Substring(ix + 1, GTIN14AndGCPLen.Length - ix - 1)); //Console.WriteLine("{0}, {1}", GTIN14, GPCLen); if (!InterrogatorLib.Decoder.ParseFromGTIN14(GTIN14, GCPLen, out primedURI)) { if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Unable to parse GTIN-14! Unable to continue."))); } return; } } } if (!_reader.IsReady()) { _reader.Initialize(); } // perform reads, then immediately writes, until you finally do it object mtag = null; // TODO: wait for a signal to cancel? // - how to implement such a signal? if (OverwriteStatus != null) { OverwriteStatus(this, new GenericEventArgs <string>("Singulating tag...")); } const int RETRIES = 4; { int ntries = 0; while (mtag == null && ntries < RETRIES) // AS-20160618: decreasing greatly { mtag = _reader.SingulateTag(); System.Threading.Thread.Sleep(100); ntries++; } } if (mtag == null) { if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Unable to singulate tag!"))); } return; } if (OverwriteStatus != null) { OverwriteStatus(this, new GenericEventArgs <string>("Tag singulated, reading TID")); } TagEPCURI_SGTIN epc1; if (req0.Serial == null) { TID tid; var res = DoWithRetries <TID>(RETRIES, out tid, (out TID tid0) => { return(_reader.ReadTID(mtag, out tid0)); }); switch (res) { case DecodeError.Invalid: // signal to the upper layer that this tag is bad, and bail out if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Chip unsupported! Unable to continue."))); } return; case DecodeError.IO: // signal to the user that this tag could not be read, and bail out if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Unable to decode TID! Try again."))); } return; case DecodeError.None: break; // OK } if (!tid.IsSerialized) { // signal to the user that this tag does not support MCS, and bail out // TODO: we could probably handle this too... if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Tag chip does is not serialized! Unable to continue"))); } return; } if (OverwriteStatus != null) { OverwriteStatus(this, new GenericEventArgs <string>("TID read. Reading EPC...")); } TagEPCURI_SGTIN uri; res = DoWithRetries <TagEPCURI_SGTIN>(RETRIES, out uri, (out TagEPCURI_SGTIN uri0) => { // NOTE: when reading, be prepared to supply your password! // how to handle that?? return(_reader.ReadEPC_SGTIN(mtag, out uri0)); }); switch (res) { case DecodeError.IO: // could not the EPC after the retries, bail out //if (TagRead != null) // TagRead(this, new GenericEventArgs<IReadResult>(new ReadResult("Unable to decode EPC! Try again."))); //return; case DecodeError.Invalid: // invalid tag, have to use the GTIN provided by the server uri.Identity = primedURI; break; case DecodeError.None: // good tag, let's roll break; } if (!MCS.GenerateEPC(ref tid, ref uri, out epc1)) { // failed to assign a new EPC if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Unable to assign new EPC! Unable to continue."))); } return; } } else { // serial supplied, write it as-is var serial = req0.Serial.Value; if (serial > int.MaxValue) { // overflowed... if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Unable to write new EPC: serial too big! Unable to continue."))); } return; } epc1 = default(TagEPCURI_SGTIN); epc1.Attribs = 0x0; // ??? not used epc1.Filter = 0x0; // 0: all others // C# needs some Rust-style borrowing stuff for value types! // (or, some linear types would be even nicer, as they are simpler) var identity = primedURI; Trace.WriteLine(string.Format("identity EPC before serial assignment {0}", identity.URI)); identity.SetSerial((long)serial); epc1.Identity = identity; Trace.WriteLine(string.Format("identity EPC after serial assignment {0}", identity.URI)); } #if CHATTY_READER Trace.WriteLine(string.Format("MCS: TID serial {0}, EPC {1}, result EPC {2}", BitConverter.ToString(tid.Serial), uri.Identity.URI, epc1.Identity.URI)); #endif //System.Windows.Forms.MessageBox.Show(String.Format("New EPC SGTIN Pure Identity Tag URI {0}", epc1.Identity.URI)); if (OverwriteStatus != null) { OverwriteStatus(this, new GenericEventArgs <string>("Writing EPC...")); } // TODO: write the new tag and permalock it! bool write_res = WithRetries <TagEPCURI_SGTIN>(RETRIES, epc1, (uri1) => { return(_reader.WriteEPC(mtag, uri1)); }); if (!write_res) { // unable to write the new data, bail out if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult("Unable to write new EPC! Try again."))); } return; } // permalock and report success if (TagRead != null) { TagRead(this, new GenericEventArgs <IReadResult>(new ReadResult() { URI = epc1.Identity.URI })); } }
protected void SearchButtonClick(object sender, MCS.Web.WebControls.SearchEventArgs e) { this.gridMain.PageIndex = 0; Util.UpdateSearchTip(this.DeluxeSearch); //this.AdvanceSearchEnabled = this.DeluxeSearch.IsAdvanceSearching; this.searchBinding.CollectData(); Util.SaveSearchCondition(e, this.DeluxeSearch, ThisPageSearchResourceKey, this.searchBinding.Data); this.InnerRefreshList(); }
protected void DoFileUpload(HttpPostedFile file, MCS.Web.WebControls.UploadProgressResult result) { var fileType = Path.GetExtension(file.FileName).ToLower(); if (fileType != ".xml") throw new InvalidDataException("上传的文件类型错误"); ImportExecutor executor = new ImportExecutor(file, result); var rootOU = PC.SCOrganization.GetRoot(); executor.AddAction(new OguOrganizationImportAction(rootOU) { }); if (Request.Form["includeAcl"] == "includeAcl") executor.AddAction(new OguAclImportAction(rootOU) { }); executor.Execute(); }
protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext) { var excludeSubTree = this.Request.QueryString["superOf"]; var exceptOrg = this.Request.QueryString["exceptOrg"]; var exceptID = excludeSubTree ?? exceptOrg; bool godBehavior = callBackContext == "godMode"; if (excludeSubTree != parentNode.Value) { PC.SCObjectAndRelationCollection relations = PC.Adapters.SCSnapshotAdapter.Instance.QueryObjectAndRelationByParentIDs(PC.SchemaInfo.FilterByCategory("Organizations").ToSchemaNames(), new string[] { parentNode.Value }, false, true, false, DateTime.MinValue); var pmLimitString = this.Request.QueryString.Get("permission"); var requiredPermissions = pmLimitString != null ? pmLimitString.Split(',') : null; PC.Permissions.SCContainerAndPermissionCollection permissions = null; if (requiredPermissions != null) { permissions = PC.Adapters.SCAclAdapter.Instance.LoadCurrentContainerAndPermissions(Util.CurrentUser.ID, relations.ToIDArray()); } BindObjectsToTreeNodes(relations, result, godBehavior, requiredPermissions, permissions, excludeSubTree, exceptID); } }
protected void DoFileUpload(HttpPostedFile file, MCS.Web.WebControls.UploadProgressResult result) { var fileType = Path.GetExtension(file.FileName).ToLower(); if (fileType != ".xml") throw new InvalidDataException("上传的文件类型错误"); ImportExecutor exec = new ImportExecutor(file, result); exec.AddAction(new RoleImportAction(this.ctlUpload.Tag) { IncludeConstMembers = Request.Form["iRoleMembers"] == "iRoleMembers", IncludeConditions = Request.Form["iRoleConditions"] == "iRoleConditions", CopyMode = Request.Form["mergeMode"] == "copyMode", IncludeRoleDefinitions = Request.Form["iDef"] == "iDef" }); exec.Execute(); return; }
protected void tree_GetChildrenData(MCS.Web.WebControls.DeluxeTreeNode parentNode, MCS.Web.WebControls.DeluxeTreeNodeCollection result, string callBackContext) { switch ((string)parentNode.ExtendedData) { case "Category": { var subCates = AUClient.ServiceBroker.AUCenterQueryService.Instance.GetSubCategories(parentNode.Value, true); foreach (var item in subCates) result.Add(CreateNode(item)); var subSchemas = AUClient.ServiceBroker.AUCenterQueryService.Instance.GetAUSchemaByCategory(parentNode.Value, true); foreach (var item in subSchemas) result.Add(CreateNode(item)); } break; case "AUSchema": { var schemaRoles = AUClient.ServiceBroker.AUCenterQueryService.Instance.GetMembers(parentNode.Value, new string[] { "AUSchemaRoles" }, true); foreach (AUClient.ClientAUSchemaRole item in schemaRoles) result.Add(CreateNode(item)); } break; default: break; } }