/// <summary> /// Returns the correct file name for a given vendor... /// </summary> /// <param name="type"></param> /// <returns></returns> public static string ReturnNewFileName(VendorType type) { string NewTitle = String.Empty; string _year = DateTime.Now.Year.ToString(); string _month = DateTime.Now.Month.ToString(); string _day = DateTime.Now.Day.ToString().PadLeft(2, '0'); string _time = String.Format("{0}{1}", DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes.ToString().PadLeft(2, '0')); switch (type) { case VendorType.FakeProvider: NewTitle = String.Format("FakeProvider_test_file_{0}{1}{2}.txt.pgp", _year, _month, _day); break; case VendorType.SampleProvider: NewTitle = String.Format("SampleProvider_test_file_{0}{1}{2}.txt.pgp", _year, _month, _day); break; case VendorType.StillFakeProvider: NewTitle = String.Format("StillFakeProvider_test_file_{0}{1}{2}{3}.pgp", _year, _month, _day, _time); break; default: break; } return(NewTitle); }
public async Task <IActionResult> Delete([FromBody] VendorType payload) { VendorType VendorType = new VendorType(); try { bool flag = false; var VariableVendor = _context.Vendor.Where(a => a.VendorTypeId == (int)payload.VendorTypeId) .FirstOrDefault(); if (VariableVendor == null) { flag = true; } if (flag) { VendorType = _context.VendorType .Where(x => x.VendorTypeId == (int)payload.VendorTypeId) .FirstOrDefault(); _context.VendorType.Remove(VendorType); await _context.SaveChangesAsync(); } } catch (Exception ex) { _logger.LogError($"Ocurrio un error: { ex.ToString() }"); return(BadRequest($"Ocurrio un error:{ex.Message}")); } return(await Task.Run(() => Ok(VendorType))); }
public ActionResult UpdateVendorType(VendorType VendorType) { try { VendorType dbVendorType = new VendorType(); dbVendorType = db.VendorTypes.Find(VendorType.VendorTypeID); dbVendorType.VendorTypeName = VendorType.VendorTypeName; dbVendorType.UpdateBy = AppUtils.GetLoginUserID(); dbVendorType.UpdateDate = AppUtils.GetDateTimeNow(); db.Entry(dbVendorType).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); var vendor = new VendorTypeViewModel() { VendorTypeID = VendorType.VendorTypeID, VendorTypeName = VendorType.VendorTypeName, UpdateVendorType = ISP_ManagementSystemModel.AppUtils.HasAccessInTheList(ISP_ManagementSystemModel.AppUtils.Update_Vendor_Type) ? true : false, }; var JSON = Json(new { UpdateSuccess = true, vendor = vendor }, JsonRequestBehavior.AllowGet); JSON.MaxJsonLength = int.MaxValue; return(JSON); } catch (Exception ex) { return(Json(new { UpdateSuccess = false }, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> PutVendorType([FromRoute] int id, [FromBody] VendorType vendorType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != vendorType.Id) { return(BadRequest()); } _context.Entry(vendorType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// 修改 /// </summary> /// <param name="p_BE">要修改的实体</param> /// <param name="sqlTrans">事务类</param> public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans) { try { this.CheckCorrect(p_BE); VendorType entity = (VendorType)p_BE; VendorTypeCtl control = new VendorTypeCtl(sqlTrans); string sql = "SELECT Code FROM Enum_VendorType WHERE Code=" + SysString.ToDBString(entity.Code); sql += " AND ID<>" + SysString.ToDBString(entity.ID); if (sqlTrans.Fill(sql).Rows.Count != 0) { throw new Exception("编码已经存在,请重新输入!"); } sql = "SELECT Name FROM Enum_VendorType WHERE Name=" + SysString.ToDBString(entity.Name); sql += " AND ID<>" + SysString.ToDBString(entity.ID); if (sqlTrans.Fill(sql).Rows.Count != 0) { throw new Exception("名称已经存在,请重新输入!"); } control.Update(entity); } catch (BaseException) { throw; } catch (Exception E) { throw new BaseException(E.Message); } }
public async Task <IActionResult> Edit(int id, [Bind("VendorTypeId,VendorTypeName,Description")] VendorType vendorType) { if (id != vendorType.VendorTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vendorType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VendorTypeExists(vendorType.VendorTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vendorType)); }
/// <summary> /// 删除 /// </summary> public override void EntityDelete() { VendorTypeRule rule = new VendorTypeRule(); VendorType entity = EntityGet(); rule.RDelete(entity); }
/// <summary> /// 获得实体 /// </summary> /// <returns></returns> private VendorType EntityGet() { VendorType entity = new VendorType(); entity.ID = HTDataID; return(entity); }
public Vendor(string name, string desc, VendorType vendorCategory) { Name = name; Desc = desc; VendorItems = new List <IItem>(); VendorCategory = vendorCategory; switch (VendorCategory) { case VendorType.Armorer: VendorItems.Add( new Armor(1, ArmorType.Leather, ArmorSlot.Head)); VendorItems.Add( new Armor(1, ArmorType.Leather, ArmorSlot.Chest)); VendorItems.Add( new Armor(1, ArmorType.Leather, ArmorSlot.Legs)); break; case VendorType.Weaponsmith: VendorItems.Add(new Weapon(1, WeaponType.OneHandedSword)); VendorItems.Add(new Arrows("arrows", 15, ArrowType.Standard)); break; case VendorType.Healer: VendorItems.Add(new HealthPotion(PotionStrength.Minor)); VendorItems.Add(new ManaPotion(PotionStrength.Minor)); break; case VendorType.Shopkeeper: break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Sends the latest vendor inventory list to player, /// rotates vendor towards player, and performs the appropriate emote. /// </summary> /// <param name="action">The action performed by the player</param> private void ApproachVendor(Player player, VendorType action = VendorType.Undef) { // default inventory List <WorldObject> vendorlist = new List <WorldObject>(); foreach (KeyValuePair <ObjectGuid, WorldObject> wo in defaultItemsForSale) { vendorlist.Add(wo.Value); } // unique inventory - items sold by other players foreach (KeyValuePair <ObjectGuid, WorldObject> wo in uniqueItemsForSale) { vendorlist.Add(wo.Value); } player.TrackInteractiveObjects(vendorlist); player.ApproachVendor(this, vendorlist); var rotateTime = Rotate(player); // vendor rotates to player if (action != VendorType.Undef) { DoVendorEmote(action, player); } }
public void DoVendorEmote(VendorType vendorType, WorldObject targetObject) { //Console.WriteLine("DoVendorEmote"); var rng = Physics.Common.Random.RollDice(0.0f, 1.0f); var emoteChain = new ActionChain(); foreach (var emote in Emotes(EmoteCategory.Vendor).Where(x => x.VendorType == (int)vendorType)) { if (rng < emote.Probability) { foreach (var action in emote.BiotaPropertiesEmoteAction) { ExecuteEmote(emote, action, emoteChain, WorldObject, targetObject); } break; } } foreach (var emote in Emotes(EmoteCategory.Vendor).Where(x => x.VendorType == (int)VendorType.Heartbeat)) { if (rng < emote.Probability) { foreach (var action in emote.BiotaPropertiesEmoteAction) { ExecuteEmote(emote, action, emoteChain, WorldObject); } break; } } emoteChain.EnqueueChain(); }
/// <summary> /// 删除 /// </summary> /// <param name="p_Entity">实体类</param> /// <returns>操作影响的记录行数</returns> public override int Delete(BaseEntity p_Entity) { try { VendorType MasterEntity = (VendorType)p_Entity; if (MasterEntity.ID == 0) { return(0); } //删除主表数据 string Sql = ""; Sql = "DELETE FROM Enum_VendorType WHERE " + "ID=" + SysString.ToDBString(MasterEntity.ID); //执行 int AffectedRows = 0; if (!this.sqlTransFlag) { AffectedRows = this.ExecuteNonQuery(Sql); } else { AffectedRows = sqlTrans.ExecuteNonQuery(Sql); } return(AffectedRows); } catch (BaseException E) { throw new BaseException(E.Message, E); } catch (Exception E) { throw new BaseException(FrameWorkMessage.GetAlertMessage((int)Message.CommonDBDelete), E); } }
// GET: ReplayVendorTypes/Details/5 public ActionResult Details(int convention_id, int?id) { var us = new UserService((ClaimsIdentity)User.Identity, db); if (!us.IsConventionAdmin(convention_id)) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var convention = db.Conventions.Find(convention_id); if (convention == null) { return(new HttpNotFoundResult()); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VendorType replayVendorType = convention.VendorTypes.Where(e => e.Id == id).FirstOrDefault(); if (replayVendorType == null) { return(HttpNotFound()); } return(View(replayVendorType)); }
public JConnect(IDbConnection connection) { this.connection = connection; commandTimeout = 30; Type type = connection.GetType(); if (type == typeof(System.Data.Odbc.OdbcConnection)) { typeOfParameter = ParameterType.QuestionMark; typeOfVendor = VendorType.Odbc; } else if (type == typeof(System.Data.OleDb.OleDbConnection)) { typeOfParameter = ParameterType.QuestionMark; typeOfVendor = VendorType.OleDb; } else if (type == typeof(System.Data.SqlClient.SqlConnection)) { typeOfParameter = ParameterType.AtSymbol; typeOfVendor = VendorType.SqlServer; GetReturningProc += new GetReturningHandler(SqlServerReturning); } else { typeOfParameter = ParameterType.Colon; typeOfVendor = VendorType.Oracle; GetReturningProc += new GetReturningHandler(OracleReturning); } GetTimeStampProc += new GetTimeStampHandler(DefaultGetTimeStampProc); }
public void UpdateVendorType(VendorType model) { using (var uow = new LookupsUnitOfWork()) { uow.LookupsRespository.UpdateVendorType(model); uow.Save(); } }
public Connect(IDbConnection connection) { this.connection = connection; Type type = connection.GetType(); if (type == typeof(System.Data.Odbc.OdbcConnection)) { typeOfParameter = ParameterType.QuestionMark; typeOfVendor = VendorType.Odbc; } else if (type == typeof(System.Data.OleDb.OleDbConnection)) { typeOfParameter = ParameterType.QuestionMark; typeOfVendor = VendorType.OleDb; } else if (type == typeof(System.Data.SqlClient.SqlConnection)) { typeOfParameter = ParameterType.AtSymbol; typeOfVendor = VendorType.SqlServer; } else { typeOfParameter = ParameterType.Colon; typeOfVendor = VendorType.Oracle; } }
public void UpdateVendorType(VendorType model) { RemoveEntityImage(model); AddEntityImage(model); _context.VendorTypes.Attach(model); _context.Entry(model).State = EntityState.Modified; }
public ConnectionModel(string server, string database, VendorType vendor, string parameters, CredentialModel credential) { Server = server; Database = database; Vendor = vendor; Parameters = parameters; Credential = credential; }
public ActionResult CreateVendorType(VendorType model, HttpPostedFileBase file) { if (ModelState.IsValid) { } return(RedirectToAction("GetVendorTypes")); }
public void VendorQueryUsingoAuth() { QueryService <VendorType> entityQuery = new QueryService <VendorType>(qboContextoAuth); VendorType existing = Helper.FindOrAdd <VendorType>(qboContextoAuth, new VendorType()); List <VendorType> entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); Assert.IsTrue(entities.Count() > 0); }
public VendorsEx(VendorType vendorType, string name, Location location, TrainClass trainClass, int entryId) { VendorType = vendorType; Name = name; Location = location; TrainClass = trainClass; EntryId = entryId; }
/// <summary> /// 新增 /// </summary> public override int EntityAdd() { VendorTypeRule rule = new VendorTypeRule(); VendorType entity = EntityGet(); rule.RAdd(entity); return(entity.ID); }
public ActionResult DeleteConfirmed(int id) { VendorType vendorType = db.VendorTypes.Find(id); db.VendorTypes.Remove(vendorType); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Update([FromBody] CrudViewModel <VendorType> payload) { VendorType vendorType = payload.value; _context.VendorType.Update(vendorType); _context.SaveChanges(); return(Ok(vendorType)); }
public IActionResult Insert([FromBody] CrudViewModel <VendorType> payload) { VendorType value = payload.value; var result = _functionalService.Insert <VendorType>(value); value = (VendorType)result.Data; return(Ok(value)); }
public void VendorQueryUsingoAuth() { QueryService <VendorType> entityQuery = new QueryService <VendorType>(qboContextoAuth); VendorType existing = Helper.FindOrAdd <VendorType>(qboContextoAuth, new VendorType()); //List<VendorType> entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); int count = entityQuery.ExecuteIdsQuery("Select * from VendorType where Id='" + existing.Id + "'").Count; Assert.IsTrue(count > 0); }
public void VendorTypeAddAsyncTestsUsingoAuth() { //Creating the VendorType for Add VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); VendorType added = Helper.AddAsync <VendorType>(qboContextoAuth, entity); QBOHelper.VerifyVendorType(entity, added); }
public void VendorTypeVoidAsyncTestsUsingoAuth() { //Creating the VendorType for Adding VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); //Adding the VendorType VendorType added = Helper.Add <VendorType>(qboContextoAuth, entity); Helper.VoidAsync <VendorType>(qboContextoAuth, added); }
public ActionResult Edit([Bind(Include = "VendorTypeId,VendorTypeName")] VendorType vendorType) { if (ModelState.IsValid) { db.Entry(vendorType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vendorType)); }
public IActionResult Remove([FromBody] CrudViewModel <VendorType> payload) { VendorType vendorType = _context.VendorType .Where(x => x.VendorTypeId == (int)payload.key) .FirstOrDefault(); _context.VendorType.Remove(vendorType); _context.SaveChanges(); return(Ok(vendorType)); }
private string AddType(int id, int typeId) { Vendor vend = db.Vendors.Find(id); VendorType vendtype = db.VendorTypes.Find(typeId); vend.VendorTypes.Add(vendtype); db.SaveChanges(); return("success"); }
public void SetUpTestData() { VendorType vendorType = new VendorType { VendorTypeId = 1, Name = "Tech" }; vendorTypes.Add(vendorType); vendors.Add(new Vendor { VendorId = 1, Name = "Apple", VendorTypeId = vendorType.VendorTypeId, VendorType = vendorType }); vendors.Add(new Vendor { VendorId = 2, Name = "Microsoft", VendorTypeId = vendorType.VendorTypeId, VendorType = vendorType }); vendors.Add(new Vendor { VendorId = 3, Name = "Google", VendorTypeId = vendorType.VendorTypeId, VendorType = vendorType }); vendors.Add(new Vendor { VendorId = 4, Name = "Samsung", VendorTypeId = vendorType.VendorTypeId, VendorType = vendorType }); products.Add(new Product { ProductId = Guid.NewGuid(), Name = "Visual Studio" }); products.Add(new Product { ProductId = Guid.NewGuid(), Name = "Xcode" }); }
public Returning(VendorType type, string table, string field) { switch (type) { case VendorType.Odbc: break; case VendorType.OleDb: break; case VendorType.Oracle: sequence = "select " + table + "Seq.NextVal,"; tail = "returning " + field + "into ?"; break; case VendorType.PostgreSQL: dropField = true; tail = "returning " + field + "into ?"; break; case VendorType.SqlServer: dropField = true; output = "output inserted."+field; break; case VendorType.DB2: head = "select " + field + " from new table ("; sequence = "select nextval for " + table + "seq,"; tail = ")"; break; } }
public Returning(VendorType type, string table, string field) { switch (type) { case VendorType.Odbc: break; case VendorType.OleDb: break; case VendorType.Oracle: sequence = "select " + table + "Seq.NextVal,"; tail = "returning " + field + "into ?"; break; case VendorType.PostgreSQL: dropField = true; tail = "returning " + field + "into ?"; break; case VendorType.SqlServer: dropField = true; //output = "output inserted." + field; tail = " SELECT CAST(SCOPE_IDENTITY() AS BIGINT)"; break; case VendorType.DB2: head = "select " + field + " from new table ("; sequence = "select nextval for " + table + "seq,"; tail = ")"; break; case VendorType.Lite3: dropField = true; tail = "; select last_insert_rowid()"; break; } }
internal FrameworkInfo(XmlNode frameworkNode, XmlNamespaceManager nsMgr) { if (frameworkNode == null) { throw new ArgumentNullException("frameworkNode"); } if (nsMgr == null) { throw new ArgumentNullException("nsMgr"); } _frameworkNode = frameworkNode; _nsMgr = nsMgr; _name = GetXmlAttributeValue(frameworkNode, "name"); if (_name == null) { throw new ArgumentException("The \"name\" attribute does not " + "exist, or has no value."); } _family = GetXmlAttributeValue(frameworkNode, "family"); if (_family == null) { throw new ArgumentException("The \"family\" attribute does " + "not exist, or has no value."); } _description = GetXmlAttributeValue(_frameworkNode, "description"); if (_description == null) { throw new ArgumentException("The \"description\" attribute " + "does not exist, or has no value."); } string vendor = GetXmlAttributeValue(_frameworkNode, "vendor"); if (vendor == null) { throw new ArgumentException("The \"vendor\" attribute does " + "not exist, or has no value."); } try { _vendor = (VendorType) Enum.Parse(typeof (VendorType), vendor, true); } catch (Exception ex) { throw new ArgumentException("The value of the \"vendor\" " + "attribute is not valid.", ex); } }
protected FrameworkInfo(SerializationInfo info, StreamingContext context) { _name = info.GetString("Name"); _family = info.GetString("Family"); _description = info.GetString("Description"); _status = (InitStatus) info.GetValue("Status", typeof(InitStatus)); _clrType = (ClrType) info.GetValue("ClrType", typeof(ClrType)); _version = (Version) info.GetValue("Version", typeof(Version)); _clrVersion = (Version) info.GetValue("ClrVersion", typeof(Version)); _vendor = (VendorType) info.GetValue("Vendor", typeof(VendorType)); if (_status != InitStatus.Valid) { return; } _frameworkDirectory = (DirectoryInfo) info.GetValue("FrameworkDirectory", typeof(DirectoryInfo)); _sdkDirectory = (DirectoryInfo) info.GetValue("SdkDirectory", typeof(DirectoryInfo)); _frameworkAssemblyDirectory = (DirectoryInfo) info.GetValue("FrameworkAssemblyDirectory", typeof(DirectoryInfo)); _runtime = (Runtime) info.GetValue("Runtime", typeof(Runtime)); _project = (Project) info.GetValue("Project", typeof(Project)); _taskAssemblies = (FileSet) info.GetValue("TaskAssemblies", typeof(FileSet)); _referenceAssemblies = (FileSet[]) info.GetValue("ReferenceAssemblies", typeof(FileSet[])); _toolPaths = (string[]) info.GetValue("ToolPaths", typeof(string[])); }