private T PerformAction <T>(DistributedStoreKey key, RequestInfo req, bool isPrimary, Func <IDistributedStoreKey, bool, StoreKind, T> func) { IDistributedStoreKey arg = isPrimary ? key.PrimaryStoreKey : key.ShadowStoreKey; StoreKind storeKind = isPrimary ? this.StoreSettings.Primary : this.StoreSettings.Shadow; this.PerfTracker.UpdateStart(key, storeKind, isPrimary); Exception exception = null; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); T result; try { result = func(arg, isPrimary, storeKind); } catch (Exception ex) { exception = ex; throw; } finally { this.PerfTracker.UpdateFinish(key, storeKind, isPrimary, req, stopwatch.ElapsedMilliseconds, exception, false); } return(result); }
private void ComboBoxBinding() { DataSet dsSalesman = GetComboxDs("SalesList"); DataSet dsLocation = GetComboxDs("LocationList"); DataSet dsUnit = GetComboxDs("UnitBinding"); DataSet dsItem = GetComboxDs("ItemBinding"); DataSet dsKind = GetComboxDs("QtyKindBinding"); DataSet dsCurrencysList = GetComboxDs("CurrencysInvoice"); DataSet dsGetItem = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_GetItem_SP", new List <IFields> { dal.CreateIFields() .Append("Option", "GetItem").Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]).Append("SYS", "A") }).GetList(); StoreGetItem.DataSource = dsGetItem; StoreGetItem.DataBind(); StoreCurrInvoice.DataSource = dsCurrencysList; StoreCurrInvoice.DataBind(); StoreLocation.DataSource = dsLocation; StoreLocation.DataBind(); StoreUnit.DataSource = dsUnit; StoreUnit.DataBind(); StoreKind.DataSource = dsKind; StoreKind.DataBind(); StoreSalesman.DataSource = dsSalesman; StoreSalesman.DataBind(); ControlBinder.CmbBinder(StoreAgentLocal, "PPCC", "A"); }
public void StoreKind_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { DataSet dsKind = GetList("QtyKindBinding"); StoreKind.DataSource = dsKind; StoreKind.DataBind(); }
public PerformanceEntry(StoreKind storeKind, bool isPrimary) { this.StoreKind = storeKind; this.IsPrimary = isPrimary; this.LatencyMap = new Dictionary <string, PerformanceEntry.LatencyMeasure>(); this.ExceptionCountMap = new Dictionary <string, int>(); this.ApiMap = new Dictionary <OperationCategory, PerformanceEntry.ApiMeasure>(); }
public void UpdateStart(DistributedStoreKey key, StoreKind storeKind, bool isPrimary) { lock (this.locker) { PerformanceEntry orAdd = this.GetOrAdd(storeKind, isPrimary); orAdd.RecordStart(); } }
/// <summary> /// 绑定ComboBox /// </summary> #region ComboBoxBinder() Author :Micro (2011-09-06) void ComboBoxBinder() { //StoreCmb.DataSource = GetList("CompanyList"); //StoreCmb.DataBind(); //StoreCmbName.DataSource = GetList("CompanyListByName"); //StoreCmbName.DataBind(); //StoreCurrLocal.DataSource = GetList("CurrencysListLocal"); //StoreCurrLocal.DataBind(); ControlBinder.CmbBinder(StoreAgentLocal, "PPCC", "A"); DataSet dsLocation = GetList("LocationList"); StoreLocation.DataSource = dsLocation; StoreLocation.DataBind(); DataSet dsUnit = GetList("UnitBinding"); StoreUnit.DataSource = dsUnit; StoreUnit.DataBind(); DataSet dsCurrency = GetList("CurrencysList"); StoreCurrency.DataSource = dsCurrency; StoreCurrency.DataBind(); DataSet dsSales = GetList("SalesList"); StoreSalesman.DataSource = dsSales; StoreSalesman.DataBind(); //DataSet dsItem = GetList("ItemBinding"); //StoreItem.DataSource = dsItem; //StoreItem.DataBind(); //l_item.Template.Html = Template.Html; DataSet dsGetItem = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_GetItem_SP", new List <IFields> { dal.CreateIFields() .Append("Option", "GetItem").Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]).Append("SYS", "A") }).GetList(); StoreGetItem.DataSource = dsGetItem; StoreGetItem.DataBind(); DataSet dsKind = GetList("QtyKindBinding"); StoreKind.DataSource = dsKind; StoreKind.DataBind(); StoreCurrInvoice.DataSource = GetList("CurrencysInvoice"); StoreCurrInvoice.DataBind(); //CmbFromRight.Template.Html = Template.Html; //CmbToRight.Template.Html = Template.Html; //CmbUnit.Template.Html = Template.Html; //l_unit.Template.Html = Template.Html; }
public void UpdateFinish(DistributedStoreKey key, StoreKind storeKind, bool isPrimary, RequestInfo req, long latencyInMs, Exception exception, bool isSkipped) { this.LogExecution(key, storeKind, isPrimary, req, latencyInMs, exception, isSkipped); lock (this.locker) { PerformanceEntry orAdd = this.GetOrAdd(storeKind, isPrimary); orAdd.RecordFinish(req, latencyInMs, exception, isSkipped); } }
public void GetBytes_StoreInstruction(StoreKind storeKind) { var instruction = new StoreInstruction(storeKind, (byte)0x03); var expectedBytes = InstructionByteBuilder.Create() .Opcode(Opcode.Store, storeKind, (byte)0x03) .AsSpan(); var actualBytes = instruction.GetBytes(); Assert.True(expectedBytes.SequenceEqual(actualBytes)); }
public void Decode_StoreInstructionFromByteArray_RegistryIndexAndStoreTypeAreSet() { const StoreKind expectedStoreType = StoreKind.Field; const byte expectedIndex = 0x05; var bytes = InstructionByteBuilder.Create() .Opcode(Opcode.Store, expectedStoreType, expectedIndex) .ToArray(); var storeInstruction = AssertBytesDecodedAs <StoreInstruction>(bytes); Assert.Equal(expectedIndex, storeInstruction.Index); Assert.Equal(expectedStoreType, storeInstruction.StoreKind); }
private PerformanceEntry GetOrAdd(StoreKind storeKind, bool isPrimary) { PerformanceEntry performanceEntry = (storeKind == StoreKind.Clusdb) ? this.clusdbPerfEntry : this.dxstorePerfEntry; if (performanceEntry == null) { performanceEntry = new PerformanceEntry(storeKind, isPrimary); if (storeKind == StoreKind.Clusdb) { this.clusdbPerfEntry = performanceEntry; } else { this.dxstorePerfEntry = performanceEntry; } } return(performanceEntry); }
public void LogExecution(DistributedStoreKey key, StoreKind storeKind, bool isPrimary, RequestInfo req, long latencyInMs, Exception exception, bool isSkipped) { if (!isPrimary && !RegistryParameters.DistributedStoreIsLogShadowApiResult) { return; } bool flag = exception == null && !isSkipped; string text = req.OperationCategory.ToString(); string text2 = (key != null) ? key.FullKeyName : string.Empty; string debugStr = req.DebugStr; string text3 = (key != null) ? key.InstanceId.ToString() : string.Empty; string text4 = string.Empty; if (RegistryParameters.DistributedStoreIsLogApiExecutionCallstack) { text4 = new StackTrace(3, true).ToString(); } if (flag) { if (RegistryParameters.DistributedStoreIsLogApiSuccess) { if (this.apiExecutionPeriodicLogDuration != TimeSpan.Zero) { DxStoreHACrimsonEvents.ApiExecutionSuccess.LogPeriodic <string, bool, StoreKind, bool, string, OperationType, string, long, string, bool, string, string, string, string>(text, this.apiExecutionPeriodicLogDuration, text, isPrimary, storeKind, true, text2, req.OperationType, req.InitiatedTime.ToString("o"), latencyInMs, string.Empty, false, debugStr, text3, text4, this.CurrentProcessName); return; } DxStoreHACrimsonEvents.ApiExecutionSuccess.Log <string, bool, StoreKind, bool, string, OperationType, string, long, string, bool, string, string, string, string>(text, isPrimary, storeKind, true, text2, req.OperationType, req.InitiatedTime.ToString("o"), latencyInMs, string.Empty, false, debugStr, text3, text4, this.CurrentProcessName); } return; } string text5 = isSkipped ? "<ApiSkipped>" : exception.ToString(); string text6 = text + ((exception == null) ? string.Empty : exception.GetType().Name); if (this.apiExecutionPeriodicLogDuration != TimeSpan.Zero) { DxStoreHACrimsonEvents.ApiExecutionFailed.LogPeriodic <string, bool, StoreKind, bool, string, OperationType, string, long, string, bool, string, string, string, string>(text6, this.apiExecutionPeriodicLogDuration, text, isPrimary, storeKind, false, text2, req.OperationType, req.InitiatedTime.ToString("o"), latencyInMs, text5.Substring(0, Math.Min(text5.Length, 5000)), isSkipped, debugStr, text3, text4, this.CurrentProcessName); return; } DxStoreHACrimsonEvents.ApiExecutionFailed.Log <string, bool, StoreKind, bool, string, OperationType, string, long, string, bool, string, string, string, string>(text, isPrimary, storeKind, false, text2, req.OperationType, req.InitiatedTime.ToString("o"), latencyInMs, text5.Substring(0, Math.Min(text5.Length, 5000)), isSkipped, debugStr, text3, text4, this.CurrentProcessName); }
/// <summary> /// 绑定ComboBox /// </summary> #region ComboBoxBinder() Author :Micro (2011-09-06) void ComboBoxBinder() { ControlBinder.CmbBinder(StoreAgentLocal, "PPCC", "O"); DataSet dsLocation = GetList("LocationList"); StoreLocation.DataSource = dsLocation; StoreLocation.DataBind(); DataSet dsUnit = GetList("UnitBinding"); StoreUnit.DataSource = dsUnit; StoreUnit.DataBind(); DataSet dsGetItem = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_GetItem_SP", new List <IFields> { dal.CreateIFields() .Append("Option", "GetItem").Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]).Append("SYS", "O") }).GetList(); StoreGetItem.DataSource = dsGetItem; StoreGetItem.DataBind(); DataSet dsKind = GetList("QtyKindBinding"); StoreKind.DataSource = dsKind; StoreKind.DataBind(); StoreCurrInvoice.DataSource = GetList("CurrencysInvoice"); StoreCurrInvoice.DataBind(); StoreSalesman.DataSource = GetList("SalesList"); StoreSalesman.DataBind(); ControlBinder.CmbBinder(StoreVessel, "VesselList"); cmbVesselText.Template.Html = TempVoyage.Html; }
private void ComboBoxBinding() { ControlBinder.CmbBinder(StoreAgentLocal, "PPCC", "A"); DataSet dsLocation = GetComboxDs("LocationList"); DataSet dsSalesman = GetComboxDs("SalesList"); DataSet dsCompany = new DataSet();//GetComboxDs("CompanyList"); DataSet dsCurrency = GetComboxDs("CurrencysList"); DataSet dsUnit = GetComboxDs("UnitBinding"); //DataSet dsItem = GetComboxDs("ItemBinding"); DataSet dsKind = GetComboxDs("QtyKindBinding"); DataSet dsDept = GetComboxDs("DeptBinding"); DataSet dsForeignKind = GetComboxDs("ForeignKind"); DataSet dsShipKind = GetComboxDs("ShipKind"); DataSet dsCompanyKind = GetComboxDs("CompanyKind"); //StoreCurrLocal.DataSource = GetComboxDs("CurrencysListLocal"); //StoreCurrLocal.DataBind(); StoreLocation.DataSource = dsLocation; StoreLocation.DataBind(); StoreSalesman.DataSource = dsSalesman; StoreSalesman.DataBind(); //StoreCompany.DataSource = dsCompany; //StoreCompany.DataBind(); StoreUnit.DataSource = dsUnit; StoreUnit.DataBind(); //l_unit.Template.Html = Template.Html; //StoreCurrency.DataSource = dsCurrency; //StoreCurrency.DataBind(); //StoreItem.DataSource = dsItem; //StoreItem.DataBind(); //l_item.Template.Html = Template.Html; DataSet dsGetItem = dal.FactoryDAL(PageHelper.ConnectionStrings, "FW_GetItem_SP", new List <IFields> { dal.CreateIFields() .Append("Option", "GetItem").Append("STAT", FSecurityHelper.CurrentUserDataGET()[12]).Append("SYS", "A") }).GetList(); StoreGetItem.DataSource = dsGetItem; StoreGetItem.DataBind(); StoreKind.DataSource = dsKind; StoreKind.DataBind(); StoreDept.DataSource = dsDept; StoreDept.DataBind(); StoreForeignKind.DataSource = dsForeignKind; StoreForeignKind.DataBind(); StoreShipKind.DataSource = dsShipKind; StoreShipKind.DataBind(); StoreCompanyKind.DataSource = dsCompanyKind; StoreCompanyKind.DataBind(); StoreCurrInvoice.DataSource = GetComboxDs("CurrencysInvoice"); StoreCurrInvoice.DataBind(); }
public void StoreKind_OnRefreshData(object sender, StoreRefreshDataEventArgs e) { StoreKind.DataSource = GetComboxDs("QtyKindBinding"); StoreKind.DataBind(); }
public StoreInstruction(StoreKind storeKind, byte index) { StoreKind = storeKind; Index = index; }
public void ToString_StoreInstruction(StoreKind storeKind, byte index, string expectedString) { var storeInstruction = new StoreInstruction(storeKind, index); Assert.Equal(expectedString, storeInstruction.ToString()); }
public IDistributedStoreKey GetBaseKeyByStoreKind(DxStoreKeyAccessMode mode, DistributedStore.Context context, StoreKind storeKind) { IDistributedStoreKey result; switch (storeKind) { case StoreKind.Clusdb: result = ClusterDbKey.GetBaseKey(context.ClusterHandle, mode); break; case StoreKind.DxStore: result = this.DxStoreKeyFactoryInstance.GetBaseKey(mode, context.ChannelFactory, context.NodeName, false); break; default: result = null; break; } return(result); }