public static bool DeleteSupplier(int supplierid, int companyid) { bool result = true; using (SupplierManager supplierManager = new SupplierManager(null)) { try { supplierManager.Delete(supplierManager.GetSupplier(supplierid, companyid)); } catch (System.Data.SqlClient.SqlException e) { result = false; } } return result; }
public ActionResult AddSupplier(SupplierVM model) { if (ModelState.IsValid) { Supplier entity = new Supplier(); entity.CompanyName = model.SirketAd; entity.Description = model.Aciklama; SupplierManager.AddSupplier(entity); return(RedirectToAction("Index")); } else { return(View()); } }
public void UpdateSupplier_UpdateExisting() { var existingSupplier = new Supplier { Id = 1 }; var updatedSupplier = new Supplier { Id = 1 }; Mock <IDataRepositoryFactory> mockDataRepositoryFactory = new Mock <IDataRepositoryFactory>(); mockDataRepositoryFactory.Setup(mock => mock.GetDataRepository <ISupplierRepository>().Update(existingSupplier)).Returns(updatedSupplier); SupplierManager manager = new SupplierManager(mockDataRepositoryFactory.Object); var resultedSupplier = manager.UpdateSupplier(existingSupplier); Assert.AreEqual(updatedSupplier, resultedSupplier); }
public void ArchiveItemListing_ValidItemListing() { Setup(); SupplierManager myMan = new SupplierManager(); ProductManager otherMan = new ProductManager(); myMan.AddANewSupplier(testSupp, "Test"); modSupp = getSupplierListCompName(suppList); itemListingToTest.SupplierID = modSupp.SupplierID; otherMan.AddItemListing(itemListingToTest); itemListingToTest = getItemListingTestObject(itemList); itemListingToTest.CurrentNumGuests = 0; listResult actual = pMgr.ArchiveItemListing(itemListingToTest); Assert.AreEqual(listResult.Success, actual); Cleanup(); }
// GET: Home public ActionResult Index() { ProductManager _productManager = new ProductManager(); CategoryManager _categoryManager = new CategoryManager(); CustomerManager _customerManager = new CustomerManager(); SupplierManager _supplierManager = new SupplierManager(); SideMenuViewModel model = new SideMenuViewModel(); model.ProductCount = _productManager.GetCount(); model.CategoryCount = _categoryManager.GetCount(); model.CustomerCount = _customerManager.GetCount(); model.SupplierCount = _supplierManager.GetCount(); return(View(model)); }
public PQGridData GetSuppliers() { PQGridData data = new PQGridData(); HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; HttpRequestBase request = context.Request; string user_id = User.Identity.Name; UserManager userMgr = new UserManager(int.Parse(user_id), null); BUser user = userMgr.CurrentUser; SupplierManager supplierManager = new SupplierManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); int page = 1; int pageSize = 30; int total = 0; int.TryParse(request["page"], out page); int.TryParse(request["pageSize"], out pageSize); data.data = supplierManager.SearchSupplies(0, page, pageSize, out total); return(data); }
protected void txtSupplier_TextChanged(object sender, EventArgs e) { //attach the event Selecting(begin) OnSelectingSupplier(this, new SelectingSupplierEventArgs() { SupplierName = txtSupplier.Text }); //select the supplier if (!String.IsNullOrEmpty(txtSupplier.Text)) { profileManager = new ProfileManager(this); supplierManager = new SupplierManager(this); string[] identifications = txtSupplier.Text.Split('|'); string identification = identifications[0].ToString().Trim(); supplier = supplierManager.GetSupplier(Page.Company.CompanyId, identification); ShowSupplier(supplier); } }
public ActionResult Edit(int id) { Quote quote; using (var qm = new QuoteManager()) { quote = qm.Single(id); ViewBag.Quote = quote; } // determine the supplier and materials available List <CompanyToSupplier> companySuppliers; using (var sm = new SupplierManager()) { companySuppliers = sm.ByCompanyID(quote.CompanyID.GetValueOrDefault()).ToList(); } List <Product> products; using (var mm = new MaterialsManager()) { List <Material> allMaterials = new List <Material>(); foreach (var companyToSupplier in companySuppliers) { allMaterials.AddRange(mm.BySupplier(companyToSupplier.SupplierID)); } ViewBag.AvailableMaterials = allMaterials; products = mm.ActiveProducts(quote.CompanyID.GetValueOrDefault()).ToList(); var productLines = mm.ActiveProductLines().ToList(); ViewBag.ProductLines = productLines.AsEnumerable(); ViewBag.ProductToProductLine = mm.AllProductToProductLine().ToList(); ViewBag.MaterialToProducts = mm.AllMaterialToProducts().ToList(); } ViewBag.Products = products; return(View("Edit")); }
public IActionResult getAllMedicineBySupplier(int id) { SupplierManager contractManager = new SupplierManager(); List <MedicineBySupplierDTO> medicineInformation = contractManager.getAllMedicineBySupplier(id); if (medicineInformation.Count != 0) { return(Ok(new JsonCreate() { message = Utils.ConstMessage.GET_SUCCESS, data = medicineInformation })); } else { return(Ok(new JsonCreate() { message = Utils.ConstMessage.NOT_FOUND, data = medicineInformation })); } }
public IActionResult getSupplierByContractId(int id) { SupplierManager supplierManager = new SupplierManager(); SupplierDTO s = supplierManager.getSupplierByContractId(id); if (s != null) { return(Ok(new JsonCreate() { message = Utils.ConstMessage.GET_SUCCESS, data = s })); } else { return(Ok(new JsonCreate() { message = Utils.ConstMessage.NOT_FOUND, data = null })); } }
public IActionResult getSupplierIdByName(String name) { SupplierManager supplierManager = new SupplierManager(); int flag = supplierManager.getSupplierIdByName(name); if (flag != -1) { return(Ok(new JsonCreate() { message = Utils.ConstMessage.GET_SUCCESS, data = flag })); } else { return(Ok(new JsonCreate() { message = Utils.ConstMessage.NOT_FOUND, data = false })); } }
public IActionResult deleteSupplier(int id) { SupplierManager supplierManager = new SupplierManager(); bool flag = supplierManager.deleteSupplier(id); if (flag == true) { return(Ok(new JsonCreate() { message = Utils.ConstMessage.UPDATE_SUCCESS, data = null })); } else { return(Ok(new JsonCreate() { message = Utils.ConstMessage.UPDATE_FAIL, data = null })); } }
public IActionResult createSupplier([FromForm] SupplierDTO supplierDTO) { SupplierManager supplierManager = new SupplierManager(); SupplierDTO temp = supplierManager.createSupplier(supplierDTO); if (temp != null) { return(Ok(new JsonCreate() { message = Utils.ConstMessage.INSERT_SUCCESS, data = temp })); } else { return(Ok(new JsonCreate() { message = Utils.ConstMessage.CONFILICT, data = temp })); } }
public HttpResponseMessage DeleteSupplier(int SupplierID) { SupplierManager supplierManager = new SupplierManager(); cls_common_responses clsCommonResponses1 = new cls_common_responses(); HttpResponseMessage response; try { cls_common_responses clsCommonResponses2 = supplierManager.DeleteSupplier(SupplierID); int responseCode = clsCommonResponses2.ResponseCode; response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses2); } catch (Exception ex) { clsCommonResponses1.ResponseCode = 400; clsCommonResponses1.ResponseMessage = "Something went wrong, please try again later."; response = this.Request.CreateResponse <cls_common_responses>(HttpStatusCode.OK, clsCommonResponses1); } return(response); }
private void StockIn_Load(object sender, EventArgs e) { StorageManager sm = new StorageManager(); //仓库 SupplierManager supply = new SupplierManager(); //供应商 _AllStorage = sm.GetList(""); _AllSupply = supply.SelSupplierTable(); //禁用自动创建列 dataGridView1.AutoGenerateColumns = false; dataGridViewFujia.AutoGenerateColumns = false; //入库单单号 textBoxOddNumbers.Text = BuildCode.ModuleCode("OI"); //绑定事件 双击事填充内容并隐藏列表 dataGridViewFujia.CellDoubleClick += DataGridViewFujia_CellDoubleClick; // 将dataGridView中的内容居中显示 dataGridViewFujia.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
public IActionResult updateSupplier([FromForm] SupplierDTO supplierDTO) { SupplierManager supplierManager = new SupplierManager(); bool temp = supplierManager.updateSupplier(supplierDTO); if (temp == true) { return(Ok(new JsonCreate() { message = Utils.ConstMessage.UPDATE_SUCCESS, data = temp })); } else { return(Ok(new JsonCreate() { message = Utils.ConstMessage.UPDATE_FAIL, data = temp })); } }
//constructor public ManageSupplierList() { //loading supplier list SupplierManager supplierManager = new SupplierManager(); for (Iterator i = supplierManager.getAllSuppliers().iterator(); i.hasNext();) { SupplierInfo supplierInfo = (SupplierInfo)i.next(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = supplierInfo.getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = supplierInfo.getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = supplierInfo.getProfileInfo().getLastName(); supplierInfoNJ.ProfileInfoNJ.Phone = supplierInfo.getProfileInfo().getPhone(); supplierInfoNJ.ProfileInfoNJ.Fax = supplierInfo.getProfileInfo().getFax(); supplierInfoNJ.ProfileInfoNJ.Email = supplierInfo.getProfileInfo().getEmail(); supplierInfoNJ.ProfileInfoNJ.Website = supplierInfo.getProfileInfo().getWebsite(); supplierInfoNJ.Remarks = supplierInfo.getRemarks(); SupplierList.Add(supplierInfoNJ); } }
/* * This method will search supplier info * @author A.K.M. Nazmul Islam on 30th january 2016 */ private void OnSearch() { SupplierManager supplierManager = new SupplierManager(); SupplierList.Clear(); for (Iterator i = supplierManager.searchSuppliers(SearchSupplierByPhone).iterator(); i.hasNext();) { SupplierInfo supplierInfo = (SupplierInfo)i.next(); SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ(); supplierInfoNJ.ProfileInfoNJ.Id = supplierInfo.getProfileInfo().getId(); supplierInfoNJ.ProfileInfoNJ.FirstName = supplierInfo.getProfileInfo().getFirstName(); supplierInfoNJ.ProfileInfoNJ.LastName = supplierInfo.getProfileInfo().getLastName(); supplierInfoNJ.ProfileInfoNJ.Phone = supplierInfo.getProfileInfo().getPhone(); supplierInfoNJ.ProfileInfoNJ.Fax = supplierInfo.getProfileInfo().getFax(); supplierInfoNJ.ProfileInfoNJ.Email = supplierInfo.getProfileInfo().getEmail(); supplierInfoNJ.ProfileInfoNJ.Website = supplierInfo.getProfileInfo().getWebsite(); supplierInfoNJ.Remarks = supplierInfo.getRemarks(); SupplierList.Add(supplierInfoNJ); } }
private static void Option(CustomerManager customersManager, SupplierManager supplierManager) { Console.WriteLine("1.Da \n2.Nu"); ConsoleKeyInfo tasta = Console.ReadKey(); switch (tasta.Key) { case ConsoleKey.D1: ChooseOption(customersManager, supplierManager); break; case ConsoleKey.D2: Environment.Exit(0); break; default: Console.WriteLine(TastaGresita); Option(customersManager, supplierManager); break; } }
public DrOkUser GetCurrentUser() { if (!HttpContext.User.Identity.IsAuthenticated) { return(null); } DrOkUser user = null; var guid = (Guid)Membership.GetUser().ProviderUserKey; if (HttpContext.User.IsInRole("Client")) { user = ClientManager.GetClient(guid); } if (HttpContext.User.IsInRole("Supplier")) { user = SupplierManager.GetSupplier(guid); } user.Email = Membership.GetUser().Email; return(user); }
public ActionResult SupplierDetail(string id) { if (string.IsNullOrEmpty(id)) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("URL地址里的供应商编号不能为空"))); } int oId = 0; int.TryParse(id, out oId); string uid = HttpContext.User.Identity.Name; if (oId <= 0) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("URL地址里的供应商编号只能为数字"))); } BSupplier supplier = null; try { UserManager userMgr = new UserManager(int.Parse(uid), null); BUser user = userMgr.CurrentUser; SupplierManager supplierManager = new SupplierManager(user, userMgr.Shop, userMgr.CurrentUserPermission); supplier = supplierManager.GetSupplierFullInfo(oId); if (supplier == null) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("没有找到对应的供应商信息"))); } } catch (KMJXCException kex) { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode(kex.Message))); } catch { return(Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("未知错误"))); } return(View(supplier)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Context.Items["PurchaseOrderId"] != null) { Page.ViewState["PurchaseOrderId"] = Context.Items["PurchaseOrderId"]; purchaseOrderManager = new PurchaseOrderManager(this); purchaseOrder = purchaseOrderManager.GetPurchaseOrder( Convert.ToInt32(Page.ViewState["PurchaseOrderId"]), Company.CompanyId); lblPurchaseOrderCode.Text = "Código: " + purchaseOrder.PurchaseOrderCode; if (purchaseOrder.SupplierId != null) { var supplierManager = new SupplierManager(this); Supplier supplier = supplierManager.GetSupplier(Convert.ToInt32(purchaseOrder.SupplierId), Company.CompanyId); selSupplier.ShowSupplier(supplier); } } } }
/// <summary> /// </summary> //int invoiceAutoIncrement = 1111; /// <summary> /// //// /// </summary> private void Purchase_Load(object sender, EventArgs e) { SupplierManager _supplierManager = new SupplierManager(); supplierComboBox.DataSource = _supplierManager.DisplayComboSupplier(); CategoryManager _categoryManager = new CategoryManager(); categoryComboBox.DataSource = _categoryManager.DisplayComboCategories(); //ProductManager _productManager = new ProductManager(); //productComboBox.DataSource = _productManager.DisplayComboProducts(); //ModelProduct _modelProduct = new ModelProduct(); //_modelProduct.Name = categoryComboBox.Text; //_productManager.ProductComboList(_modelProduct); //productComboBox.DataSource = _productManager.DisplayComboProducts(); //supplierInvoiceTextBox.Text = invoiceAutoIncrement.ToString(); }
private void SetAutocompleteForSuppliers() { SuppliersNames = SupplierManager.GetAllSuppliersNames(); TextBoxAutoCompleteUtility.SetAutoCompleteSourceForTextBox(txtSupplierName, SuppliersNames); }
public SupplierController() { _aManager = new SupplierManager(); }
public IActionResult Index() { var model = SupplierManager.GetSupplierVMs(); return(View(model)); }
public void setManager(SupplierManager mgr) { smanager = mgr; }
private static void ChooseOption(CustomerManager customersManager, SupplierManager supplierManager) { Console.WriteLine("\n1.Afiseaza Clienti, \n2.Adauga Client, \n3.Modifica Client, \n4.Sterge Client,"); Console.WriteLine("5.Afiseaza Furnizori, \n6.Adauga Furnizor, \n7.Modifica Furnizori, \n8.Sterge Furnizor."); ConsoleKeyInfo tastaApasata = Console.ReadKey(); switch (tastaApasata.Key) { case ConsoleKey.D1: customersManager.Display(); break; case ConsoleKey.D2: Customer customer = new Customer(); Console.WriteLine($"\nIntroduceti numele noului client:"); customer.FirstName = ProcessText("Numele noului client"); Console.WriteLine($"\nIntroduceti prenumele noului client"); customer.LastName = ProcessText("Prenumele noului client"); Console.WriteLine($"\nIntroduceti tara noului client"); customer.Country = ProcessText("Tara noului client"); Console.WriteLine($"\nIntroduceti orasul noului client"); customer.City = ProcessText("Orasul noului client"); customersManager.Add(customer); Console.WriteLine("Client-ul a fost creat cu succes"); break; case ConsoleKey.D3: Console.WriteLine("\nIntroduceti id-ul clientului pe care vreti sa il modificati"); int id = GeoptV2(customersManager); Customer tempCustomer = customersManager.GetCustomerById(id); Console.WriteLine($"Prenumele: {tempCustomer.FirstName} \nNumele: {tempCustomer.LastName} \nTara: {tempCustomer.Country} \nOrasul: {tempCustomer.City} \nTelefonul: {tempCustomer.Phone}"); Console.WriteLine("Introduceti noul dvs prenume"); string prenume = ProcessText("Noul dvs prenume"); Console.WriteLine("Introduceti noul dvs nume:"); string nume = ProcessText("Noul dvs nume"); Console.WriteLine("Introduceti noul dvs oras"); string oras = ProcessText("Noul dvs oras"); Console.WriteLine("Introduceti noua dvs tara"); string tara = ProcessText("Noua dvs tara"); customersManager.Modify(id, nume, prenume, tara, oras); Console.WriteLine("Clientul a fost modificat cu succes"); break; case ConsoleKey.D4: Console.WriteLine("\nIntroduceti id-ul clientului pe care vreti sa il stergeti"); customersManager.Delete(GeoptV2(customersManager)); Console.WriteLine("Client-ul a fost sters"); break; case ConsoleKey.D5: supplierManager.Display(); break; case ConsoleKey.D6: Supplier tempSupplier = new Supplier(); Console.WriteLine($"Introduceti numele companiei!"); tempSupplier.CompanyName = ProcessText("Numele companiei"); Console.WriteLine("Introduceti numele de contact"); tempSupplier.ContactName = ProcessText("Numele de contact"); Console.WriteLine("Introduceti titlul de contact"); tempSupplier.ContactTitle = ProcessText("Titlul de contact"); Console.WriteLine("Introduceti orasul dvs"); tempSupplier.City = ProcessText("Introduceti orasul"); Console.WriteLine("Introduceti tara dvs"); tempSupplier.Country = ProcessText("Introduceti tara"); Console.WriteLine("Introduceti numarul de telefon!"); tempSupplier.Phone = ProcessNumber("Numar de telefon"); supplierManager.Add(tempSupplier); Console.WriteLine("Furnizorul a fost adaugat!"); break; case ConsoleKey.D7: Console.WriteLine("Introduceti id-ul pe care vreti sa il modificati"); int suppId = Geopt(supplierManager); Supplier tempSupp = new CRMEntities().Suppliers.Find(suppId); Console.WriteLine($"\nNumele companiei: {tempSupp.CompanyName} \nNumele de contact: {tempSupp.ContactName} \nTitlul de contact: {tempSupp.ContactTitle} \nOrasul: {tempSupp.City} \nTara: {tempSupp.Country} \nTelefon: {tempSupp.Phone}"); Console.WriteLine("Introduceti noul nume al companiei:"); string CompanyName = ProcessText("Numele companiei"); Console.WriteLine("Introduceti noul nume de contact:"); string ContactName = ProcessText("Numele de contact"); Console.WriteLine("Introduceti noul nume noul titlu de contact:"); string ContactTitle = ProcessText("Titlul de contact"); Console.WriteLine("Introduceti noul oras:"); string City = ProcessText("Oras"); Console.WriteLine("Introduceti noua tara:"); string Country = ProcessText("Tara"); Console.WriteLine("Introduceti noul telefon:"); string Phone = ProcessNumber("Telefon"); supplierManager.Modify(suppId, CompanyName, ContactName, ContactTitle, City, Country, Phone); Console.WriteLine("Furnizorul a fost modificat cu succes!"); break; case ConsoleKey.D8: Console.WriteLine("Introduceti id-ul pe care vreti sa il stergeti!"); supplierManager.Delete(Geopt(supplierManager)); Console.WriteLine("Furnizorul a fost sters!"); break; default: Console.WriteLine(TastaGresita); ChooseOption(customersManager, supplierManager); break; } CanContinue(customersManager, supplierManager); }
protected void Page_Load(object sender, EventArgs e) { _manager = new SupplierManager(this); //retrieve the SupplierId from Modal Popup if (!String.IsNullOrEmpty(Request["SupplierId"])) Page.ViewState["SupplierId"] = Request["SupplierId"]; if (Context.Items["SupplierId"] != null) Page.ViewState["SupplierId"] = Context.Items["SupplierId"]; if (Page.ViewState["SupplierId"] != null) { litTitle.Visible = false; Comments.SubjectId = Convert.ToInt32(Page.ViewState["SupplierId"]); btnCancel.OnClientClick = "parent.location='Suppliers.aspx'; return false;"; _originalsupplier = _manager.GetSupplier(Convert.ToInt32(Page.ViewState["SupplierId"]), Company.CompanyId); if (!IsPostBack && _originalsupplier != null) { // // After the verification if a supplier is selected, verify if the supplier has category // and set the right category to the DropDownList // if (_originalsupplier.SupplierCategoryId != null) { if (cboSupplierCategory.Items.FindByValue(Convert.ToString(_originalsupplier.SupplierCategoryId)) != null) cboSupplierCategory.SelectedValue = Convert.ToString(_originalsupplier.SupplierCategoryId); } /* * The code below checks the type of profile(LegalEntityProfile/Profile) */ if (_originalsupplier.LegalEntityProfile != null) Profile1.CompanyProfileEntity = _originalsupplier.LegalEntityProfile; else Profile1.ProfileEntity = _originalsupplier.Profile; // //load bank informations // cboBank.DataBind(); ListItem listItem = null; if (_originalsupplier.BankId.HasValue) listItem = cboBank.Items.FindByValue(Convert.ToString(_originalsupplier.BankId)); if (listItem != null) cboBank.SelectedValue = listItem.Value; txtAccountNumber.Text = _originalsupplier.AccountNumber; txtAgency.Text = _originalsupplier.Agency; ucAccountCreatedDate.DateTime = _originalsupplier.AccountCreatedDate; // //load ranking value // if (_originalsupplier.Ranking != null) rtnRanking.CurrentRating = Convert.ToInt32(_originalsupplier.Ranking); } } else { btnCancel.OnClientClick = "location='Suppliers.aspx'; return false;"; // // Legal Entity // if (Page.ViewState["LegalEntityProfileId"] != null) { _originalsupplier = _manager.GetSuppliersByLegalEntityProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"])); if (_originalsupplier != null) { Page.ViewState["ProfileExists"] = "0"; /* * if isn't a postback set the values of company in profile_LegalEntity1 * else the values are reload in all postback * */ if (!IsPostBack) Profile1.CompanyProfileEntity = _originalsupplier.LegalEntityProfile; } } // // Natural Person // if (Page.ViewState["ProfileId"] != null) { _originalsupplier = _manager.GetSupplierByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProfileId"])); if (_originalsupplier != null) { Page.ViewState["ProfileExists"] = "0"; /*if isn't a postback set the values of company in profile * else the values are reload in all postback */ if (!IsPostBack) Profile1.ProfileEntity = _originalsupplier.Profile; } } } }
protected void Page_Load(object sender, EventArgs e) { _manager = new SupplierManager(this); //retrieve the SupplierId from Modal Popup if (!String.IsNullOrEmpty(Request["SupplierId"])) { Page.ViewState["SupplierId"] = Request["SupplierId"]; } if (Context.Items["SupplierId"] != null) { Page.ViewState["SupplierId"] = Context.Items["SupplierId"]; } if (Page.ViewState["SupplierId"] != null) { litTitle.Visible = false; Comments.SubjectId = Convert.ToInt32(Page.ViewState["SupplierId"]); btnCancel.OnClientClick = "parent.location='Suppliers.aspx'; return false;"; _originalsupplier = _manager.GetSupplier(Convert.ToInt32(Page.ViewState["SupplierId"]), Company.CompanyId); if (!IsPostBack && _originalsupplier != null) { // // After the verification if a supplier is selected, verify if the supplier has category // and set the right category to the DropDownList // if (_originalsupplier.SupplierCategoryId != null) { if (cboSupplierCategory.Items.FindByValue(Convert.ToString(_originalsupplier.SupplierCategoryId)) != null) { cboSupplierCategory.SelectedValue = Convert.ToString(_originalsupplier.SupplierCategoryId); } } /* * The code below checks the type of profile(LegalEntityProfile/Profile) */ if (_originalsupplier.LegalEntityProfile != null) { Profile1.CompanyProfileEntity = _originalsupplier.LegalEntityProfile; } else { Profile1.ProfileEntity = _originalsupplier.Profile; } // //load bank informations // cboBank.DataBind(); ListItem listItem = null; if (_originalsupplier.BankId.HasValue) { listItem = cboBank.Items.FindByValue(Convert.ToString(_originalsupplier.BankId)); } if (listItem != null) { cboBank.SelectedValue = listItem.Value; } txtAccountNumber.Text = _originalsupplier.AccountNumber; txtAgency.Text = _originalsupplier.Agency; ucAccountCreatedDate.DateTime = _originalsupplier.AccountCreatedDate; // //load ranking value // if (_originalsupplier.Ranking != null) { rtnRanking.CurrentRating = Convert.ToInt32(_originalsupplier.Ranking); } } } else { btnCancel.OnClientClick = "location='Suppliers.aspx'; return false;"; // // Legal Entity // if (Page.ViewState["LegalEntityProfileId"] != null) { _originalsupplier = _manager.GetSuppliersByLegalEntityProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["LegalEntityProfileId"])); if (_originalsupplier != null) { Page.ViewState["ProfileExists"] = "0"; /* * if isn't a postback set the values of company in profile_LegalEntity1 * else the values are reload in all postback * */ if (!IsPostBack) { Profile1.CompanyProfileEntity = _originalsupplier.LegalEntityProfile; } } } // // Natural Person // if (Page.ViewState["ProfileId"] != null) { _originalsupplier = _manager.GetSupplierByProfile(Company.CompanyId, Convert.ToInt32(Page.ViewState["ProfileId"])); if (_originalsupplier != null) { Page.ViewState["ProfileExists"] = "0"; /*if isn't a postback set the values of company in profile * else the values are reload in all postback */ if (!IsPostBack) { Profile1.ProfileEntity = _originalsupplier.Profile; } } } } }
private void SavePurchaseInvoice() { ErrorProvider.Clear(); var isFormValid = true; Supplier newSupplier = null; if (txtSupplierName.Text.IsNullOrEmptyOrWhiteSpace()) { isFormValid = false; ErrorProvider.SetError(txtSupplierName, Resources.ThisFieldIsRequired); } else if (!SuppliersNames.Contains(txtSupplierName.Text.FullTrim())) { isFormValid = ShowConfirmationDialog(Resources.SupplierNotExists) == DialogResult.Yes; newSupplier = new Supplier { Name = txtSupplierName.Text.FullTrim() }; } if (!PurchaseInvoiceItemVms.Any()) { isFormValid = false; ShowErrorMsg(Resources.InvoiceWithoutItems); } if (!isFormValid) { return; } if (!PurchaseInvoiceItemVms.Any()) { ShowErrorMsg(Resources.NoItemsAdded); return; } if (newSupplier != null) { SupplierManager.AddSupplier(newSupplier); } var purchaseInvoice = new PurchaseInvoice { SupplierId = SupplierManager.GetSupplierIdByName(txtSupplierName.Text.FullTrim()), Date = dtInvoiceDate.Value, Total = (decimal)dblInTotal.Value, Paid = (decimal)dblInPaid.Value, Discount = (decimal)dblInDiscount.Value }; PurchaseInvoiceManager.AddPurchaseInvoice(purchaseInvoice); PurchaseInvoiceItemManager.AddPurchaseInvoiceItems(PurchaseInvoiceItemVms.Select(item => new PurchaseInvoiceItem { InvoiceId = purchaseInvoice.Id, MaterialId = item.MaterialId, Quantity = item.Quantity, UnitPrice = item.UnitPrice, Notes = item.Notes }).ToList()); if (purchaseInvoice.Paid > 0) { PurchaseInvoicePaymentManager.AddPurchaseInvoicePayment(new PurchaseInvoicePayment { InvoiceId = purchaseInvoice.Id, Date = dtInvoiceDate.Value, Paid = (decimal)dblInPaid.Value }); } MaterialManager.UpdateQuantitiesAfterCreatingPurchaseInvoice(PurchaseInvoiceItemVms); ShowInfoMsg(Resources.InvoiceCreatedSuccessfully); Close(); }
public ApiMessage Create() { ApiMessage message = new ApiMessage() { Status = "ok" }; HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; HttpRequestBase request = context.Request; string user_id = User.Identity.Name; UserManager userMgr = new UserManager(int.Parse(user_id), null); BUser user = userMgr.CurrentUser; SupplierManager supplierManager = new SupplierManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); int province_id = 0; int city_id = 0; int district_id = 0; string address = request["address"]; string name = request["name"]; string fax = request["fax"]; string phone = request["phone"]; string postcode = request["postcode"]; string contact = request["contact"]; string remark = request["remark"]; int.TryParse(request["province_id"], out province_id); int.TryParse(request["city_id"], out city_id); int.TryParse(request["district_id"], out district_id); try { Supplier supplier = new Supplier(); supplier.Name = name; supplier.Phone = phone; supplier.PostalCode = postcode; supplier.Province_ID = province_id; if (province_id > 0 && province_id == city_id) { supplier.City_ID = district_id; } else { supplier.City_ID = city_id; } supplier.Address = address; supplier.Create_Time = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now); supplier.Enabled = true; supplier.Fax = fax; supplier.Shop_ID = supplierManager.Shop.Shop_ID; supplier.Contact_Person = contact; supplier.User_ID = supplierManager.CurrentUser.ID; supplier.Remark = remark; if (supplierManager.CreateSupplier(supplier)) { message.Status = "ok"; message.Message = "供应商创建成功"; } } catch (KM.JXC.Common.KMException.KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } return(message); }
private static void CanContinue(CustomerManager customersManager, SupplierManager supplierManager) { Console.WriteLine("\nDoriti sa faceti alta operatiune?"); Option(customersManager, supplierManager); }