void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtSupTypeName.Text) && !string.IsNullOrEmpty(this.txtSupTypeCode.Text)) { using (MMSProDBDataContext db = new MMSProDBDataContext(ConfigurationManager.ConnectionStrings["mmsConString"].ConnectionString)) { //检查唯一性 var temp = db.SupplierType.SingleOrDefault(a => a.SupplierTypeCode == this.txtSupTypeCode.Text.Trim()); if (temp == null) { SupplierType ei = new SupplierType(); ei.SupplierTypeName = this.txtSupTypeName.Text.Trim(); ei.SupplierTypeCode = this.txtSupTypeCode.Text.Trim(); ei.Remark = this.txtRemark.Text.Trim(); db.SupplierType.InsertOnSubmit(ei); db.SubmitChanges(); Response.Redirect("SupTypeManager.aspx"); } else { ClientScript.RegisterClientScriptBlock(typeof(string), "ShowMessage", "<script>alert('类别编码已存在')</script>"); } } } }
public IEnumerable <SupplierWithPartsModel> AllWithParts(SupplierType type) { var suppliers = db.Suppliers.AsQueryable(); switch (type) { case SupplierType.Local: suppliers = suppliers .Where(s => !s.IsImporter); break; case SupplierType.Importers: suppliers = suppliers .Where(s => s.IsImporter); break; } return(suppliers .Select(s => new SupplierWithPartsModel() { Name = s.Name, Id = s.Id, NumberOfParts = s.Parts.Count }) .ToList()); }
private void FormSupplierEdit_Load(object sender, EventArgs e) { this.textBoxCredit.Text = "0"; this.textBoxVatRate.Text = "17"; if (!m_isAdd) { this.buttonAdd.Enabled = false; this.buttonSupplierGroup.Enabled = false; if (m_isEditSupplier) { m_supplier = Supplier.getInctance().getSupplierInfoFromPkey(m_supplierPkey); } else { m_supplierType = SupplierType.getInctance().getSupplierTypeInfoFromPkey(m_supplierGroupPkey); m_isSupplierGroup = true; } setPageActiveState(); setPageActiveValue(); } // 初始化区域下拉框值 ComboBoxExtend.initComboBox(this.comboBoxArea, "BASE_AREA_LIST"); }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 22, Configuration.FieldSeparator), Id, ContractIdentifier?.ToDelimitedString(), ContractDescription, ContractStatus?.ToDelimitedString(), EffectiveDate.HasValue ? EffectiveDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ExpirationDate.HasValue ? ExpirationDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, ContractOwnerName?.ToDelimitedString(), ContractOriginatorName?.ToDelimitedString(), SupplierType?.ToDelimitedString(), ContractType?.ToDelimitedString(), FreeOnBoardFreightTerms?.ToDelimitedString(), PriceProtectionDate.HasValue ? PriceProtectionDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, FixedPriceContractIndicator?.ToDelimitedString(), GroupPurchasingOrganization?.ToDelimitedString(), MaximumMarkup?.ToDelimitedString(), ActualMarkup?.ToDelimitedString(), Corporation != null ? string.Join(Configuration.FieldRepeatSeparator, Corporation.Select(x => x.ToDelimitedString())) : null, ParentOfCorporation?.ToDelimitedString(), PricingTierLevel?.ToDelimitedString(), ContractPriority, ClassOfTrade?.ToDelimitedString(), AssociatedContractId?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
protected override SupplierEntity entityFromReader(SqlDataReader reader) { //inputs the data from the database into useable data in the program. string name = (string) reader["Name"]; string note = (string) reader["Note"]; SupplierType type = (SupplierType) Enum.Parse(typeof (SupplierType), reader["Type"].ToString()); string accountNo = (string) reader["AccountNo"]; string accountName = (string) reader["AccountName"]; string ownerId = (string) reader["OwnerId"]; string bank = (string) reader["Bank"]; AccountType accountType = (AccountType) Enum.Parse(typeof (AccountType), reader["AccountType"].ToString()); int id = (int)reader["PartyId"]; DateTime lastModified = (DateTime)reader["LastModified"]; bool deleted = (bool)reader["Deleted"]; SupplierEntity supplierEntity = new SupplierEntity(type, note, name); supplierEntity.Id = id; supplierEntity.LastModified = lastModified; supplierEntity.Deleted = deleted; supplierEntity.AccountNo = accountNo; supplierEntity.AccountName = accountName; supplierEntity.OwnerId = ownerId; supplierEntity.AccountType = accountType; supplierEntity.Bank = bank; return supplierEntity; }
internal SupplierEntity Create(string name, string note, SupplierType type) { //Creates a new supplier with type name and note, and inserts to database. SupplierEntity supplierEntity = new SupplierEntity(type, note, name); insert(supplierEntity); return supplierEntity; }
public ISupplier CreateSupplier(string name, string note, SupplierType type) { SupplierEntity entity = new SupplierEntity(type, note, name); supplierList.Add(entity); return entity; }
void Detail() { try { int id = Convert.ToInt32(lv_List.SelectedItems[0].Text); Supplier sp = SupplierDAO.Instance.GetSupplierInfoByid(id); txt_Name.Text = sp.Name; txt_address.Text = sp.Address; txt_Phone.Text = sp.Phone; SupplierType st = SupplierTypeDAO.Instance.GetTypeByIDSupplier(id); int index = -1; int i = 0; foreach (SupplierType item in cbb_Group.Items) { if (item.ID == sp.ID) { index = i; break; } i++; } cbb_Group.SelectedIndex = i; } catch { return; } }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { CompanyInfo c = item as CompanyInfo; row.Tag = c; row.Cells["colImage"].Value = Properties.Resources.customer; row.Cells["colID"].Value = c.ID; row.Cells["colName"].Value = c.Name; SupplierType st = categoryTree.GetSupplierType(c.CategoryID); row.Cells["colCategory"].Value = st != null ? st.Name : string.Empty; row.Cells["colNation"].Value = c.Nation; row.Cells["colCity"].Value = c.City; row.Cells["colWebsite"].Value = c.Website; row.Cells["colTelphone"].Value = c.TelPhone; row.Cells["colFax"].Value = c.Fax; row.Cells["colAddress"].Value = c.Address; row.Cells["colPostalCode"].Value = c.PostalCode; row.Cells["colMemo"].Value = c.Memo; if (_Suppliers == null || !_Suppliers.Exists(it => it.ID == c.ID)) { if (_Suppliers == null) { _Suppliers = new List <CompanyInfo>(); } _Suppliers.Add(c); } }
public void UpdateSupplierType(SupplierType model) { using (var uow = new LookupsUnitOfWork()) { uow.LookupsRespository.UpdateSupplierType(model); uow.Save(); } }
public IActionResult GetSummary([FromQuery] SupplierType supplierType, [FromQuery] DateTimeOffset date) { try { VerifyUser(); var data = _service.GetReport(supplierType, date); return(Ok(new { apiVersion = ApiVersion, data = data, info = new { Count = data.Count, Order = new List <string>(), Selected = new List <string>() }, message = General.OK_MESSAGE, statusCode = General.OK_STATUS_CODE })); } catch (Exception e) { var result = new ResultFormatter(ApiVersion, General.INTERNAL_ERROR_STATUS_CODE, e.Message) .Fail(); return(StatusCode(General.INTERNAL_ERROR_STATUS_CODE, result)); } }
public JsonResult EditSupplierType(FormCollection form) { var apiResult = new APIResult(); try { var opt = form["opt"]; SupplierType model = new SupplierType(); model.Name = form["name"]; if (opt == "0") { model.Pid = Convert.ToInt64(form["id"]); } else { model.Id = Convert.ToInt64(form["id"]); } SupplierTypeBll.AddOrUpdate(model, UserContext.CurrentUser.Name, UserContext.CurrentUser.HotelId); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
public ICollection <SupplierModel> All(SupplierType type) { var suppliers = this.dbContext.Suppliers.AsQueryable(); switch (type) { case SupplierType.Local: suppliers = suppliers .Where(s => !s.IsImporter); break; case SupplierType.Importer: suppliers = suppliers .Where(s => s.IsImporter); break; default: throw new InvalidOperationException($"Invalid supplier type: {type}"); } return(suppliers .Select(s => new SupplierModel { Id = s.Id, Name = s.Name, PartsCount = s.Parts.Count }).ToList()); }
private SupplierType Create_Supplier_Type_Details_From_Data_Row(DataRow dataRow) { SupplierType Supplier_Type_To_Return = new SupplierType(); Supplier_Type_To_Return.Supplier_Type_Id = Convert.ToInt16(dataRow["Supplier_Type_Id"]); Supplier_Type_To_Return.Type_Name = dataRow["Type_Name"].ToString(); Supplier_Type_To_Return.Type_Code = dataRow["Type_Code"].ToString(); Supplier_Type_To_Return.Description = dataRow["Description"].ToString(); if (dataRow.Table.Columns.IndexOf("Record_Created_By_User_Id") > -1) { Supplier_Type_To_Return.Record_Created_By_User_Id = (int)dataRow["Record_Created_By_User_Id"]; Supplier_Type_To_Return.Record_Creation_DateTime_UTC = (DateTime)dataRow["Record_Creation_DateTime_UTC"]; } if (dataRow.Table.Columns.IndexOf("Record_Last_Updated_By_User_Id") > -1) { Supplier_Type_To_Return.Record_Last_Updated_By_User_Id = (int)dataRow["Record_Last_Updated_By_User_Id"]; Supplier_Type_To_Return.Record_Last_Updated_DateTime_UTC = (DateTime)dataRow["Record_Last_Updated_DateTime_UTC"]; } if (dataRow.Table.Columns.IndexOf("Is_Active") > -1) { Supplier_Type_To_Return.Is_Active = (bool)dataRow["Is_Active"]; } if (dataRow.Table.Columns.IndexOf("Is_Visible") > -1) { Supplier_Type_To_Return.Is_Active = (bool)dataRow["Is_Visible"]; } return(Supplier_Type_To_Return); }
public ActionResult Edit(int id) { SupplierType obj = GetById(id); ViewData["SuppliewsId"] = id; return(View(obj)); }
public List <SupplierType> GetSupplierType(string lang) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable; SupplierType type; dataTable = conn_db.ReadTable(userQuery.GetMasterTranslated("suppliertype", lang)); List <SupplierType> workshopTypes = new List <SupplierType>(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } foreach (System.Data.DataRow row in dataTable.Rows) { type = new SupplierType(); type.id = Convert.ToInt32(row["ID"].ToString()); type.typeName = row["suppliertype_name"].ToString(); workshopTypes.Add(type); } return(workshopTypes); }
public static Supplier CreateSupplier(SupplierType sType, string filename = "") { Supplier retval; switch (sType) { case SupplierType.MMT: retval = new MMTSupplier(); break; case SupplierType.TechData: retval = new TechDataSupplier(filename); break; case SupplierType.Wavelink: retval = new WavelinkSupplier(filename); break; default: retval = new DickerDataSupplier(filename); break; } return(retval); }
protected override void ShowItemInGridViewRow(DataGridViewRow row, object item) { SupplierType ct = item as SupplierType; row.Cells["colName"].Value = ct.Name; row.Cells["colMemo"].Value = ct.Memo; }
public async Task <IActionResult> Edit(int id, [Bind("SupplierTypeId,Type")] SupplierType supplierType) { if (id != supplierType.SupplierTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(supplierType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupplierTypeExists(supplierType.SupplierTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(supplierType)); }
internal Supplier Create(string name, string note, SupplierType type) { Supplier supplier = new Supplier(name, note, type, dataAccessFacade); suppliers.Add(supplier); return supplier; }
public ActionResult _UpdateSupplierTypes(SupplierType ins) { //...Update Object SupplierType ins2 = SupplierTRep.Update(ins); //...Repopulate Grid... return(View(new GridModel(SupplierTRep.GetAllSupplierType()))); }
public ISupplier CreateSupplier(string name, string note, SupplierType type) { SupplierEntity entity = new SupplierEntity(type, note, name); supplierList.Add(entity); return(entity); }
protected void dgSupplier_SelectedIndexChanged(object sender, EventArgs e) { int suppliertypeid = (int)dgSupplier.DataKeys[dgSupplier.SelectedIndex]; Session["SupplierTypeId"] = suppliertypeid; _SupplierType = _presenter.GetSupplierTypeById(suppliertypeid); Session["SupplierType"] = _SupplierType; }
internal Supplier Create(string name, string note, SupplierType type) { Supplier supplier = new Supplier(name, note, type, dataAccessFacade); suppliers.Add(supplier); return(supplier); }
public ActionResult CreateSupplierType(SupplierType model, HttpPostedFileBase file) { if (ModelState.IsValid) { } return(RedirectToAction("GetSupplierTypes")); }
public ActionResult DeleteConfirmed(int id) { SupplierType supplierType = db.SupplierTypes.Find(id); db.SupplierTypes.Remove(supplierType); db.SaveChanges(); return(RedirectToAction("Index")); }
internal Supplier(string name, string note, SupplierType type, IDataAccessFacade dataAccessFacade) { //Calls validation on "name" for securing right input. validateName(name); this.dataAccessFacade = dataAccessFacade; _supplierEntity = dataAccessFacade.CreateSupplier(name, note, type); //Calls party class to put supplierentity as a party. initializeParty(_supplierEntity); }
public ActionResult DeletesupplierTypeConfirmed(int id) { SupplierType suppliertype = db.SupplierTypes.Find(id); db.SupplierTypes.Remove(suppliertype); db.SaveChanges(); ViewBag.SuccessMsg = "You have successfully deleted Supplier Type."; return(View("SupplierType", db.SupplierTypes.ToList())); }
public ActionResult Add(SupplierTypeModel model) { if (ModelState.IsValid) { SupplierType supplierType = model.MapTo <SupplierTypeModel, SupplierType>(); _supplierTypeService.Insert(supplierType); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Edit([Bind(Include = "SupplierTypeId,SupplierName,Description,Status")] SupplierType supplierType) { if (ModelState.IsValid) { db.Entry(supplierType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(supplierType)); }
public ActionResult EditSupplierType(int id = 0) { SupplierType Supmaster = db.SupplierTypes.Find(id); if (Supmaster == null) { return(HttpNotFound()); } return(View(Supmaster)); }
/// <summary> /// 增加客户类别 /// </summary> /// <param name="pc"></param> /// <param name="parent"></param> /// <returns></returns> public TreeNode AddSupplierTypeNode(SupplierType pc, TreeNode parent) { TreeNode node = parent.Nodes.Add(string.Format("{0}", pc.Name)); node.Tag = pc; node.SelectedImageIndex = 0; node.ImageIndex = 0; _AllTypeNodes.Add(node); return(node); }
public static void SetSupplier(Supplier supplier, SupplierType supplierType, string code, string name, string shortName, bool isValid, string note, DateTime updateTime, int supplierCompanyId) { supplier.SupplierType = supplierType; supplier.Code = code; supplier.CnName = name; supplier.CnShortName = shortName; supplier.UpdateDate = updateTime; supplier.IsValid = isValid; supplier.Note = note; supplier.SupplierCompanyId = supplierCompanyId; }
public SupplierEntity(SupplierType type, string note, string name) : base(note, name) { Type = type; AccountNo = ""; AccountType = AccountType.Undefined; AccountName = ""; OwnerId = ""; Bank = ""; _paymentRules = new List<PaymentRuleEntity>(); }
/// <summary> /// 创建供应商 /// 供应商公司与供应商具有一致的编码 /// </summary> /// <param name="supplierType">供应商类型</param> /// <param name="code">供应商编码</param> /// <param name="name">名称</param> /// <param name="note">备注</param> /// <returns>创建的供应商</returns> public static Supplier CreateSupplier(SupplierType supplierType, string code, string name, string note) { var supplier = new Supplier { SupplierType = supplierType, Code = code, CnName = name, CreateDate = DateTime.Now, UpdateDate = DateTime.Now, IsValid = true, Note = note }; return supplier; }
public static SupplierType CreateSupplierType(int supplierTypeId) { SupplierType supplierType = new SupplierType(); supplierType.SupplierTypeId = supplierTypeId; return supplierType; }
public void AddToSupplierType(SupplierType supplierType) { base.AddObject("SupplierType", supplierType); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { bool status = false; if (ddlRuleTypes.SelectedValue == "0") // Promotions { if (!CheckAssemblyClass(typeof(ZNodePromotionOption))) return; DiscountType entity = new DiscountType(); if(_ItemId > 0) entity = _RuleTypeAdmin.GetDiscountTypeById(_ItemId); entity.Name = txtRuleName.Text.Trim(); entity.ClassName = txtRuleClassName.Text.Trim(); entity.Description = txtRuleDesc.Text.Trim(); entity.ActiveInd = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateDicountType(entity); else status = _RuleTypeAdmin.AddDicountType(entity); } else if (ddlRuleTypes.SelectedValue == "1") // Shipping { if (!CheckAssemblyClass(typeof(ZNodeShippingOption))) return; ShippingType shipType = new ShippingType(); if (_ItemId > 0) shipType = _RuleTypeAdmin.GetShippingTypeById(_ItemId); shipType.Name = txtRuleName.Text.Trim(); shipType.Description = txtRuleDesc.Text.Trim(); shipType.ClassName = txtRuleClassName.Text.Trim(); shipType.IsActive = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateShippingType(shipType); else status = _RuleTypeAdmin.AddShippingType(shipType); } else if (ddlRuleTypes.SelectedValue == "2") // Taxes { if (!CheckAssemblyClass(typeof(ZNodeTaxOption))) return; TaxRuleType taxRuleType = new TaxRuleType(); if (_ItemId > 0) taxRuleType = _RuleTypeAdmin.GetTaxRuleTypeById(_ItemId); taxRuleType.Name = txtRuleName.Text.Trim(); taxRuleType.Description = txtRuleDesc.Text.Trim(); taxRuleType.ClassName = txtRuleClassName.Text.Trim(); taxRuleType.ActiveInd = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateTaxRuleType(taxRuleType); else status = _RuleTypeAdmin.AddTaxRuleType(taxRuleType); } else if (ddlRuleTypes.SelectedValue == "3") // supplier { if (!CheckAssemblyClass(typeof(ZNodeSupplierOption))) return; SupplierType supplierType = new SupplierType(); if (_ItemId > 0) supplierType = _RuleTypeAdmin.GetSupplierTypeById(_ItemId); supplierType.Name = txtRuleName.Text.Trim(); supplierType.Description = txtRuleDesc.Text.Trim(); supplierType.ClassName = txtRuleClassName.Text.Trim(); supplierType.ActiveInd = chkEnable.Checked; if (_ItemId > 0) status = _RuleTypeAdmin.UpdateSupplierType(supplierType); else status = _RuleTypeAdmin.AddSupplierType(supplierType); } if (status) { Response.Redirect(RedirectUrl); } else { lblErrorMsg.Text = "Unable to process your request. Please try again."; } }
public ISupplier CreateSupplier(string name, string note, SupplierType type) { //Calls the suppliercollection class for create. return supplierCollection.Create(name, note, type); }
public ISupplier CreateSupplier(string name, string note, SupplierType type) { //Calls Create and gives it the neccessary parameters. return supplierMapper.Create(name, note, type); }