public ActionResult Home() { #region Prep Utilities myHandler = new BusinessLogicHandler(); Supplier supplier = new Supplier(); RangeViewModel model = new RangeViewModel(); #endregion #region Get User(Supplier) string userName = User.Identity.GetUserName(); ApplicationDbContext dataSocket = new ApplicationDbContext(); UserStore<ApplicationUser> myStore = new UserStore<ApplicationUser>(dataSocket); _userManager = new ApplicationUserManager(myStore); var user = _userManager.FindByEmail(userName); #endregion #region Get Supplier Details supplier = myHandler.GetSupplier(user.Id); #endregion #region Get Orders For Supplier model.Orders = myHandler.GetSupplierOrders(supplier.SupplierID); if(model.Orders != null) { model.Orders.OrderBy(m => m.DateCreated); } #endregion return View(model); }
public void Given_valid_request_When_create_supplier_Then_should_call_correct_methods() { // Given var target = CreateRolesService(); var request = new SaveSupplierRequest() { UserId = Guid.NewGuid(), Name = "New Supplier", CompanyId = 2 }; var user = new UserForAuditing(); _usersRepository .Setup(s => s.GetByIdAndCompanyId(request.UserId, request.CompanyId)) .Returns(user); // When var supplierPassedToRepositoryForSave = new Supplier(); _suppliersRepository.Setup(x => x.SaveOrUpdate(It.IsAny<Supplier>())) .Callback<Supplier>(y => supplierPassedToRepositoryForSave = y); target.CreateSupplier(request); // Then _suppliersRepository.VerifyAll(); Assert.That(supplierPassedToRepositoryForSave.CompanyId, Is.EqualTo(request.CompanyId)); Assert.That(supplierPassedToRepositoryForSave.Name, Is.EqualTo(request.Name)); }
/// <summary> /// Form Constructor /// </summary> /// <param name="businessArg"></param> public FrmAddSupplier(Business businessArg) { InitializeComponent(); business = businessArg; newSupplier = new Supplier(); updatedSupplier = new Supplier(); }
///<summary>Inserts one Supplier into the database. Returns the new priKey.</summary> internal static long Insert(Supplier supplier) { if(DataConnection.DBtype==DatabaseType.Oracle) { supplier.SupplierNum=DbHelper.GetNextOracleKey("supplier","SupplierNum"); int loopcount=0; while(loopcount<100){ try { return Insert(supplier,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ supplier.SupplierNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(supplier,false); } }
///<summary>Inserts one Supplier into the database. Provides option to use the existing priKey.</summary> internal static long Insert(Supplier supplier,bool useExistingPK) { if(!useExistingPK && PrefC.RandomKeys) { supplier.SupplierNum=ReplicationServers.GetKey("supplier","SupplierNum"); } string command="INSERT INTO supplier ("; if(useExistingPK || PrefC.RandomKeys) { command+="SupplierNum,"; } command+="Name,Phone,CustomerId,Website,UserName,Password,Note) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(supplier.SupplierNum)+","; } command+= "'"+POut.String(supplier.Name)+"'," +"'"+POut.String(supplier.Phone)+"'," +"'"+POut.String(supplier.CustomerId)+"'," +"'"+POut.String(supplier.Website)+"'," +"'"+POut.String(supplier.UserName)+"'," +"'"+POut.String(supplier.Password)+"'," +"'"+POut.String(supplier.Note)+"')"; if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command); } else { supplier.SupplierNum=Db.NonQ(command,true); } return supplier.SupplierNum; }
public List<Supplier> findSupplier(string supId) { SupplierEnt supEnt = new SupplierEnt(); Supplier sup = new Supplier(); sup.Supplier_ID = supId; return supEnt.getSupplier(sup); }
public void updateObject(DataContext db, Supplier objIn) { throwExceptionIfInvilid(objIn); objIn.EntityKey = db.Suppliers.Where(o => o.id == objIn.id).Single().EntityKey; db.Suppliers.ApplyCurrentValues(objIn); }
public async Task Should_update_an_existing_lot() { using (var store = NewDocumentStore()) { using (var session = store.OpenAsyncSession()) { var supplier = new Supplier {Id = "Suppliers-1"}; await SaveEntity(supplier, session); var lot = new Lot {Id = "lots/2015/3", Arrived = new DateTime(2015, 6, 5)}; await SaveEntity(lot, session); } using (var session = store.OpenAsyncSession()) { var lotDto = new LotDto {Id = "lots/2015/3", Arrived = new DateTime(2015, 6, 5), SupplierId = "Suppliers-1"}; var service = GetLotItemsService(session); await service.Save(lotDto); } using (var session = store.OpenAsyncSession()) { var service = GetLotItemsService(session); var actual = await service.GetLotById("lots/2015/3"); actual.SupplierId.Should().Be("Suppliers-1"); } } }
protected void OnSelectedSupplier(object sender, SelectedSupplierEventArgs e) { supplier = e.Supplier; if (SelectedSupplier != null) SelectedSupplier(sender, e); }
public ActionResult Insert(Supplier model) { try { //var f = Request.Files["uplLogo"]; //if (f != null && f.ContentLength > 0) //{ // model.Logo = model.Id // + f.FileName.Substring(f.FileName.LastIndexOf(".")); // f.SaveAs(Server.MapPath("~/images/suppliers/" + model.Logo)); //} //var from = Server.MapPath("/photos/"+model.Logo); //model.Logo = model.Id + model.Logo.Substring(model.Logo.LastIndexOf(".")); //var to = Server.MapPath("/Content/img/suppliers/" + model.Logo); //System.IO.File.Move(from, to); db.Suppliers.Add(model); db.SaveChanges(); ModelState.AddModelError("", "Inserted"); } catch { ModelState.AddModelError("", "Error"); } ViewBag.Suppliers = db.Suppliers; return View("Index", model); }
internal Supplier Create(string name, string note, SupplierType type) { Supplier supplier = new Supplier(name, note, type, dataAccessFacade); suppliers.Add(supplier); return supplier; }
private object Deserialize(DssImportHistory dssImportHistory) { Supplier supplier = new Supplier(); supplier.Code = dssImportHistory[1].ToUpper(); supplier.Name = dssImportHistory[3]; ShipAddress shipAddress = new ShipAddress(); shipAddress.Code = supplier.Code.ToUpper() + "_S"; shipAddress.Address = dssImportHistory[4]; shipAddress.ContactPersonName = dssImportHistory[13]; shipAddress.TelephoneNumber = dssImportHistory[14] + dssImportHistory[15]; shipAddress.Fax = dssImportHistory[16]; shipAddress.MobilePhone = dssImportHistory[18] + dssImportHistory[19]; shipAddress.PostalCode = dssImportHistory[9]; shipAddress.Party = supplier; BillAddress billAddress = new BillAddress(); billAddress.Code = supplier.Code.ToUpper() + "_B"; billAddress.Address = dssImportHistory[4]; billAddress.ContactPersonName = dssImportHistory[13]; billAddress.TelephoneNumber = dssImportHistory[14] + dssImportHistory[15]; billAddress.Fax = dssImportHistory[16]; billAddress.MobilePhone = dssImportHistory[18] + dssImportHistory[19]; billAddress.PostalCode = dssImportHistory[9]; billAddress.Party = supplier; IList<object> list = new List<object>(); list.Add(supplier); list.Add(shipAddress); list.Add(billAddress); return list; }
public SupplierDto Assemble(Supplier entity) { if (entity == null) { return null; } return new SupplierDto { Id = entity.Id, Comment = entity.Comment, LastUpdatedBy = entity.LastUpdatedBy, CreatedOn = entity.CreatedOn, UpdatedOn = entity.UpdatedOn, DeletedOn = entity.DeletedOn.HasValue ? entity.DeletedOn.Value : new DateTime(), Name = entity.Name, Description = entity.Description, LogoUrl = entity.LogoUrl, PrimaryPersonEmail = entity.PrimaryPersonEmail, PrimaryPersonFax = entity.PrimaryPersonFax, PrimaryPersonGsm = entity.PrimaryPersonGsm, PrimaryPersonName = entity.PrimaryPersonName, PrimaryPersonPhone = entity.PrimaryPersonPhone, PrimaryFinancialPersonEmail = entity.PrimaryFinancialPersonEmail, PrimaryFinancialPersonFax = entity.PrimaryFinancialPersonFax, PrimaryFinancialPersonGsm = entity.PrimaryFinancialPersonGsm, PrimaryFinancialPersonName = entity.PrimaryFinancialPersonName, PrimaryFinancialPersonPhone = entity.PrimaryFinancialPersonPhone, ShortName = entity.ShortName, TaxNumber = entity.TaxNumber, TaxOffice = entity.TaxOffice, Website = entity.Website }; }
public int GetHubHomeOfficeSupplierID() { var supplier = new Supplier(); string query = HCMIS.Repository.Queries.Supplier.SelectHomeOffice("HUB"); supplier.LoadFromRawSql(query); return Convert.ToInt32(supplier.DataTable.Rows[0]["SupplierID"]); }
public void TestEditSupplierCommand() { Supplier supplier = new Supplier() { Id = 1, Name = "Test Name 1" }; Mock<IServiceFactory> mockServiceFactory = new Mock<IServiceFactory>(); SuppliersViewModel viewModel = new SuppliersViewModel(mockServiceFactory.Object); viewModel.Suppliers = new ObservableCollection<Supplier>() { supplier }; Assert.IsTrue(viewModel.Suppliers[0].Name == "Test Name 1"); Assert.IsTrue(viewModel.CurrentSupplierViewModel == null); viewModel.EditSupplierCommand.Execute(supplier); Assert.IsTrue(viewModel.CurrentSupplierViewModel != null); mockServiceFactory.Setup(mock => mock.CreateClient<ISupplierService>().UpdateSupplier(It.IsAny<Supplier>())).Returns(viewModel.CurrentSupplierViewModel.Supplier); viewModel.CurrentSupplierViewModel.Supplier.Name = "Note 2"; viewModel.CurrentSupplierViewModel.SaveCommand.Execute(null); Assert.IsTrue(viewModel.Suppliers[0].Name == "Note 2"); }
public VisionPerceptor(Supplier<Image<Gray, byte>> input) { perspectiveTransform = new PerspectiveCorrection(input, CamModel.srcPerspective, CamModel.dstPerspective); laneDetector = new LaneMarkDetector(perspectiveTransform); roadDetector = new ClusterLanes(laneDetector); roadDetector.ResultReady += PassRoadModel; }
public static DataTable GetSuppliersByPOType(int poTypeID) { var supplier = new Supplier(); string query = HCMIS.Repository.Queries.Supplier.SelectSuppliersByPOType(poTypeID); supplier.LoadFromRawSql(query); return supplier.DataTable; }
public static DataTable GetDirectVendorSuppliers() { var supp = new Supplier(); string query = HCMIS.Repository.Queries.Supplier.SelectDirectDeliverySuppliers(); supp.LoadFromRawSql(query); return supp.DataTable; }
public void CanCreateSupplier() { Supplier supplier = new Supplier("ACME"); supplier.ContactName = "Coyote"; Assert.AreEqual("ACME", supplier.CompanyName); Assert.AreEqual("Coyote", supplier.ContactName); }
public static DataTable GetList() { Supplier supp = new Supplier(); string query = HCMIS.Repository.Queries.Supplier.SelectGetList(); supp.LoadFromRawSql(query); return supp.DataTable; }
//Method to delete the supplier from supplier table by passing all values of supplier details public static bool DeleteSupplier(Supplier supplier) { SqlConnection connection = TravelExpertsDB.GetConnection(); string deleteStatement = "DELETE FROM Suppliers " + "WHERE SupplierId = @SupplierId AND SupName = @SupName"; SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection); deleteCommand.Parameters.AddWithValue("@SupplierId", supplier.SupplierId); deleteCommand.Parameters.AddWithValue("@SupName", supplier.SupName); try { connection.Open(); int count = deleteCommand.ExecuteNonQuery(); if (count > 0) return true; else return false; } catch (SqlException ex) { throw ex; } finally { connection.Close(); } }
/// <summary> /// Gets all suppliers for. /// </summary> /// <param name="ItemID">The item ID.</param> /// <param name="unitID">The unit ID.</param> /// <returns></returns> public static DataTable GetAllSuppliersFor(int ItemID,int unitID) { Supplier supp = new Supplier(); string query = HCMIS.Repository.Queries.Supplier.SelectGetAllSuppliersFor(ItemID, unitID); supp.LoadFromRawSql(query); return supp.DataTable; }
private Supplier CreatePersistedSupplier(string supplierName) { Supplier supplier = new Supplier(supplierName); supplierRepository.SaveOrUpdate(supplier); FlushSessionAndEvict(supplier); return supplier; }
//Method to add the supplier to the supplier table public static void AddSupplier(Supplier supplier) { SqlConnection connection = TravelExpertsDB.GetConnection(); string insertStatement = "INSERT Suppliers (SupplierId, SupName) VALUES (@SupplierId, @SupName)"; SqlCommand insertCommand = new SqlCommand(insertStatement, connection); insertCommand.Parameters.AddWithValue("@SupplierId", supplier.SupplierId); insertCommand.Parameters.AddWithValue("@SupName",supplier.SupName); try { connection.Open(); insertCommand.ExecuteNonQuery(); //string selectStatement = "SELECT IDENT_CURRENT('Suppliers') from Suppliers"; //SqlCommand selectCommand = new SqlCommand(selectStatement, connection); //int supplierId = Convert.ToInt32(selectCommand.ExecuteScalar()); //return supplierId; } catch (SqlException ex) { throw ex; } finally { connection.Close(); } }
public Supplier findSupplier(string supId) { SupplierEnt supEnt = new SupplierEnt(); Supplier sup = new Supplier(); sup.Supplier_ID = supId; return supEnt.getSupplierForMob(sup); }
public ActionResult Create(Supplier item) { if (!ModelState.IsValid) return PartialView ("_Create", item); using (var scope = new TransactionScope ()) { item.CreateAndFlush (); } return PartialView ("_CreateSuccesful", item); //if (!ModelState.IsValid) //{ // if (Request.IsAjaxRequest()) // return PartialView("_Create", supplier); // return View(supplier); //} //supplier.Create (); //if (Request.IsAjaxRequest()) //{ // //FIXME: localize string // return PartialView("_Success", "Operation successful!"); //} //return View("Index"); }
protected void Button1_Click(object sender, EventArgs e) { if ((Convert.ToInt32(Request.QueryString["id"])) > 0) { Supplier s1 = new Supplier(); s1.Name = TextBox1.Text; s1.Phone = TextBox8.Text; s1.Email = TextBox2.Text; s1.ContactPerson = TextBox3.Text; s1.SupplierID = Convert.ToInt32(Request.QueryString["id"]); SupplierLogic sl = new SupplierLogic(); sl.Update(s1); Response.Redirect("SupplierList.aspx"); } else { Supplier s1 = new Supplier(); s1.Name = TextBox1.Text; s1.Phone = TextBox8.Text; s1.Email = TextBox2.Text; s1.ContactPerson = TextBox3.Text; SupplierLogic sl = new SupplierLogic(); sl.Insert(s1); Response.Redirect("SupplierList.aspx"); } }
public static supplierDto GetUpdateDMSDTO(Supplier supplier) { supplierDto dto = new supplierDto(); dto.suptCode = supplier.Code; dto.suptName = supplier.Name; dto.supShortName = supplier.ShortName; if (supplier.ContactObjectKey != null) { if (supplier.ContactObject.PersonName != null) { dto.linkMan = supplier.ContactObject.PersonName.DisplayName; } dto.phone = supplier.ContactObject.DefaultPhoneNum; dto.fax = supplier.ContactObject.DefaultFaxNum; if (supplier.ContactObject.DefaultLocation != null && supplier.ContactObject.DefaultLocation.PostalCode != null) { dto.zipCode = supplier.ContactObject.DefaultLocation.PostalCode.PostalCode; } if (supplier.ContactObject.DefaultLocation != null) { dto.address = supplier.ContactObject.DefaultLocation.Address1; } } dto.actionType = 2; // status 100201 有效 100202 无效 dto.status = (supplier.Effective != null && supplier.Effective.IsEffective) ? "100201" : "100202"; return dto; }
public ActionResult Create(Supplier supplier) { if (ModelState.IsValid) { try { try { _supplierService.CreateSupplier(supplier); this.ShowMessage("Supplier created successfully", MessageType.Success); return RedirectToAction("Index"); } catch (Exception ex) { this.ShowMessage("Error on data generation with the following details " + ex.Message, MessageType.Error); } } catch (Exception ex) { this.ShowMessage("Error on data generation with the following details " + ex.Message, MessageType.Error); } } return View(supplier); }
public DataTable GetHubHeadOffice() { var supplier = new Supplier(); var query = HCMIS.Repository.Queries.Supplier.SelectGetHubHeadOffice(); supplier.LoadFromRawSql(query); return supplier.DataTable; }
private void saveButton_Click(object sender, EventArgs e) { Supplier supplier = new Supplier(); //Set as Mandatory if (String.IsNullOrEmpty(codeTextBox.Text)) { MessageBox.Show("Code Can not be Empty!!!"); return; } if (String.IsNullOrEmpty(nameTextBox.Text)) { MessageBox.Show("Name Can not be Empty!!!"); return; } if (String.IsNullOrEmpty(contactTextBox.Text)) { MessageBox.Show("Contact Can not be Empty!!!"); return; } if (String.IsNullOrEmpty(emailTextBox.Text)) { MessageBox.Show("Email Can not be Empty!!!"); return; } //Length check if (codeTextBox.Text.Length != 4) { MessageBox.Show("Code must be 4 digit!!!"); return; } supplier.Code = codeTextBox.Text; supplier.Name = nameTextBox.Text; supplier.Address = addressTextBox.Text; supplier.Email = emailTextBox.Text; supplier.Contact = contactTextBox.Text; supplier.ContactPerson = contactpersonTextBox.Text; //Check UNIQUE if (_supplierManager.IsCodeExists(supplier)) { MessageBox.Show(codeTextBox.Text + " Already Exists!"); return; } if (_supplierManager.IsContactExists(supplier)) { MessageBox.Show(contactTextBox.Text + " Already Exists!"); return; } if (_supplierManager.IsEmailExists(supplier)) { MessageBox.Show(emailTextBox.Text + " Already Exists!"); return; } bool isAdded = _supplierManager.Add(supplier); if (isAdded) { MessageBox.Show("Saved"); } else { MessageBox.Show("Not Saved"); } ShowDataGridView.DataSource = _supplierManager.Display(); }
public byte[] GeneratePurchaseOrderPdf(PurchageOrder purchase, Supplier supplier, List <GetItemsResponse> itemData, Project project, LookUp store) { //**** genarate pdf ********* // to develop this functionality use itextsharp dll from nuget package // // create instance for memory streem to read pdf file // System.IO.MemoryStream ms = new System.IO.MemoryStream(); // create instance for pdf document genaration // Document pdfDoc = new Document(PageSize.A4, 35, 10, 25, 10); /* Item Table Styles start */ // create instance for table structure PdfPTable table = new PdfPTable(4); //actual width of table in points table.TotalWidth = 420f; //fix the absolute width of the table table.LockedWidth = true; //set col widths in proportions - 1/3 and 2/3 float[] widths = new float[] { 3f, 2f, 2f, 2f }; table.SetWidths(widths); table.HorizontalAlignment = 0; //leave a gap before and after the table table.SpacingBefore = 10f; // table.SpacingAfter = 30f; table.SetWidths(widths); /* Item Table Styles End */ // create instance for Collection table structure PdfPTable colTable = new PdfPTable(5); //actual width of table in points colTable.TotalWidth = 420f; //fix the absolute width of the table colTable.LockedWidth = true; //set col widths in proportions - 1/3 and 2/3 float[] colWidths = new float[] { 2f, 2f, 2f, 2f, 2f }; colTable.SetWidths(colWidths); colTable.HorizontalAlignment = 0; //leave a gap before and after the table colTable.SpacingBefore = 10f; colTable.SpacingAfter = 30f; colTable.SetWidths(colWidths); colTable.DefaultCell.Border = 0; // to write pdf file // PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, ms); // open for document // pdfDoc.Open(); // ** set water mark ** // string watermarkText = "CALIBAR TECH"; float fontSize = 80; float xPosition = 300; float yPosition = 400; float angle = 45; PdfContentByte under = pdfWriter.DirectContentUnder; BaseFont baseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED); under.BeginText(); under.SetColorFill(new BaseColor(229, 232, 232)); under.SetFontAndSize(baseFont, fontSize); under.ShowTextAligned(PdfContentByte.ALIGN_CENTER, watermarkText, xPosition, yPosition, angle); under.EndText(); // ** set water mark end ** // // Add Table And Styles Item Table // PdfPCell cell = new PdfPCell(new Phrase("Item", FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD, BaseColor.BLACK))); //cell.HorizontalAlignment = Element.ALIGN_LEFT; table.AddCell(cell); cell = new PdfPCell(new Phrase(1, "Quantity", FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD, BaseColor.BLACK))); //cell.HorizontalAlignment = Element.ALIGN_RIGHT; table.AddCell(cell); cell = new PdfPCell(new Phrase(1, "Expected Cost", FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD, BaseColor.BLACK))); table.AddCell(cell); //cell.HorizontalAlignment = Element.ALIGN_RIGHT; cell = new PdfPCell(new Phrase(1, "Comments", FontFactory.GetFont("Arial", 12, iTextSharp.text.Font.BOLD, BaseColor.BLACK))); //cell.HorizontalAlignment = Element.ALIGN_RIGHT; table.AddCell(cell); foreach (var it in itemData) { cell = new PdfPCell(new Phrase(it.ItemName)); table.AddCell(cell); cell = new PdfPCell(new Phrase(Convert.ToString(it.Quantity))); table.AddCell(cell); cell = new PdfPCell(new Phrase(Convert.ToString(Math.Round(it.ExpectedCost, 3)))); table.AddCell(cell); cell = new PdfPCell(new Phrase(it.Comments)); table.AddCell(cell); } PdfPTable mtable = new PdfPTable(2); mtable.WidthPercentage = 100; mtable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; PdfPTable table1 = new PdfPTable(2); table.WidthPercentage = 100; PdfPCell cell1 = new PdfPCell(new Phrase("")); cell1.BorderColor = BaseColor.WHITE; table1.AddCell(PhraseCell(new Phrase("Purchase Reference:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table1.AddCell(PhraseCell(new Phrase(purchase.PurchaseReference, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell1 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell1.Colspan = 2; cell1.PaddingBottom = 10f; table1.AddCell(cell1); mtable.AddCell(table1); PdfPTable table2 = new PdfPTable(2); table2.WidthPercentage = 100; PdfPCell cell2 = new PdfPCell(new Phrase("")); cell1.BorderColor = BaseColor.WHITE; table2.AddCell(PhraseCell(new Phrase("Project Name:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table2.AddCell(PhraseCell(new Phrase(project.Name1, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell2 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell2.Colspan = 2; cell2.PaddingBottom = 10f; table2.AddCell(cell1); mtable.AddCell(table2); PdfPTable mtable1 = new PdfPTable(2); mtable1.WidthPercentage = 100; mtable1.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; PdfPTable table3 = new PdfPTable(2); table3.WidthPercentage = 100; PdfPCell cell3 = new PdfPCell(new Phrase("")); cell3.BorderColor = BaseColor.WHITE; table3.AddCell(PhraseCell(new Phrase("Store Name:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table3.AddCell(PhraseCell(new Phrase(store.Name1, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell3 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell3.Colspan = 2; cell3.PaddingBottom = 10f; table3.AddCell(cell3); mtable1.AddCell(table3); PdfPTable table4 = new PdfPTable(2); table4.WidthPercentage = 100; PdfPCell cell4 = new PdfPCell(new Phrase("")); cell4.BorderColor = BaseColor.WHITE; DateTime Date = purchase.ArrivingDate; table4.AddCell(PhraseCell(new Phrase("Arriving Date:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table4.AddCell(PhraseCell(new Phrase(Date.ToString("dd/MM/yyyy"), FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell4 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell4.Colspan = 2; cell4.PaddingBottom = 10f; table4.AddCell(cell4); mtable1.AddCell(table4); PdfPTable mtable2 = new PdfPTable(2); mtable2.WidthPercentage = 100; mtable2.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; PdfPTable table5 = new PdfPTable(2); table5.WidthPercentage = 100; PdfPCell cell5 = new PdfPCell(new Phrase("")); cell5.BorderColor = BaseColor.WHITE; table5.AddCell(PhraseCell(new Phrase("Supplier Name:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table5.AddCell(PhraseCell(new Phrase(supplier.Name1, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell5 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell5.Colspan = 2; cell5.PaddingBottom = 10f; table5.AddCell(cell5); mtable2.AddCell(table5); PdfPTable table6 = new PdfPTable(2); table6.WidthPercentage = 100; PdfPCell cell6 = new PdfPCell(new Phrase("")); cell6.BorderColor = BaseColor.WHITE; table6.AddCell(PhraseCell(new Phrase("Supplier Address:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table6.AddCell(PhraseCell(new Phrase(supplier.Address, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell6 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell6.Colspan = 2; cell6.PaddingBottom = 10f; table6.AddCell(cell6); mtable2.AddCell(table6); PdfPTable mtable3 = new PdfPTable(2); mtable3.WidthPercentage = 100; mtable3.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER; PdfPTable table7 = new PdfPTable(2); table7.WidthPercentage = 100; PdfPCell cell7 = new PdfPCell(new Phrase("")); cell7.BorderColor = BaseColor.WHITE; table7.AddCell(PhraseCell(new Phrase("Billing Address:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table7.AddCell(PhraseCell(new Phrase(purchase.BillingAddress, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell7 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell7.Colspan = 2; cell7.PaddingBottom = 10f; table7.AddCell(cell7); mtable3.AddCell(table7); PdfPTable table8 = new PdfPTable(2); table6.WidthPercentage = 100; PdfPCell cell8 = new PdfPCell(new Phrase("")); cell8.BorderColor = BaseColor.WHITE; table8.AddCell(PhraseCell(new Phrase("Shipping Address:", FontFactory.GetFont("Arial", 10, Font.BOLD, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); table8.AddCell(PhraseCell(new Phrase(purchase.ShippingAddress, FontFactory.GetFont("Arial", 11, Font.NORMAL, BaseColor.BLACK)), PdfPCell.ALIGN_LEFT)); cell8 = PhraseCell(new Phrase(), PdfPCell.ALIGN_CENTER); cell8.Colspan = 2; cell8.PaddingBottom = 10f; table8.AddCell(cell8); mtable3.AddCell(table8); // set font style Font mainHeader = FontFactory.GetFont("Calibri", 20, Font.BOLD, BaseColor.BLACK); Font subHeader = FontFactory.GetFont("Calibri", 10, Font.BOLD, BaseColor.BLACK); Font mailsubHeader = FontFactory.GetFont("Calibri", 9, Font.BOLD, BaseColor.BLACK); Font fontHeader = FontFactory.GetFont("Calibri", 15, Font.BOLD, new BaseColor(0, 25, 51)); Font fontTitle = FontFactory.GetFont("Calibri", 12, Font.BOLD, new BaseColor(12, 95, 151)); Font detailstyle = FontFactory.GetFont("Calibri", 13, Font.BOLD); string header = "CALIBER MAINTENANCE MANAGEMENT SYSTEM"; string subheader1 = "132/A, Bluepal Building"; string subheader2 = "Opp JNTU, Kukatpally, Hyderabad - 500 072."; string subheader3 = "email:[email protected]"; string itemInfo = "Item Details"; string purchaseInfo = "Purchase Details"; // set margins header = header.PadLeft(40); subheader1 = subheader1.PadLeft(60); subheader3 = subheader3.PadLeft(90); // set header names with styles // Paragraph head = new Paragraph(header + "\n", mainHeader); Paragraph subhead = new Paragraph(subheader1 + subheader2 + "\n", subHeader); Paragraph subhead2 = new Paragraph(subheader3 + "\n", mailsubHeader); subhead2.SpacingAfter = 10; Paragraph purchaseData = new Paragraph(purchaseInfo, fontTitle); purchaseData.SpacingAfter = 10; Paragraph itemHeader = new Paragraph(itemInfo, fontTitle); itemHeader.SpacingAfter = 10; BaseColor bc = new BaseColor(5); pdfDoc.Add(head); pdfDoc.Add(subhead); pdfDoc.Add(subhead2); pdfDoc.Add(purchaseData); pdfDoc.Add(mtable); pdfDoc.Add(mtable1); pdfDoc.Add(mtable2); pdfDoc.Add(mtable3); pdfDoc.Add(itemHeader); pdfDoc.Add(table); pdfDoc.Close(); pdfWriter.Close(); ms.Close(); return(ms.ToArray()); }
public static string insertSup(Supplier sup, Address ad, AddressSAT ads) { return(DataAccessLayer.AccesoBDDAL.sp_insert_supplier(sup, ad, ads)); }
public void CreateSupplier(Supplier supplier) { EFBroker_Supplier.CreateSupplier(supplier); }
public void UpdateSupplier(Supplier supplier) { EFBroker_Supplier.UpdateSupplier(supplier); }
public void InsertSupplier(Supplier p) { var handler = HandlerFactory <Supplier> .GetHandler(); handler.Insert(p); }
public bool UniqueContact(Supplier supplier) { return(_supplierRepository.UniqueContact(supplier)); }
public void UpdateSupplierForPurchase(Supplier aSupplier) { SupplierDAO aDao = new SupplierDAO(); aDao.UpdateSupplierForPurchase(aSupplier); }
public ActionResult UpdateSupplier(int id) { Supplier sup = ctx.Suppliers.FirstOrDefault(x => x.SupplierID == id); return(View(sup)); }
public ActionResult AddSupplier(Supplier s) { ctx.Suppliers.Add(s); ctx.SaveChanges(); return(RedirectToAction("Index")); }
public bool Add(Supplier supplier) { return(_supplierRepository.Add(supplier)); }
public static void Main(String[] args) { String name; Supplier supplier; Detail detail; Supplier[] suppliers; Detail[] details; Order order; Storage db = StorageFactory.Instance.CreateStorage(); db.Open("testlist.dbs"); Root root = (Root)db.Root; if (root == null) { root = new Root(); #if USE_GENERICS root.details = db.CreateFieldIndex <string, Detail>("name", true); root.suppliers = db.CreateFieldIndex <string, Supplier>("name", true); #else root.details = db.CreateFieldIndex(typeof(Detail), "name", true); root.suppliers = db.CreateFieldIndex(typeof(Supplier), "name", true); #endif db.Root = root; } while (true) { Console.WriteLine("------------------------------------------"); Console.WriteLine("1. Add supplier"); Console.WriteLine("2. Add detail"); Console.WriteLine("3. Add order"); Console.WriteLine("4. Search suppliers"); Console.WriteLine("5. Search details"); Console.WriteLine("6. Suppliers of detail"); Console.WriteLine("7. Deails shipped by supplier"); Console.WriteLine("8. Exit"); String str = input("> "); int cmd; try { cmd = Int32.Parse(str); } catch (Exception) { Console.WriteLine("Invalid command"); continue; } switch (cmd) { case 1: supplier = new Supplier(); supplier.name = input("Supplier name: "); supplier.address = input("Supplier address: "); #if USE_GENERICS supplier.orders = db.CreateLink <Order>(); #else supplier.orders = db.CreateLink(); #endif root.suppliers.Put(supplier); break; case 2: detail = new Detail(); detail.name = input("Detail name: "); detail.weight = inputReal("Detail weight: "); detail.color = input("Detail color: "); #if USE_GENERICS detail.orders = db.CreateLink <Order>(); #else detail.orders = db.CreateLink(); #endif root.details.Put(detail); break; case 3: order = new Order(); name = input("Supplier name: "); #if USE_GENERICS order.supplier = root.suppliers[name]; #else order.supplier = (Supplier)root.suppliers[name]; #endif if (order.supplier == null) { Console.WriteLine("No such supplier"); continue; } name = input("Detail name: "); #if USE_GENERICS order.detail = root.details[name]; #else order.detail = (Detail)root.details[name]; #endif if (order.detail == null) { Console.WriteLine("No such detail"); continue; } order.quantity = inputInt("Quantity: "); order.price = inputInt("Price: "); order.detail.orders.Add(order); order.supplier.orders.Add(order); order.detail.Store(); order.supplier.Store(); break; case 4: name = input("Supplier name prefix: "); #if USE_GENERICS suppliers = root.suppliers.Get(new Key(name), new Key(name + (char)255, false)); #else suppliers = (Supplier[])root.suppliers.Get(new Key(name), new Key(name + (char)255, false)); #endif if (suppliers.Length == 0) { Console.WriteLine("No such suppliers found"); } else { for (int i = 0; i < suppliers.Length; i++) { Console.WriteLine(suppliers[i].name + '\t' + suppliers[i].address); } } continue; case 5: name = input("Detail name prefix: "); #if USE_GENERICS details = root.details.Get(new Key(name), new Key(name + (char)255, false)); #else details = (Detail[])root.details.Get(new Key(name), new Key(name + (char)255, false)); #endif if (details.Length == 0) { Console.WriteLine("No such details found"); } else { for (int i = 0; i < details.Length; i++) { Console.WriteLine(details[i].name + '\t' + details[i].weight + '\t' + details[i].color); } } continue; case 6: name = input("Detail name: "); #if USE_GENERICS detail = (Detail)root.details[name]; #else detail = (Detail)root.details[name]; #endif if (detail == null) { Console.WriteLine("No such detail"); } else { for (int i = detail.orders.Length; --i >= 0;) { Console.WriteLine(((Order)detail.orders[i]).supplier.name); } } continue; case 7: name = input("Supplier name: "); #if USE_GENERICS supplier = (Supplier)root.suppliers[name]; #else supplier = (Supplier)root.suppliers[name]; #endif if (supplier == null) { Console.WriteLine("No such supplier"); } else { for (int i = supplier.orders.Length; --i >= 0;) { Console.WriteLine(((Order)supplier.orders[i]).detail.name); } } continue; case 8: db.Close(); Console.WriteLine("End of session"); return; default: Console.WriteLine("Invalid command"); continue; } db.Commit(); } }
/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } if (!string.IsNullOrEmpty(ResourceType)) { writer.WriteString("resourceType", (string)ResourceType !); } ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false); if ((Identifier != null) && (Identifier.Count != 0)) { writer.WritePropertyName("identifier"); writer.WriteStartArray(); foreach (Identifier valIdentifier in Identifier) { valIdentifier.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((BasedOn != null) && (BasedOn.Count != 0)) { writer.WritePropertyName("basedOn"); writer.WriteStartArray(); foreach (Reference valBasedOn in BasedOn) { valBasedOn.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((PartOf != null) && (PartOf.Count != 0)) { writer.WritePropertyName("partOf"); writer.WriteStartArray(); foreach (Reference valPartOf in PartOf) { valPartOf.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(Status)) { writer.WriteString("status", (string)Status !); } if (_Status != null) { writer.WritePropertyName("_status"); _Status.SerializeJson(writer, options); } if (Patient != null) { writer.WritePropertyName("patient"); Patient.SerializeJson(writer, options); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (SuppliedItem != null) { writer.WritePropertyName("suppliedItem"); SuppliedItem.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(OccurrenceDateTime)) { writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !); } if (_OccurrenceDateTime != null) { writer.WritePropertyName("_occurrenceDateTime"); _OccurrenceDateTime.SerializeJson(writer, options); } if (OccurrencePeriod != null) { writer.WritePropertyName("occurrencePeriod"); OccurrencePeriod.SerializeJson(writer, options); } if (OccurrenceTiming != null) { writer.WritePropertyName("occurrenceTiming"); OccurrenceTiming.SerializeJson(writer, options); } if (Supplier != null) { writer.WritePropertyName("supplier"); Supplier.SerializeJson(writer, options); } if (Destination != null) { writer.WritePropertyName("destination"); Destination.SerializeJson(writer, options); } if ((Receiver != null) && (Receiver.Count != 0)) { writer.WritePropertyName("receiver"); writer.WriteStartArray(); foreach (Reference valReceiver in Receiver) { valReceiver.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
public bool UniqueEmail(Supplier supplier) { return(_supplierRepository.UniqueEmail(supplier)); }
/// <summary> /// Saves the item policy /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { var itm = new Items(); var itmSup = new ItemSupplier(); if (_itemId != 0) { itm.LoadByPrimaryKey(_itemId); } else { itm.AddNew(); var prodCate = new ProductsCategory(); prodCate.AddNew(); prodCate.ItemId = itm.ID; prodCate.SubCategoryID = Convert.ToInt32(_categoryId); prodCate.Save(); } //if (rdA.Checked || rdB.Checked || rdC.Checked) // itm.ABC = ((rdA.Checked) ? 1 : (rdB.Checked) ? 2 : 3); //if (rdV.Checked || rdE.Checked || rdN.Checked) // itm.VEN = ((rdV.Checked) ? 1 : (rdE.Checked) ? 2 : 3); itm.IsInHospitalList = ckExculed.Checked; //itm.NeedExpiryBatch = chkNeedExpiryBatch.Checked; string valid = ValidateFields(); if (valid == "true") { itm.NeedExpiryBatch = chkNeedExpiryBatch.Checked; itm.Pediatric = chkIsVaccine.Checked; //wrong coulmn name but used to identify the vaccine items itm.StockCodeDACA = txtText.Text; itm.Cost = txtQuantityPerPack.Text; itm.Save(); } else { XtraMessageBox.Show(valid, "Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } //TODO: To add categories //Needs some modification on edit // this will only add the suppliers //do some thing on edit itmSup.DeleteAllSupForItem(itm.ID); Supplier sup = new Supplier(); foreach (object t in lstSuppliers.CheckedItems) { sup.GetSupplierByName(t.ToString()); itmSup.AddNew(); itmSup.ItemID = itm.ID; itmSup.SupplierID = sup.ID; itmSup.Save(); } var progItm = new ProgramProduct(); progItm.DeleteAllProgramsForItem(_itemId); var prog = new Programs(); //prog.AddNew(); //prog.Name = cboPrograms.Text; //prog.Save(); //foreach (object t in lstPrograms.CheckedItems) //{ // prog.GetProgramByName(t.ToString()); // progItm.AddNew(); // progItm.ItemID = itm.ID; // progItm.ProgramID = prog.ID; // progItm.StoreID = (progItm.ProgramID == 1000) ? 8 : 9; // progItm.Save(); //} if (rdSubProgram.EditValue != null) { progItm.AddNew(); progItm.ItemID = itm.ID; progItm.ProgramID = Convert.ToInt32(rdSubProgram.EditValue); progItm.StoreID = 9; progItm.Save(); } var duItem = new DUsItemList(); var dus = new ReceivingUnits(); foreach (object t in lstDUs.CheckedItems) { dus.GetDUByName(t.ToString()); duItem.AddNew(); duItem.DUID = dus.ID; duItem.ItemID = _itemId; try { duItem.Save(); } catch { } } XtraMessageBox.Show("Item Detail is Saved Successfully!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); }
/// <summary> /// Populates the fields based on the supplied itemID or categoryID /// </summary> private void PopulateFields() { if (_itemId == 0) { return; } Items itm = new Items(); DataTable dtItem = itm.GetItemById(_itemId); txtItemName.Text = dtItem.Rows[0]["ItemName"].ToString() + " - " + dtItem.Rows[0]["Unit"].ToString() + " - " + dtItem.Rows[0]["Strength"].ToString(); ckExculed.Checked = itm.IsInHospitalList; chkNeedExpiryBatch.Checked = itm.NeedExpiryBatch; if (dtItem.Rows[0]["Pediatric"] != DBNull.Value) { chkIsVaccine.Checked = itm.Pediatric; } txtText.Text = itm.StockCodeDACA ?? string.Empty; txtQuantityPerPack.Text = itm.Cost ?? string.Empty; try { if (dtItem.Rows[0]["ABC"].ToString() == "A") { rdA.Checked = true; } else if (dtItem.Rows[0]["ABC"].ToString() == "B") { rdB.Checked = true; } else if (dtItem.Rows[0]["ABC"].ToString() == "C") { rdC.Checked = true; } } catch { } try { if (dtItem.Rows[0]["VEN"].ToString() == "V") { rdV.Checked = true; } else if (dtItem.Rows[0]["VEN"].ToString() == "E") { rdE.Checked = true; } else if (dtItem.Rows[0]["VEN"].ToString() == "N") { rdN.Checked = true; } } catch { } //ItemShelf itmShelf = new ItemShelf(); //DataTable dtSlf = itmShelf.GetLocationByItem(itm.ID); //lstBinLocation.DataSource = dtSlf; var unit = new ItemUnit(); var itemunits = unit.LoadFromSQl(_itemId); itemunitbindingSource.DataSource = itemunits; if (VisibilitySetting.HandleUnits == 2) { listBox1.Visible = true; } else if (VisibilitySetting.HandleUnits == 3) { listBox1.Visible = true; } else if (VisibilitySetting.HandleUnits == 1) { listBox1.Hide(); } Supplier sup = new Supplier(); sup.GetActiveSuppliers(); ItemSupplier itmSup = new ItemSupplier(); itm.GetItemsBySupplier(_itemId); foreach (DataRowView dv in sup.DefaultView) { bool check = false; check = itmSup.CheckIfExist(_itemId, Convert.ToInt32(dv["ID"])); object obj = dv["CompanyName"]; lstSuppliers.Items.Add(obj, check); } Programs prog = new Programs(); prog.GetSubPrograms(); ProgramProduct progItem = new ProgramProduct(); //lstPrograms.Items.Clear(); //foreach (DataRowView dv in prog.DefaultView) //{ // bool check = false; // check = progItem.CheckIfExists(_itemId, Convert.ToInt32(dv["ID"])); // lstPrograms.Items.Add(dv["Name"], check); //} foreach (DataRow dr in prog.DefaultView.ToTable().Rows) { bool check = false; check = progItem.CheckIfExists(_itemId, Convert.ToInt32(dr["ID"])); if (Convert.ToString(dr["Name"]) != "All Programs") { rdSubProgram.Properties.Items.Add(new DevExpress.XtraEditors.Controls.RadioGroupItem(dr["ID"], dr["Name"].ToString())); } if (check) { rdSubProgram.EditValue = Convert.ToInt32(dr["ID"]); } } ReceivingUnits dus = new ReceivingUnits(); dus.GetActiveDispensaries(); lstDUs.Items.Clear(); DUsItemList duItem = new DUsItemList(); foreach (DataRowView drDus in dus.DefaultView) { bool check = false; check = duItem.CheckIfExsits(_itemId, Convert.ToInt32(drDus["ID"])); lstDUs.Items.Add(drDus["Name"], check); } }
public Supplier(Supplier toCopy) { Id = toCopy.Id; Name = toCopy.Name; NIP = toCopy.NIP; }
private void addButton_Click(object sender, EventArgs e) { bool passwordStrong = true; if (string.IsNullOrWhiteSpace(passwordTextBox.Text) || !FormatChecker.checkPasswdFormat(passwordTextBox.Text)) { passwordHintLabel.ForeColor = Color.Red; passwordStrong = false; } else { passwordHintLabel.ForeColor = SystemColors.ControlText; } if (isInputCorrect() && passwordStrong) { Supplier sup = new Supplier(); sup.setSupplierID(idTextBox.Text); sup.setSupplierName(supplierNameTextBox.Text); sup.setContectNo(supplierContactNoTextBox.Text); sup.setEmail(emailTextBox.Text); sup.setAddress(supplierAddressTextBox.Text); sup.setPassword(Security.getHash(passwordTextBox.Text, "SHA512", null)); if (perfumeRadioButton.Checked) { sup.setProductCategory("Perfume"); } else if (packageRadioButton.Checked) { sup.setProductCategory("Package"); } else if (bottleRadioButton.Checked) { sup.setProductCategory("Bottle"); } int i = sda.insert(sup, conn); if (i > 0) { supplierListDataGridView.Rows.Add(false, sup.getSupplierID(), sup.getSupplierName(), ((sup.getProductCategory().Equals("Perfume")) ? rs.GetString("perfumeText") : ((sup.getProductCategory().Equals("Package")) ? rs.GetString("packageText") : rs.GetString("bottleText"))), sup.getContectNo(), sup.getEmail(), sup.getAddress()); supplierListDataGridView.ClearSelection(); foreach (DataGridViewRow row in supplierListDataGridView.Rows) { if (idTextBox.Text.Equals(row.Cells["supplierIDColumn"].Value.ToString())) { row.Selected = true; supplierListDataGridView.FirstDisplayedScrollingRowIndex = row.Index; } } deleteButton.Enabled = true; deselectAllButton.Enabled = true; selectAllButton.Enabled = true; addButton.Enabled = false; updateButton.Enabled = true; staffIdHintLabel.Visible = false; MessageBox.Show(rs.GetString("addSuccessMsg")); } else { MessageBox.Show(rs.GetString("failToAddMsg"), rs.GetString("errorText"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public static SupplierView ConvertToSupplierView(this Supplier model) { return Mapper.Map<Supplier, SupplierView>(model); }
public void set(Supplier toCopy) { Name = toCopy.Name; NIP = toCopy.NIP; }
public void Test_AddSupplier(Supplier supplier) { this.Supplier = supplier; }
/// <summary> /// Lưu thông tin /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveDataFormExel_Click(object sender, EventArgs e) { string strUpdate = null; string strInsert = null; int countUpdate = 0; int countInsert = 0; int countExits = 0; if (!string.IsNullOrEmpty(textEditPathFileExel.Text)) { const string sheetName = "Sheet1"; string pathToExcelFile = textEditPathFileExel.Text.Trim(); var excelFile = new ExcelQueryFactory(pathToExcelFile); excelFile.AddMapping<Supplier>(x => x.AreaID, "AreaName"); excelFile.AddMapping<Supplier>(x => x.SupplierName, "SupplierName"); excelFile.AddMapping<Supplier>(x => x.PhoneNumber, "PhoneNumber"); excelFile.AddMapping<Supplier>(x => x.Address, "Address"); excelFile.AddMapping<Supplier>(x => x.Email, "Email"); excelFile.AddMapping<Supplier>(x => x.AccountNumber, "AccountNumber"); excelFile.AddMapping<Supplier>(x => x.Bank, "Bank"); excelFile.AddMapping<Supplier>(x => x.TaxCode, "TaxCode"); excelFile.AddMapping<Supplier>(x => x.Fax, "Fax"); excelFile.AddMapping<Supplier>(x => x.Website, "Website"); excelFile.TrimSpaces = TrimSpacesType.Both; excelFile.ReadOnly = true; IQueryable<Supplier> suppliers = (from a in excelFile.Worksheet<Supplier>(sheetName) select a); try { foreach (Supplier supplier in suppliers) { // Kiểm tra nếu ID Khu Vực // => Đã tồn tại rồi thì trả về thông tin của Khu vực đó // => Chưa tồn tại Tên khu vực này thì thực hiện thêm mới khu vực // => Nếu Tên Khu vực không được người dùng nhập vào thì gán = null _areaId = InsertOrUpdateArea(supplier.AreaID) != null ? InsertOrUpdateArea(supplier.AreaID).AreaID : null; if (!_suppliersService.CheckSupplierNameExit(supplier.SupplierName)) { // Bỏ qua nếu đã tồn tại rồi if (radioButtonIgnoreIfDepartmentExits.Checked) { countExits++; } // Cập nhật nếu tên Bộ Phận đã tồn tại rồi if (radioButtonUpdateIfDepartmentExits.Checked) { Supplier updateSupplier = _suppliersService.GetSupplierByName(supplier.SupplierName); updateSupplier.UpdateBy = _userName; updateSupplier.ModifyDate = DateTime.Now; if (!string.IsNullOrEmpty(_areaId)) { updateSupplier.AreaID = _areaId; } try { _suppliersService.Update(updateSupplier); countUpdate++; strUpdate += string.Format("{0}, ", supplier.SupplierName); } catch (Exception ex) { XtraMessageBox.Show(string.Format("Lỗi cập nhật \n{0}", ex.Message)); } } } // Nếu tên chưa tồn tại thì thực hiện thêm mới else { supplier.SupplierID = NextId(); if (!string.IsNullOrEmpty(_areaId)) { supplier.AreaID = _areaId; } supplier.CreatedDate = DateTime.Now; supplier.CreatedBy = _userName; supplier.SupplierName = supplier.SupplierName; supplier.IsActive = true; try { _suppliersService.Add(supplier); countInsert++; strInsert += string.Format("{0}, ", supplier.SupplierName); } catch (Exception ex) { XtraMessageBox.Show(string.Format("Lỗi thêm mới \n{0}", ex.Message)); } } } if (XtraMessageBox.Show( string.Format("Thực hiện thành công.\n" + "=> Bỏ qua: {3} - Nhà Cung Cấp đã tồn tại \n" + "=> Thêm mới: {0} - {2} \n" + "=> Cập nhật: {1} - {4} \n" + "Bạn có muốn thêm mới Nhà Cung Cấp nữa không?", countInsert, countUpdate, strInsert, countExits, strUpdate), "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { gridControl1.DataSource = null; textEditPathFileExel.Text = string.Empty; } else { DialogResult = DialogResult.No; } } catch (DbEntityValidationException ex) { var sb = new StringBuilder(); foreach (var eve in ex.EntityValidationErrors) { sb.AppendLine(String.Format("Entity of type '{0}' in state '{1}' has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State)); foreach (var ve in eve.ValidationErrors) { sb.AppendLine(String.Format("- Property: '{0}', Error: '{1}'", ve.PropertyName, ve.ErrorMessage)); } } throw new Exception(sb.ToString(), ex); } } else { XtraMessageBox.Show("Vui lòng chọn tập tin để nhập", "Thông Báo Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); textEditPathFileExel.Focus(); } }
public ActionResult Manage([Bind(Include = "SupplierId,SupplierName,Email,ContactName,ContactNo,Address")] Supplier item) { return(base.BaseSave <Supplier>(item, item.SupplierId > 0)); }
public async Task <ActionResult> ExportToExcel(MaterialReceiptDetailQueryViewModel model) { IList <MaterialReceiptDetail> lst = new List <MaterialReceiptDetail>(); using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient()) { await Task.Run(() => { PagingConfig cfg = new PagingConfig() { IsPaging = false, OrderBy = "CreateTime Desc,Key.ReceiptNo,Key.ItemNo", Where = GetWhereCondition(model) }; MethodReturnResult <IList <MaterialReceiptDetail> > result = client.GetDetail(ref cfg); if (result.Code == 0) { lst = result.Data; } }); } //创建工作薄。 IWorkbook wb = new HSSFWorkbook(); //设置EXCEL格式 ICellStyle style = wb.CreateCellStyle(); style.FillForegroundColor = 10; //有边框 style.BorderBottom = BorderStyle.THIN; style.BorderLeft = BorderStyle.THIN; style.BorderRight = BorderStyle.THIN; style.BorderTop = BorderStyle.THIN; IFont font = wb.CreateFont(); font.Boldweight = 10; style.SetFont(font); ICell cell = null; IRow row = null; ISheet ws = null; for (int j = 0; j < lst.Count; j++) { if (j % 65535 == 0) { ws = wb.CreateSheet(); row = ws.CreateRow(0); #region //列名 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptViewModel_ReceiptNo); //领料号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptViewModel_OrderNumber); //工单号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptViewModel_ReceiptDate); //领料日期 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_ItemNo); //项目号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_LineStoreName); //线别仓 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_MaterialCode); //物料编码 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("物料名称"); //物料名称 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_MaterialLot); //物料批号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_Qty); //数量 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_SupplierMaterialLot); //供应商批号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(LSMResources.StringResource.MaterialReceiptDetailViewModel_SupplierCode); //供应商编码 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("供应商名称"); //供应商名称 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("描述"); //描述 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("编辑人"); //编辑人 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue("编辑时间"); //编辑时间 #endregion font.Boldweight = 5; } MaterialReceiptDetail obj = lst[j]; MaterialReceipt mrObj = model.GetMaterialReceipt(obj.Key.ReceiptNo); Material m = model.GetMaterial(obj.MaterialCode); Supplier s = model.GetSupplier(obj.SupplierCode); row = ws.CreateRow(j + 1); #region //数据 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.Key.ReceiptNo); //领料号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(mrObj == null ? string.Empty : mrObj.OrderNumber); //工单号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(mrObj == null ? string.Empty : string.Format("{0:yyyy-MM-dd}", mrObj.ReceiptDate)); //领料日期 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.Key.ItemNo); //项目号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.LineStoreName); //线别仓 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.MaterialCode); //物料编码 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(m == null ? string.Empty : m.Name); //物料名称 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.MaterialLot); //物料批号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.Qty); //数量 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.SupplierMaterialLot); //供应商批号 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.SupplierCode); //供应商编码 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(s == null ? string.Empty : s.Name); //供应商名称 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.Description); //描述 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(obj.Editor); //编辑人 cell = row.CreateCell(row.Cells.Count); cell.CellStyle = style; cell.SetCellValue(string.Format("{0:yyyy-MM-dd HH:mm:ss}", obj.EditTime)); //编辑时间 #endregion } MemoryStream ms = new MemoryStream(); wb.Write(ms); ms.Flush(); ms.Position = 0; return(File(ms, "application/vnd.ms-excel", "MaterialReceiptData.xls")); }
public void InsertIntosupplier_payment_reportForSupplierPaymentTrack(Supplier aSupplier) { SupplierDAO aDao = new SupplierDAO(); aDao.InsertIntosupplier_payment_reportForSupplierPaymentTrack(aSupplier); }
public void UpdateSupplier(Supplier p) { throw new NotImplementedException(); }
public LoadingEntities() { using (var store = new DocumentStore()) { using (var session = store.OpenSession()) { #region loading_entities_1_1 Employee employee = session.Load <Employee>("employees/1"); #endregion } using (var session = store.OpenSession()) { #region loading_entities_1_2 // loading 'employees/1' // and transforming result using 'Employees_NoLastName' transformer // which returns 'LastName' as 'null' Employee employee = session.Load <Employees_NoLastName, Employee>("employees/1"); #endregion } using (var session = store.OpenSession()) { #region loading_entities_1_3 EntityWithIntegerId entity = session.Load <EntityWithIntegerId>(1); #endregion } using (var session = store.OpenSession()) { #region loading_entities_1_4 Employee employee = session.Load <Employee>(1); #endregion } using (var session = store.OpenSession()) { #region loading_entities_2_1 // loading 'products/1' // including document found in 'Supplier' property Product product = session .Include <Product>(x => x.Supplier) .Load <Product>("products/1"); Supplier supplier = session.Load <Supplier>(product.Supplier); // this will not make server call #endregion } using (var session = store.OpenSession()) { #region loading_entities_2_2 // loading 'products/1' // including document found in 'Supplier' property Product product = session .Include("Supplier") .Load <Product>("products/1"); Supplier supplier = session.Load <Supplier>(product.Supplier); // this will not make server call #endregion } using (var session = store.OpenSession()) { #region loading_entities_2_3 // loading 'products/1' // including document found in 'Supplier' property // transforming loaded product according to Products_Transformer Product product = session .Include <Product>(x => x.Supplier) .Load <Products_Transformer, Product>("products/1"); Supplier supplier = session.Load <Supplier>(product.Supplier); // this will not make server call #endregion } using (var session = store.OpenSession()) { #region loading_entities_3_1 Employee[] employees = session.Load <Employee>(new List <string> { "employees/1", "employees/2" }); Employee employee1 = employees[0]; Employee employee2 = employees[1]; #endregion } using (var session = store.OpenSession()) { #region loading_entities_3_2 // loading 'employees/1' and 'employees/2' // and transforming results using 'Employees_NoLastName' transformer // which returns 'LastName' as 'null' Employee[] employees = session .Load <Employees_NoLastName, Employee>(new List <string> { "employees/1", "employees/2" }); Employee employee1 = employees[0]; Employee employee2 = employees[1]; #endregion } using (var session = store.OpenSession()) { #region loading_entities_4_1 // return up to 128 entities with Id that starts with 'employees' Employee[] result = session .Advanced .LoadStartingWith <Employee>("employees", null, 0, 128); #endregion } using (var session = store.OpenSession()) { #region loading_entities_4_2 // return up to 128 entities with Id that starts with 'employees/' // and rest of the key begins with "1" or "2" e.g. employees/10, employees/25 Employee[] result = session .Advanced .LoadStartingWith <Employee>("employees/", "1*|2*", 0, 128); #endregion } using (var session = store.OpenSession()) { #region loading_entities_4_3 // return up to 128 entities with Id that starts with 'employees/' // and rest of the Id have length of 3, begins and ends with "1" // and contains any character at 2nd position e.g. employees/101, employees/1B1 // and transform results using 'Employees_NoLastName' transformer Employee[] result = session .Advanced .LoadStartingWith <Employees_NoLastName, Employee>("employees/", "1?1", 0, 128); #endregion } using (var session = store.OpenSession()) { #region loading_entities_5_1 IEnumerator <StreamResult <Employee> > enumerator = session.Advanced.Stream <Employee>("employees/"); while (enumerator.MoveNext()) { StreamResult <Employee> employee = enumerator.Current; } #endregion } using (var session = store.OpenSession()) { #region loading_entities_5_2 var transformer = new SimpleTransformer(); transformer.Execute(store); using (IEnumerator <StreamResult <SimpleTransformer.Result> > enumerator = session.Advanced.Stream <SimpleTransformer.Result>("people/", transformer: transformer.TransformerName, transformerParameters: new Dictionary <string, RavenJToken> { { "Name", "Bill" } })) { while (enumerator.MoveNext()) { StreamResult <SimpleTransformer.Result> result = enumerator.Current; string name = result.Document.Name; Assert.Equal("Bill", name); // Should be true } } #endregion } using (var session = store.OpenSession()) { #region loading_entities_6_1 bool isLoaded = session.Advanced.IsLoaded("employees/1"); // false Employee employee = session.Load <Employee>("employees/1"); isLoaded = session.Advanced.IsLoaded("employees/1"); // true #endregion } } }
public Supplier GetSupplierGivenSupplierCode(string supplierCode) { Supplier s = EFBroker_Supplier.GetSupplierGivenSupplierCode(supplierCode); return(s); }
public bool Update(Supplier supplier) { return(_supplierRepository.Update(supplier)); }
/// <summary> /// Compare 2 Entities for changes. NavProperties are NOT taken into account. For NavProperties use the corresponding utils for those Entities /// </summary> /// <param name="one">Entity One.</param> /// <param name="two">Entity Two.</param> /// <returns>True if there is changes. False if no changes found.</returns> public static bool HasChanges(Supplier one, Supplier two) { // this method returns true if differences are found between the 2 entities. #region Detect Changes if (one.SupplierID != two.SupplierID) { return(true); } if (string.CompareOrdinal(one.SupplierName, two.SupplierName) != 0) { return(true); } if (one.SupplierCategoryID != two.SupplierCategoryID) { return(true); } if (one.PrimaryContactPersonID != two.PrimaryContactPersonID) { return(true); } if (one.AlternateContactPersonID != two.AlternateContactPersonID) { return(true); } if (one.DeliveryMethodID != two.DeliveryMethodID) { return(true); } if (one.DeliveryCityID != two.DeliveryCityID) { return(true); } if (one.PostalCityID != two.PostalCityID) { return(true); } if (string.CompareOrdinal(one.SupplierReference, two.SupplierReference) != 0) { return(true); } if (string.CompareOrdinal(one.BankAccountName, two.BankAccountName) != 0) { return(true); } if (string.CompareOrdinal(one.BankAccountBranch, two.BankAccountBranch) != 0) { return(true); } if (string.CompareOrdinal(one.BankAccountCode, two.BankAccountCode) != 0) { return(true); } if (string.CompareOrdinal(one.BankAccountNumber, two.BankAccountNumber) != 0) { return(true); } if (string.CompareOrdinal(one.BankInternationalCode, two.BankInternationalCode) != 0) { return(true); } if (one.PaymentDays != two.PaymentDays) { return(true); } if (string.CompareOrdinal(one.InternalComments, two.InternalComments) != 0) { return(true); } if (string.CompareOrdinal(one.PhoneNumber, two.PhoneNumber) != 0) { return(true); } if (string.CompareOrdinal(one.FaxNumber, two.FaxNumber) != 0) { return(true); } if (string.CompareOrdinal(one.WebsiteURL, two.WebsiteURL) != 0) { return(true); } if (string.CompareOrdinal(one.DeliveryAddressLine1, two.DeliveryAddressLine1) != 0) { return(true); } if (string.CompareOrdinal(one.DeliveryAddressLine2, two.DeliveryAddressLine2) != 0) { return(true); } if (string.CompareOrdinal(one.DeliveryPostalCode, two.DeliveryPostalCode) != 0) { return(true); } if (one.DeliveryLocation != two.DeliveryLocation) { return(true); } if (string.CompareOrdinal(one.PostalAddressLine1, two.PostalAddressLine1) != 0) { return(true); } if (string.CompareOrdinal(one.PostalAddressLine2, two.PostalAddressLine2) != 0) { return(true); } if (string.CompareOrdinal(one.PostalPostalCode, two.PostalPostalCode) != 0) { return(true); } if (one.LastEditedBy != two.LastEditedBy) { return(true); } if (one.ValidFrom != two.ValidFrom) { return(true); } if (one.ValidTo != two.ValidTo) { return(true); } #endregion return(false); }