Beispiel #1
0
        public Customer(object dto)
            : base(dto)
        {
            suppliers = new Suppliers();

            distributionChannel = new DistributionChannels();
        }
 public Suppliers Save(Suppliers entity)
 {
     if(entity.Id ==0)
     {
         var ret  = this.context.Suppliers.Add(entity);
         this.context.SaveChanges();
         return ret;
     }else
     {
         var data = GetById(entity.Id);
         data.SupplierCode = entity.SupplierCode;
         data.CompanyName = entity.CompanyName;
         data.ContactName = entity.ContactName;
         data.ContactTitle = entity.ContactTitle;
         data.Address = entity.Address;
         data.City = entity.City;
         data.Country = entity.Country;
         data.Region = entity.Region;
         data.PostalCode = entity.PostalCode;
         data.Phone = entity.Phone;
         data.Fax = entity.Fax;
         data.HomePage = entity.HomePage;
         data.UpdateBy = entity.UpdateBy;
         data.UpdateDate = DateTime.Now;
         this.context.SaveChanges();
         return data;
     }
 }
Beispiel #3
0
        void before_each()
        {
            seed = new Seed();

            customers = new Customers();

            suppliers = new Suppliers();
        }
Beispiel #4
0
        public Customer(dynamic dto)
        {
            suppliers = new Suppliers();

            distributionChannel = new DistributionChannels();

            Init(dto);
        }
        void specify_eager_loaded_collections_retain_creation_methods()
        {
            dynamic firstMarket = markets.All().Include("Suppliers", "SupplyChains").First();

            var supplier = firstMarket.Suppliers().New(new { Name = "Market 3" });

            var supplierId = new Suppliers().Insert(supplier);

            var supplyChain = firstMarket.SupplyChains().New(new { SupplierId = supplierId });

            new SupplyChains().Insert(supplyChain);

            firstMarket = markets.All().Include("Suppliers").First();

            ((int)firstMarket.Suppliers().Count()).should_be(2);
        }
Beispiel #6
0
        public static void actualizar(Suppliers supplier, int id)
        {
            var supplierQRY = (from sup in dataSource.Suppliers
                               where sup.SupplierID == id
                               select sup).Single();

            supplierQRY.CompanyName  = supplier.CompanyName;
            supplierQRY.ContactName  = supplier.ContactName;
            supplierQRY.ContactTitle = supplier.ContactTitle;
            supplierQRY.Address      = supplier.Address;
            supplierQRY.City         = supplier.City;
            supplierQRY.Region       = supplier.Region;
            supplierQRY.PostalCode   = supplier.PostalCode;
            supplierQRY.Country      = supplier.Country;
            supplierQRY.Phone        = supplier.Phone;
            supplierQRY.Fax          = supplier.Fax;
            supplierQRY.HomePage     = supplier.HomePage;
            dataSource.SubmitChanges();
        }
Beispiel #7
0
        private async Task <Suppliers> GetOneById(int?id, Suppliers aux)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage res = await client.GetAsync("api/Suppliers/" + id);

                if (res.IsSuccessStatusCode)
                {
                    var auxRes = res.Content.ReadAsStringAsync().Result;

                    aux = JsonConvert.DeserializeObject <Suppliers>(auxRes);
                }
            }

            return(aux);
        }
Beispiel #8
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (Supp.IsNew)
     {
         DialogResult = DialogResult.Cancel;
     }
     if (!MsgBox.Show(this, true, "Delete?"))
     {
         return;
     }
     try{
         Suppliers.DeleteObject(Supp);
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
Beispiel #9
0
        public void AddSupplier(Supplier supplier)
        {
            if (supplier == null)
            {
                throw new ArgumentNullException(nameof(supplier));
            }

            if (Suppliers == null)
            {
                Suppliers = new List <Supplier>();
            }

            if (SupplierExists(supplier.Name))
            {
                throw new SupplierExistsException();
            }

            Suppliers.Add(supplier);
        }
        public async Task <IActionResult> Edit(int id, [Bind("SupplierId,Address,City,CompanyName,ContactName,Country,Fax,HomePage,Phone")] Suppliers suppliers)
        {
            var supp = _context.Suppliers.SingleOrDefault(m => m.SupplierId == id);

            supp.CompanyName = suppliers.CompanyName;
            supp.Address     = suppliers.Address;
            supp.City        = suppliers.City;
            supp.ContactName = suppliers.ContactName;
            supp.Country     = suppliers.Country;
            supp.Fax         = suppliers.Fax;
            supp.HomePage    = suppliers.HomePage;
            supp.Phone       = suppliers.Phone;

            _context.Update(supp);
            await _context.SaveChangesAsync();


            return(RedirectToAction("Index"));
        }
Beispiel #11
0
        private void gridOrderItem_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            FormSupplyOrderItemEdit FormSOIE = new FormSupplyOrderItemEdit();

            FormSOIE.ItemCur      = SupplyOrderItems.CreateObject(PIn.Long(_tableOrderItems.Rows[e.Row]["SupplyOrderItemNum"].ToString()));
            FormSOIE.ListSupplier = Suppliers.GetAll();
            FormSOIE.ShowDialog();
            if (FormSOIE.DialogResult != DialogResult.OK)
            {
                return;
            }
            SupplyOrderItems.Update(FormSOIE.ItemCur);
            _listOrdersAll = SupplyOrders.GetAll();            //force refresh because total might have changed.
            int gridSelect = gridOrders.SelectedIndices[0];

            FillGridOrders();
            gridOrders.SetSelected(gridSelect, true);
            FillGridOrderItem();
        }
Beispiel #12
0
 private void btn_Modificar_Click(object sender, EventArgs e)
 {
     supplier              = new Suppliers();
     supplier.SupplierID   = Int32.Parse(txtId.Text);
     supplier.CompanyName  = txtCName.Text;
     supplier.ContactName  = txtContactName.Text;
     supplier.ContactTitle = txtContactTitle.Text;
     supplier.Address      = txtAddress.Text;
     supplier.City         = txtCName.Text;
     supplier.Region       = txtRegion.Text;
     supplier.PostalCode   = txtPostalCode.Text;
     supplier.Country      = txtCountry.Text;
     supplier.Phone        = txtPhone.Text;
     supplier.Fax          = txtFax.Text;
     supplier.HomePage     = txtHomePage.Text;
     GestorSupplier.actualizar(supplier, supplier.SupplierID);
     supplier = null;
     mostrarDatos();
 }
Beispiel #13
0
        public bool SuppliersUpdate([FromBody] SuppliersViewModel model)
        {
            Suppliers db = _context.Suppliers.Where(m => m.SuppliersId == model.SuppliersId).FirstOrDefault();


            if (db.SuppliersId == model.SuppliersId)
            {
                Mapper.Map(model, db);
                _context.Suppliers.Attach(db);
                _context.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }

            //
        }
Beispiel #14
0
        /// <summary>
        /// This method search for the first occurence of an ID into the file.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>If found returns an object Supplier, return a Supplier set to null if the ID is not found /returns>
        public static Suppliers SearchRecord(int id)
        {
            Suppliers aSupplier = new Suppliers();

            if (File.Exists(filePath))  // Check if the file exists beforre reading it.
            {
                using (StreamReader sr = new StreamReader(filePath))
                {
                    // read the first line in the file;
                    string line = sr.ReadLine();
                    while (line != null)
                    {
                        //split the line to get the Id
                        string[] fields = line.Split(',');

                        if (id == Convert.ToInt32(fields[0]))
                        {
                            // Supplier found
                            aSupplier.Id         = Convert.ToInt32(fields[0]);
                            aSupplier.Name       = fields[1];
                            aSupplier.PhoneNum   = fields[2];
                            aSupplier.FaxNum     = fields[3];
                            aSupplier.Street     = fields[4];
                            aSupplier.PostalCode = fields[5];
                            aSupplier.City       = fields[6];
                            aSupplier.ProductId  = Convert.ToInt32(fields[7]);
                            return(aSupplier);
                        }
                        // read the next line
                        line = sr.ReadLine();
                    }
                }
            }
            else
            {
                MessageBox.Show("File not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Supplier not found
            aSupplier = null;
            return(aSupplier);
        }
Beispiel #15
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            using (var db = new NorthwindDataContext())
            {
                string companyName = txtCompanyName.Text;

                if (!ExisteCompanyName(companyName))
                {
                    // Create a new Order object.
                    Suppliers suppliers = new Suppliers
                    {
                        CompanyName  = companyName,
                        ContactName  = txtContactName.Text,
                        ContactTitle = txtContactTitle.Text,
                        Address      = txtAddress.Text,
                        City         = txtCity.Text
                    };

                    // Add the new object to the Orders collection.
                    db.Suppliers.InsertOnSubmit(suppliers);

                    // Submit the change to the database.
                    try
                    {
                        db.SubmitChanges();
                        MessageBox.Show("Se registro con exito");
                        Limpiar();
                    }
                    catch (Exception E)
                    {
                        MessageBox.Show("error: " + E.Message);
                        Limpiar();
                    }
                }
                else
                {
                    MessageBox.Show("Ya existe ese company Name");
                    txtCompanyName.Clear();
                    txtCompanyName.Focus();
                }
            }
        }
Beispiel #16
0
        public async Task <IActionResult> PostSuppliers([FromForm] Suppliers suppliers)
        {
            if (suppliers.Supplier == null)
            {
                return(BadRequest("No supplier name supplied"));
            }

            var supplierName      = suppliers.Supplier.Trim().ToLower();
            var duplicateSupplier = _context.Suppliers.Any(s => s.Supplier.Trim().ToLower() == supplierName);

            if (duplicateSupplier)
            {
                return(Conflict("This supplier is already saved. Please select it using the select list on the form."));
            }

            _context.Suppliers.Add(suppliers);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSuppliers", new { id = suppliers.Id }, suppliers));
        }
Beispiel #17
0
        public bool Create(Suppliers proveedor)
        {
            bool result = false;

            try {
                string sql =
                    string.Format("INSERT INTO Suppliers (CompanyName,ContactName,ContactTitle,Address,City,PostalCode,Country,Phone) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')",
                                  proveedor.CompanyName, proveedor.ContactName, proveedor.ContactTitle, proveedor.Address, proveedor.City, proveedor.PostalCode, proveedor.Country, proveedor.Phone);
                FbConnection conexion    = conexionFirebird.ObtenerConexion();
                FbCommand    cmd         = new FbCommand(sql, conexion);
                int          resultquery = cmd.ExecuteNonQuery();
                if (resultquery == 1)
                {
                    result = true;
                }
            } catch {
                throw;
            }
            return(result);
        }
Beispiel #18
0
        }             //EmployeerTextBox_TextChanged

        private void SupplierTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (int.TryParse(SupplierTextBox.Text.Trim(), out int supID))
            {
                using (SmallBusinessDBEntities context = new SmallBusinessDBEntities()) {
                    try {
                        Suppliers supl = context.Suppliers.FirstOrDefault(s => s.supplierID == supID);
                        if (supl == null)
                        {
                            return;
                        }

                        SupplierCommentTextBox.Text = supl.companyName + " " + supl.contactName;
                    }//try
                    catch (Exception ex) {
                        MessageBox.Show(ex.Message);
                    } //catch
                }     //using
            }         //if
        }
 public void EditSupplier(int id, Suppliers supp)
 {
     try
     {
         ApplicationDbContext ctx = new ApplicationDbContext();
         var oldsupp = ctx.Suppliers.Single(x => x.Id == id);
         oldsupp.Name    = supp.Name;
         oldsupp.Country = supp.Country;
         oldsupp.City    = supp.City;
         oldsupp.Address = supp.Address;
         oldsupp.AccNo   = supp.AccNo;
         oldsupp.ZipCode = supp.ZipCode;
         oldsupp.TaxNo   = oldsupp.TaxNo;
         ctx.SaveChanges();
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
Beispiel #20
0
        public async void ComboBox_Changed(object sender, EventArgs e)
        {
            // Try to make API call for selected Suppliers Object and display in Textbox. Else return
            try
            {
                statusTextBlock.Text = "";
                Suppliers selectedSupplier = (Suppliers)suppliersComboBox.SelectedItem;
                int       supplierID       = supplierList.Find(p => p.SupplierId == selectedSupplier.SupplierId).SupplierId;
                var       supplier         = await GetSupplier("https://localhost:44327/api/SuppliersAPI/" + supplierID.ToString());

                var products = await GetProductsFromSupplier(selectedSupplier);

                myListView.ItemsSource = products;
                nameTextbox.Text       = supplier.SupName;
            }
            catch (Exception)
            {
                return;
            }
        }
Beispiel #21
0
 public bool Process(string fileName, Users user, Suppliers supplier)
 {
     _FileName                  = fileName;
     _SupplierId                = supplier.Id;
     _AdminClientId             = user.Client.Id;
     _SuppoortedSheetCollection = TemplateLoader.GetSupplierDataSheetCollection(user.Client.Name, supplier.SupplierName);
     LoadFileIntoDataTable();
     FuelManagementPrices.SupplierFuelsPricesDataTable convertedTable = ConvertUploadedDataTable();
     if (convertedTable == null)
     {
         return(false);
     }
     PrepareConvertedTableForDatabaseUpdate(convertedTable);
     UploadDatabaseRecords(convertedTable);
     if (convertedTable.Rows.Count == 0)
     {
         return(false);
     }
     return(true);
 }
Beispiel #22
0
        public void UpdateSuppliers(Suppliers eSuppliers)
        {
            query  = "UPDATE Suppliers SET SupplierFullName = @SupplierFullName,CompanyName = @CompanyName,RegionId = @RegionId,";
            query += "DistrictId = @DistrictId,Website = @Website,JobPosition = @JobPosition,Phone = @Phone,Email = @Email";
            query += " WHERE SupplierId= @SupplierId";

            data.SetSqlStatement(query, CommandType.Text);

            data.Parameter("@SupplierId", SqlDbType.Int, eSuppliers.SupplierId);
            data.Parameter("@SupplierFullName", SqlDbType.NVarChar, 100, eSuppliers.SupplierFullName);
            data.Parameter("@CompanyName", SqlDbType.NVarChar, 100, eSuppliers.CompanyName);
            data.Parameter("@RegionId", SqlDbType.Int, eSuppliers.RegionId);
            data.Parameter("@DistrictId", SqlDbType.Int, eSuppliers.DistrictId);
            data.Parameter("@Website", SqlDbType.NVarChar, 100, eSuppliers.Website);
            data.Parameter("@JobPosition", SqlDbType.NVarChar, 30, eSuppliers.JobPosition);
            data.Parameter("@Phone", SqlDbType.NVarChar, 20, eSuppliers.Phone);
            data.Parameter("@Email", SqlDbType.NVarChar, 30, eSuppliers.Email);

            data.ExecuteScalar();
        }
Beispiel #23
0
        public void GetPartSuppliers()
        {
            Suppliers.Clear();

            ListsSoapClient proxy = GetListServiceProxy();

            proxy.GetListItemsCompleted += proxy_GetSuppliersListItemsCompleted;
            var query        = XElement.Parse(@"<Query>
                                            <Where>
                                                <Eq>
                                                    <FieldRef Name='PartLookup' />
                                                    <Value Type='Lookup'>" + CurrentPart.Title + @"</Value>
                                                </Eq>
                                            </Where>
                                          </Query>");
            var queryOptions = XElement.Parse(@"<QueryOptions></QueryOptions>");
            var viewFields   = XElement.Parse(@"<ViewFields></ViewFields>");

            proxy.GetListItemsAsync("Part Suppliers", null, query, viewFields, null, queryOptions, null);
        }
Beispiel #24
0
        private void button14_Click(object sender, EventArgs e) // Suppliers Update Button
        {
            Suppliers cus = new Suppliers();

            cus.companyname  = textBox14.Text;
            cus.contactname  = textBox15.Text;
            cus.contacttitle = textBox16.Text;
            var jsonString = JsonConvert.SerializeObject(cus);
            var client     = new HttpClient();

            client.BaseAddress = new Uri("https://localhost:44391/");
            var    content = new StringContent(jsonString, Encoding.UTF8, "application/json");
            string ID      = listView5.SelectedItems[0].Text;

            listView5.Items.Clear();
            var result = client.PutAsync("api/suppliers/" + ID, content).Result;

            label39.Text = "" + result;
            MessageBox.Show("Kayıt Güncellendi.");
        }
Beispiel #25
0
        //Join Operators
        //This sample shows how to perform a simple inner equijoin of two sequences to
        //produce a flat result set that consists of each element in suppliers that has a matching element
        //in customers.
        public void Linq102()
        {
            List <Customers.Customer> customers = Customers.GetCustomerList();
            List <Suppliers.Supplier> suppliers = Suppliers.GetSupplierList();

            #region Make Sure to try yourself before looking at the code

            var custSupJoin =
                from sup in suppliers
                join cust in customers on sup.Country equals cust.Country
                select new { Country = sup.Country, SupplierName = sup.SupplierName, CustomerName = cust.CompanyName };

            #endregion

            Console.WriteLine("Orginal 101 Linq examples.");
            foreach (var item in custSupJoin.Take(10))
            {
                Console.WriteLine("Country = {0}, Supplier = {1}, Customer = {2}", item.Country, item.SupplierName, item.CustomerName);
            }
        }
Beispiel #26
0
        public virtual void CheckBeforeDelete(ISession session)
        {
            var maxPayment = session.QueryOver <Payment>()
                             .Where(p => p.Payer == this)
                             .SelectList(l => l.SelectMax(p => p.PayedOn))
                             .SingleOrDefault <DateTime>();

            if (maxPayment.AddMonths(36) > DateTime.Now)
            {
                throw new EndUserException("За последние 36 месяцев имеются платежи");
            }

            if (Reports.Count > 0)
            {
                throw new EndUserException("Есть отчеты");
            }

            Clients.Each(c => c.CheckBeforeDelete(session));
            Suppliers.Each(s => s.CheckBeforeDelete(session));
        }
Beispiel #27
0
        private void btn_up_Click(object sender, EventArgs e)
        {
            Suppliers s = new Suppliers()
            {
                supId       = index,
                supName     = txt_name2.Text,
                supMobile   = txt_mob2.Text,
                supAddress1 = txt_add12.Text,
                supAddress2 = txt_add22.Text,
                supAddress3 = txt_add32.Text
            };

            s.updateSup(s);

            ManageSupplier refresh = new ManageSupplier();

            Hide();
            refresh.Show();
            MessageBox.Show("Successfully Updated", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Beispiel #28
0
        public SuppliersViewModel()
        {
            Supplier     = new Suppliers();
            Rcpt         = "";
            Date         = DateTime.Now.ToString("d MMMM, yyyy");
            Start        = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            BankAccounts = new List <SelectListItem>();
            CreditsTypes = new List <SelectListItem> {
                new SelectListItem {
                    Value = "0", Text = "Credit Note"
                },
                new SelectListItem {
                    Value = "1", Text = "Debit Note"
                },
            };
            Stations = new List <SelectListItem>();
            Category = new List <SelectListItem>();

            Payments  = new List <SuppliersPayment>();
            Invoices  = new List <StationsExpenses>();
            Credits   = new List <SuppliersCredits>();
            Withhold  = new List <SuppliersWithholding>();
            Statement = new List <SuppliersStatement>();

            for (int i = 0; i < 10; i++)
            {
                Credits.Add(new SuppliersCredits());
                Payments.Add(new SuppliersPayment());
                Invoices.Add(new StationsExpenses());
                Withhold.Add(new SuppliersWithholding());
            }

            Types = new List <SelectListItem> {
                new SelectListItem {
                    Value = "1", Text = "WHT VAT"
                },
                new SelectListItem {
                    Value = "2", Text = "WHT TAX"
                }
            };
        }
        // INSERT DATA
        public static bool Insert(Suppliers supplier)
        {
            bool          result = false;
            SqlConnection con    = Connection.GetConnection();

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandText = "INSERT INTO Suppliers (SupplierId, SupName) values (@id, @name)";
                SqlParameter idPar = new SqlParameter("@id", SqlDbType.Int);
                idPar.Value = supplier.SupplierId;
                cmd.Parameters.Add(idPar);
                SqlParameter namePar = new SqlParameter("@name", SqlDbType.NVarChar);
                namePar.Value = supplier.SupName;
                cmd.Parameters.Add(namePar);
                cmd.ExecuteNonQuery();
                result = true;
            }
            catch (SqlException e)
            {
                switch (e.Number)
                {
                case 2627:
                    throw new DuplicateKeyException(string.Format("Supplier ID already exist, please enter a different ID and try again {0}", supplier.SupplierId));

                default:
                    throw;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
            return(result);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult;

            dialogResult = MessageBox.Show("Təchizatçı əlavə edilsin ?", "Əlavə et", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
            if (dialogResult == DialogResult.Yes)
            {
                if (txtFirstname.Text != "" || txtLastname.Text != "" || txtCompanyName.Text != "")
                {
                    Suppliers suppliers = new Suppliers();
                    suppliers.Firstname   = txtFirstname.Text;
                    suppliers.Lastname    = txtLastname.Text;
                    suppliers.CompanyName = txtCompanyName.Text;
                    suppliers.PhoneNo     = mskdPhoneNo.Text;
                    suppliers.Mail        = txtMail.Text;
                    suppliers.Adress      = txtAdress.Text;

                    bool result = suppliersORM.Insert(suppliers);
                    if (result)
                    {
                        MessageBox.Show("Təchizatçı müvəffəqiyyətlə əlavə edildi !");
                        foreach (Control item in Controls)
                        {
                            if (item is TextBox)
                            {
                                item.Text = "";
                            }
                            mskdPhoneNo.Text = "";
                        }
                    }
                    else
                    {
                        MessageBox.Show("Xəta !!!");
                    }
                }
                else
                {
                    MessageBox.Show("Xahiş edirik ulduzlanan xanaları doldurun!");
                }
            }
        }
Beispiel #31
0
        public int SaveSupplier(Supplier supplier)
        {
            try
            {
                string    setname = "Suppliers";
                Suppliers dbSupplier;

                bool isNew = false;
                if (supplier.SupplierId == default(int) || supplier.SupplierId <= 0)
                {
                    isNew      = true;
                    dbSupplier = new Suppliers();
                }
                else
                {
                    dbSupplier = new Suppliers {
                        SupplierId = supplier.SupplierId,                          /*Version = supplier.Version.ToTimestamp() */
                    };
                    dbSupplier.EntityKey = db.CreateEntityKey(setname, dbSupplier);
                    db.AttachTo(setname, dbSupplier);
                    //db.Attach(dbSupplier);
                }
                dbSupplier.Name = supplier.Name;

                if (isNew)
                {
                    db.Suppliers.AddObject(dbSupplier);
                }
                db.SaveChanges();
                supplier.SupplierId = dbSupplier.SupplierId;
                return(dbSupplier.SupplierId);
            }
            catch (OptimisticConcurrencyException ex)
            {
                if (ExceptionPolicy.HandleException(ex, "DA Policy"))
                {
                    throw;
                }
                return(default(int));
            }
        }
Beispiel #32
0
        public async Task <IActionResult> PostSuppliers([FromBody] Suppliers suppliers)
        {
            if (!ModelState.IsValid)
            {
                return(Ok(new Response
                {
                    IsError = true,
                    Status = 400,
                    Message = "Sai dữ liệu đầu vào"
                }));
            }

            _context.Suppliers.Add(suppliers);
            await _context.SaveChangesAsync();

            return(Ok(new Response
            {
                Status = 201,
                Module = new { id = suppliers.SupplierId, name = suppliers.CompanyName }
            }));
        }
        public ActionResult SupplierListNew(string sessionId)
        {
            if (sessionId != null && userServices.getUserCountBySessionId(sessionId) == true)
            {
                Suppliers s = new Suppliers();

                using (var db = new InventoryDbContext())
                {
                    List <Suppliers> supplier = db.supplier.ToList();
                    ViewData["sessionId"] = sessionId;
                    ViewData["Suppliers"] = supplier;
                    ViewData["staffname"] = userServices.getUserBySessionId(sessionId).employee.empName;
                    ViewData["s"]         = s;
                    return(View());
                }
            }
            else
            {
                return(RedirectToAction("Login", "Login"));
            }
        }
Beispiel #34
0
        public void Linq102A()
        {
            List <Customers.Customer> customers = Customers.GetCustomerList();
            List <Suppliers.Supplier> suppliers = Suppliers.GetSupplierList();

            #region Make Sure to try yourself before looking at the code

            var custSupJoin = suppliers
                              .Join(customers, sup => sup.Country, cust => cust.Country,
                                    (sup, cust) => new { sup.Country, sup.SupplierName, CustomerName = cust.CompanyName });

            #endregion

            Console.WriteLine();
            Console.WriteLine(string.Concat(Enumerable.Repeat('*', 100)));
            Console.WriteLine("Linq with Lambda");
            foreach (var item in custSupJoin.Take(10))
            {
                Console.WriteLine("Country = {0}, Supplier = {1}, Customer = {2}", item.Country, item.SupplierName, item.CustomerName);
            }
        }
Beispiel #35
0
        public frmDebitPayment(int SupplierID)
        {
            InitializeComponent();
            txtPDT.DateTime = DateTime.Now.Date;
            sc = new Server2Client();
            s  = new Suppliers();
            sa = new SupplierAccounts();
            sc = s.getSuppliers();

            lueSNM.Properties.DataSource    = sc.dataTable;
            lueSNM.Properties.DisplayMember = "SupplierName";
            lueSNM.Properties.ValueMember   = "ID";

            lueSNM.EditValue = SupplierID;
            sc = sa.getSupplierBalance(SupplierID);

            txtCBAL.Text = sc.Value.ToString();

            txtAMNT.Text = "0";
            txtNBAL.Text = "0";
        }
Beispiel #36
0
 public static Suppliers CreateSuppliers(int supplierID, string companyName, AddressDetails addressDetails)
 {
     Suppliers suppliers = new Suppliers();
     suppliers.SupplierID = supplierID;
     suppliers.CompanyName = companyName;
     if ((addressDetails == null))
     {
         throw new global::System.ArgumentNullException("addressDetails");
     }
     suppliers.AddressDetails = addressDetails;
     return suppliers;
 }
 /// <summary>
 /// Create a new Suppliers object.
 /// </summary>
 /// <param name="companyName">Initial value of CompanyName.</param>
 /// <param name="supplierID">Initial value of SupplierID.</param>
 public static Suppliers CreateSuppliers(string companyName, int supplierID)
 {
     Suppliers suppliers = new Suppliers();
     suppliers.CompanyName = companyName;
     suppliers.SupplierID = supplierID;
     return suppliers;
 }
Beispiel #38
0
 partial void InsertSuppliers(Suppliers instance);
 /// <summary>
 /// Create a new Suppliers object.
 /// </summary>
 /// <param name="supplierID">Initial value of SupplierID.</param>
 /// <param name="companyName">Initial value of CompanyName.</param>
 public static Suppliers CreateSuppliers(long supplierID, string companyName)
 {
     Suppliers suppliers = new Suppliers();
     suppliers.SupplierID = supplierID;
     suppliers.CompanyName = companyName;
     return suppliers;
 }
Beispiel #40
0
 partial void UpdateSuppliers(Suppliers instance);
Beispiel #41
0
 partial void DeleteSuppliers(Suppliers instance);
 /// <summary>
 /// There are no comments for Suppliers in the schema.
 /// </summary>
 public void AddToSuppliers(Suppliers suppliers)
 {
     base.AddObject("Suppliers", suppliers);
 }
Beispiel #43
0
 public static Suppliers CreateSuppliers(int supplierID)
 {
     Suppliers suppliers = new Suppliers();
     suppliers.SupplierID = supplierID;
     return suppliers;
 }