private void HandleFactorySelection(string factoryNumber, DateTime rehaulDate) { const string METHOD_NAME = "HandleFactorySelection"; try { int factoryID = Convert.ToInt32(Common.UILib.GetDropDownValue(ddlFactory)) / 10; RehaulFactoryStationData rehaulData = LimsEx.GetRehaulFactoryStationData(factoryID, rehaulDate); if (rehaulData.FactoryList.IsEmpty) { Common.AppHelper.ShowConfirmation((HtmlGenericControl)Master.FindControl("divWarning"), "No data exists for the selected date."); } TFactory factory = rehaulData.FactoryList.GetFactoryByNumber(factoryNumber); txtBeetsSlidLoads.Text = factory.BeetsSlidLoads; txtChipsDiscarded.Text = factory.ChipsDiscardedTons; txtChipsPctTailings.Text = factory.ChipsPercentTailings; txtRehaulAvgWt.Text = factory.RehaulLoadAverageWeight; txtYardAvgWt.Text = factory.YardLoadAverageWeight; txtTotalLoadsRehauled.Text = factory.StationList.TotalStationRehaulLoads; rptrStations.DataSource = factory.StationList.Stations; rptrStations.DataBind(); } catch (System.Exception e) { string errMsg = MOD_NAME + METHOD_NAME; Common.CException wscEx = new Common.CException(errMsg, e); throw (wscEx); } }
/// <summary> /// Builds the object from this builder using an <see cref="IFactory"/>. /// </summary> /// <typeparam name="TFactory">The factory to use to build the object</typeparam> /// <returns>The built object</returns> protected TObject BuildUsing <TFactory>() where TFactory : IFactory, new() { var factory = new TFactory(); return(factory.BuildObject(this)); }
/// <summary> /// Creates a WindowFactory of the type \a T and adds it to the system for /// use. The created WindowFactory will automatically be deleted when the /// factory is removed from the system (either directly or at system /// deletion time). /// </summary> /// <typeparam name="TFactory"> /// Specifies the type of WindowFactory subclass to add a factory for. /// </typeparam> public static void AddFactory <TFactory>() where TFactory : WindowFactory, new() { // create the factory object var factory = new TFactory(); // only do the actual add now if our singleton has already been created if (Instance.IsValueCreated) { System.GetSingleton().Logger .LogEvent("Created WindowFactory for '" + factory.GetTypeName() + "' windows."); // add the factory we just created try { GetSingleton().AddFactory(factory); } catch { System.GetSingleton().Logger .LogEvent("Deleted WindowFactory for '" + factory.GetTypeName() + "' windows."); // delete the factory object //CEGUI_DELETE_AO factory; throw; } } d_ownedFactories.Add(factory); }
}//сделано public void LoadFactoryInfo(TFactory CurrFactory) { if (CurrFactory == null) { return; } textBoxFactoryName.Text = CurrFactory.FactoryName; textBoxURL.Text = CurrFactory.AboutInfoURL; } //сделано
public void RegisterService <TService, TFactory>() where TService : class where TFactory : IGrpcServerServiceFactory <TService>, new() { var factory = new TFactory(); var service = factory.Create(); m_services.AddSingleton <TService>(service.Subscriber); m_definitions.Add(typeof(TService), service.ServiceDefinition); }
private void MoveUp(BNode <T, TKey> Crawler, TKey Key, T Value, int RightSibling) { if (!Crawler.Full) { Crawler.Insert(Key, Value, RightSibling); Crawler.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); return; } BNode <T, TKey> Sibling = new BNode <T, TKey>(Degree, FirstAvailablePointer, Crawler.Parent, TFactory, TKeyFactory); FirstAvailablePointer++; TKey UpwardMovingKey = TKeyFactory.CreateNull(); T UpwardMovingValue = TFactory.CreateNull(); Crawler.Split(Key, Value, RightSibling, Sibling, ref UpwardMovingKey, UpwardMovingValue); BNode <T, TKey> Child = null; for (int i = 0; i < Sibling.ChildrenPointers.Count; i++) { if (Sibling.ChildrenPointers[i] != int.MinValue) { Child = BNode <T, TKey> .DiskRead(File, Degree, Sibling.ChildrenPointers[i], TFactory, TKeyFactory); Child.Parent = Sibling.Pointer; Child.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); } else { break; } } if (Crawler.Parent == int.MinValue) { BNode <T, TKey> NewRoot = new BNode <T, TKey>(Degree, FirstAvailablePointer, int.MinValue, TFactory, TKeyFactory); FirstAvailablePointer++; NewRoot.ChildrenPointers[0] = Crawler.Pointer; NewRoot.Insert(UpwardMovingKey, UpwardMovingValue, Sibling.Pointer); Crawler.Parent = NewRoot.Pointer; Sibling.Parent = NewRoot.Pointer; RootPointer = NewRoot.Pointer; NewRoot.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); Crawler.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); Sibling.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); } else { Crawler.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); Sibling.DiskWrite(File, SizesNSpecialCharacters.HeaderSizeInBytes); BNode <T, TKey> Parent = BNode <T, TKey> .DiskRead(File, Degree, Crawler.Parent, TFactory, TKeyFactory); MoveUp(Parent, UpwardMovingKey, UpwardMovingValue, Sibling.Pointer); } }
} //сделано public void LoadModelsList(TFactory CurrFactory) { if (comboBoxModel != null) { comboBoxModel.ResetText(); comboBoxModel.Items.Clear(); } for (int i = 0; i < CurrFactory.Models.Count; i++) { comboBoxModel.Items.Add(CurrFactory.Models[i].ModelName); } }//сделано
/// <summary> /// Adds an <see cref="IFactory"/> of the specified type to the <see cref="IFactoryManager"/>. /// </summary> /// <typeparam name="TFactory">Type of <see cref="IFactory"/> to add.</typeparam> public void RegisterFactory <TFactory>() where TFactory : IFactory, new() { var type = typeof(TFactory); if (_factories.ContainsKey(type)) { throw new InvalidOperationException("FactoryManager instance already contains IFactory of specified type."); } var fact = new TFactory(); fact.Manager = this; _factories.Add(type, fact); }
protected void btnTransfer_Click(object sender, EventArgs e) { string test; BtnSubmit.Enabled = false; TxtAmt.Enabled = false; TxtRmk.Enabled = false; ICBO checkBO = CFactory.CreateInstance(); checkBO.CustID = "101"; checkBO.Pwd = txtTxnPwd.Text; test = UBll.CheckPassword(checkBO); if (test == "right") { ITBO ubo1 = TFactory.CreateInstance(); ubo1.CustAcc = CustAcc; ubo1.Amt = Convert.ToInt32(TxtAmt.Text); ubo1.Payee = Payee; ubo1.Rmk = TxtRmk.Text; IUBO updateBo = UFactory.CreateInstance(); updateBo.Accno = CustAcc; updateBo.Balance = Convert.ToInt32(TxtAmt.Text); string respond = BLL.UBll.Update(updateBo); lblrespond.Text = respond; IUpBO updateBOp = UPFactory.CreateInstance(); updateBOp.PAccno = Payee; updateBOp.Amt1 = Convert.ToInt32(TxtAmt.Text); if (respond != "Insufficient Funds") { string message = BLL.UBll.Transfer(ubo1); lblTxID.Text = "Your Transcation ID is " + message; string result = BLL.UBll.UpdatePayee1(updateBOp); lblResult.Text = result; } } else if (test == "wrong") { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Incorrect password" + "');", true); } }
public static TFactory GetFactory <T, TFactory>() where T : ManagementClassBase where TFactory : ManagementClassFactory <T> { if (ManagementSession._factories.ContainsKey(typeof(TFactory).FullName)) { return((TFactory)ManagementSession._factories[typeof(TFactory).FullName]); } Type factoryImplType = ManagementSession.GetFactoryType(typeof(TFactory)); TFactory factoryImpl = (TFactory)Activator.CreateInstance(factoryImplType); // Cache factory impl ManagementSession._factories[typeof(TFactory).FullName] = factoryImpl; return(factoryImpl); }