Exemplo n.º 1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Update(SupplierEntity entity)
        {
            string key = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID);

            entity.Include(a => new { a.SupNum, a.SupName, a.SupType, a.Email, a.Phone, a.Fax, a.ContactName, a.Address, a.Description });
            entity.Where(a => a.SnNum == entity.SnNum)
            .And(a => a.CompanyID == entity.CompanyID);
            int line = this.Supplier.Update(entity);

            if (line > 0)
            {
                CacheHelper.Remove(key);
            }
            return(line);
        }
Exemplo n.º 2
0
        public async Task SaveForm(SupplierEntity entity)
        {
            if (entity.Id.IsNullOrZero())
            {
                await entity.Create();

                await this.BaseRepository().Insert(entity);
            }
            else
            {
                await entity.Modify();

                await this.BaseRepository().Update(entity);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public int Delete(string supNum)
        {
            SupplierEntity entity = new SupplierEntity();

            entity.IsDelete = (int)EIsDelete.Deleted;
            entity.IncludeIsDelete(true);
            entity.Where(a => a.SupNum == supNum);
            int line = this.Supplier.Update(entity);

            if (line > 0)
            {
                CacheHelper.Remove(CacheKey.JOOSHOW_SUPPLIER_CACHE);
            }
            return(line);
        }
 public BankAccountEntity[] GetBySupplier(SupplierEntity supplier)
 {
     try
     {
         var banks = context.BankAccounts.Where(x => x.CustomerId == supplier.CustomerId && x.SupplierId == supplier.Id).Select(x => new BankAccountEntity
         {
             BankAccountInFinance = x.BankAccountInFinance, CustomerId = x.CustomerId, SupplierId = x.SupplierId
         });
         return(banks != null?banks.ToArray() : null);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 编辑
        /// </summary>
        private void ShowEditSupplier()
        {
            SupplierEntity editEntity = SelectedSupplierRow;

            if (editEntity == null)
            {
                MsgBox.Warn("没有要修改的数据。");
                return;
            }

            FrmSupplierEdit frmSupplierEdit = new FrmSupplierEdit(editEntity);

            frmSupplierEdit.DataSourceChanged += OnEditChanage;
            frmSupplierEdit.ShowDialog();
        }
Exemplo n.º 6
0
        public bool InsertSupplier(SupplierEntity entity)
        {
            try
            {
                //bool inserted = _repository.Insert(entity);

                return(_repository.Insert(entity));
            }catch (Exception ex)
            {
                //Log Exception Error
                ExceptionHandler.LogException(ex, "Supplier_Bussiness_Logic_Layer_Insert");

                throw new Exception("Business Logic :: Supplier Business :: Insert Function :: Error in Execution", ex);
            }
        }
Exemplo n.º 7
0
 public bool Put([FromBody] SupplierEntity SupplierEntity)
 {
     try
     {
         if (SupplierEntity.SID > 0)
         {
             return(_Supplierservice.UpdateSupplier(SupplierEntity.SID, SupplierEntity));
         }
     }
     catch (Exception ex)
     {
         throw new ApiDataException(1000, "Product not found", HttpStatusCode.NotFound);
     }
     return(false);
 }
Exemplo n.º 8
0
        public void TestEntityConstructorValidData()
        {
            APartyEntity  payee  = new SupplierEntity(SupplierType.Cruise, "", "Galasam");
            APartyEntity  payer  = new CustomerEntity(CustomerType.Bureau, "", "Lonely Tree");
            PaymentEntity entity = new PaymentEntity(validDueDate, validDueAmount, payer,
                                                     payee, validType, validSale, validBooking);
            Payment payment = new Payment(entity, dataAccessFacadeStub);

            Assert.AreEqual(validDueDate, payment.DueDate);
            Assert.AreEqual(validDueAmount, payment.DueAmount);
            Assert.AreEqual(payee.Name, payment.Payee.Name);
            Assert.AreEqual(payer.Name, payment.Payer.Name);
            Assert.AreEqual(validType, payment.Type);
            Assert.AreEqual(validSale, payment.Sale);
            Assert.AreEqual(validBooking, payment.Booking);
        }
Exemplo n.º 9
0
        public void MakeInvoice_InvoiceController_SuplierVATPayer_ClientInEU_IsNotVATPayer_DifferentCountries()
        {
            // Arrange
            ClientEntity   clientEntity   = new ClientEntity(1, "PirmasKlientas", 3, true, false, 17);
            SupplierEntity supplierEntity = new SupplierEntity(1, "PirmasSupplier", 1, true, true, 21);

            _clientRepository.Add(clientEntity);
            _supplierRepository.Add(supplierEntity);
            InvoiceController invoiceController = new InvoiceController(_clientRepository, _supplierRepository);

            // Act
            double sumResult = invoiceController.MakeInvoice(1, 1, 100);

            // Assert

            Assert.AreEqual(117, sumResult);
        }
Exemplo n.º 10
0
        public void MakeInvoice_InvoiceController_SuplierAndClientSameCountry()
        {
            // Arrange
            ClientEntity   clientEntity   = new ClientEntity(1, "PirmasKlientas", 1, true, false, 21);
            SupplierEntity supplierEntity = new SupplierEntity(1, "PirmasSupplier", 1, true, true, 21);

            _clientRepository.Add(clientEntity);
            _supplierRepository.Add(supplierEntity);
            InvoiceController invoiceController = new InvoiceController(_clientRepository, _supplierRepository);

            // Act
            double sumResult = invoiceController.MakeInvoice(1, 1, 100);

            // Assert

            Assert.AreEqual(121, sumResult);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public int Delete(IEnumerable <string> list)
        {
            string         key    = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID);
            SupplierEntity entity = new SupplierEntity();

            entity.IsDelete = (int)EIsDelete.Deleted;
            entity.IncludeIsDelete(true);
            entity.Where("SnNum", ECondition.In, list.ToArray());
            entity.And(a => a.CompanyID == this.CompanyID);
            int line = this.Supplier.Update(entity);

            if (line > 0)
            {
                CacheHelper.Remove(key);
            }
            return(line);
        }
Exemplo n.º 12
0
        public SupplierEntity GetSupplierDetail(int storeId, int LoggedInUserId, int?SupplierID)
        {
            SupplierEntity Supplier = new SupplierEntity();

            if (SupplierID > 0)
            {
                Supplier = (from t in GetSupplierList(storeId, LoggedInUserId, SupplierID)
                            where t.supplier_id == SupplierID
                            select t).FirstOrDefault();
            }
            else
            {
                Supplier = new SupplierEntity();
            }

            return(Supplier);
        }
Exemplo n.º 13
0
        protected override BookingEntity entityFromReader(SqlDataReader reader)
        {
            //Sets data from the database to corresponding data type for usage in the program.
            int         supplierId        = (int)reader["Supplier"];
            int         customerId        = (int)reader["Customer"];
            string      note              = (string)reader["Note"];
            string      sale              = (string)reader["Sale"];
            int         bookingNumber     = (int)reader["BookingNumber"];
            DateTime    startDate         = (DateTime)reader["StartDate"];
            DateTime    endDate           = (DateTime)reader["EndDate"];
            BookingType type              = (BookingType)Enum.Parse(typeof(BookingType), reader["Type"].ToString());
            decimal     iVAExempt         = (decimal)reader["IVAExempt"];
            decimal     iVASubject        = (decimal)reader["IVASubject"];
            decimal     service           = (decimal)reader["Service"];
            decimal     iVA               = (decimal)reader["IVA"];
            decimal     productRetention  = (decimal)reader["ProductRetention"];
            decimal     supplierRetention = (decimal)reader["supplierRetention"];
            decimal     transferAmount    = (decimal)reader["TransferAmount"];

            int      id           = (int)reader["BookingId"];
            DateTime lastModified = (DateTime)reader["LastModified"];
            bool     deleted      = (bool)reader["Deleted"];

            SupplierEntity supplier = SupplierMapper.Read(supplierId);
            CustomerEntity customer = CustomerMapper.Read(customerId);

            BookingEntity bookingEntity = new BookingEntity(supplier, customer, sale, bookingNumber,
                                                            startDate, endDate);

            //Uses the data to make it into an booking object.
            bookingEntity.Note              = note;
            bookingEntity.Id                = id;
            bookingEntity.LastModified      = lastModified;
            bookingEntity.Deleted           = deleted;
            bookingEntity.Type              = type;
            bookingEntity.IVAExempt         = iVAExempt;
            bookingEntity.IVA               = iVA;
            bookingEntity.IVASubject        = iVASubject;
            bookingEntity.Service           = service;
            bookingEntity.ProductRetention  = productRetention;
            bookingEntity.SupplierRetention = supplierRetention;
            bookingEntity.TransferAmount    = transferAmount;

            return(bookingEntity);
        }
Exemplo n.º 14
0
        //修改供货商信息

        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            DialogResult dialog = MessageBox.Show(this, "确定要修改此供货商信息吗?", "提示",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (this.dataGridView2.SelectedRows.Count == 0)
            {
                MessageBox.Show("没有选中供货商!");
                return;
            }

            SupplierEntity supplierEntity = new SupplierEntity();

            if (dialog == DialogResult.Yes)
            {
                int i = this.dataGridView1.CurrentRow.Index;


                supplierEntity.SupplierId   = dataGridView2.CurrentRow.Cells[0].Value.ToString();
                supplierEntity.Merchantname = dataGridView2.Rows[i].Cells[1].Value.ToString();
                supplierEntity.Contacts     = dataGridView2.Rows[i].Cells[2].Value.ToString();
                supplierEntity.Phone        = dataGridView2.Rows[i].Cells[3].Value.ToString();
                supplierEntity.Address      = dataGridView2.Rows[i].Cells[4].Value.ToString();
                supplierEntity.Settlement   = dataGridView2.Rows[i].Cells[5].Value.ToString();

                UpdateSupplier update = new UpdateSupplier(supplierEntity);
                DialogResult   dt     = update.ShowDialog();

                if (dt == DialogResult.OK)
                {
                    supplierEntity = update.SupplierUpdate();
                    dataGridView1.CurrentRow.Cells[0].Value = supplierEntity.SupplierId;
                    dataGridView1.Rows[i].Cells[1].Value    = supplierEntity.Merchantname;
                    dataGridView1.Rows[i].Cells[2].Value    = supplierEntity.Contacts;
                    dataGridView1.Rows[i].Cells[3].Value    = supplierEntity.Phone;
                    dataGridView1.Rows[i].Cells[4].Value    = supplierEntity.Address;
                    dataGridView1.Rows[i].Cells[5].Value    = supplierEntity.Settlement;
                }
            }
            if (supplierEntity == null)
            {
                MessageBox.Show("未选中供货商!");
                return;
            }
        }
Exemplo n.º 15
0
        public async Task <IActionResult> Edit(string id, [FromBody] SupplierEntity supplier)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            supplier.Id = id;

            var result = await _repository.Update(supplier);

            if (result == false)
            {
                return(BadRequest("edit failed"));
            }

            return(Ok(supplier));
        }
        public static async Task ThenSuppliersExist(Table table)
        {
            var expectedSuppliers = table.CreateSet <SupplierTable>().Select(s => new
            {
                s.Id,
                Summary     = string.IsNullOrWhiteSpace(s.Summary) ? null : s.Summary,
                SupplierUrl = string.IsNullOrWhiteSpace(s.SupplierUrl) ? null : s.SupplierUrl,
            });

            var suppliers = await SupplierEntity.FetchAllAsync();

            suppliers.Select(s => new
            {
                s.Id,
                s.Summary,
                s.SupplierUrl,
            }).Should().BeEquivalentTo(expectedSuppliers);
        }
Exemplo n.º 17
0
        public async Task <IActionResult> Create([FromBody] SupplierEntity supplier)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            supplier.Id = Guid.NewGuid().ToString("N");

            var result = await _repository.Add(supplier);

            if (result == false)
            {
                return(BadRequest("create failed"));
            }

            return(Ok(supplier));
        }
Exemplo n.º 18
0
        public static Supplier_CE ToCE(SupplierEntity item)
        {
            Supplier_CE target = new Supplier_CE();

            target.ID          = item.ID;
            target.SupNum      = item.SupNum;
            target.SupName     = item.SupName;
            target.Phone       = item.Phone;
            target.Fax         = item.Fax;
            target.Email       = item.Email;
            target.ContactName = item.ContactName;
            target.Address     = item.Address;
            target.CreateUser  = item.CreateUser;
            target.Description = item.Description;
            target.IsDelete    = item.IsDelete;
            target.CreateTime  = item.CreateTime;
            return(target);
        }
Exemplo n.º 19
0
 public bool Add(SupplierEntity supplier)
 {
     try
     {
         string supplierId = Convert.ToInt32(supplier.Id).ToString("D9");
         context.Suppliers.Add(new Suppliers {
             SupplierId   = supplierId, SupplierEnabled = true,
             SupplierName = supplier.Name, SupplierWithBanks = supplier.WithBanks, SupplierPkudatYomanNumber = supplier.PkudatYomanNumber, SupplierCustomerId = supplier.CustomerId
             , SupplierNumberInFinance = supplier.SupplierNumberInFinance
         });
         context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 20
0
        /// <summary>
        /// 添加供应商
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Add(SupplierEntity entity)
        {
            string key = string.Format(CacheKey.JOOSHOW_SUPPLIER_CACHE, this.CompanyID);

            entity.IsDelete   = (int)EIsDelete.NotDelete;
            entity.CreateTime = DateTime.Now;
            entity.SupNum     = entity.SupNum.IsEmpty() ? new TNumProvider(this.CompanyID).GetSwiftNum(typeof(SupplierEntity), 5) : entity.SupNum;
            entity.SnNum      = entity.SnNum.IsEmpty() ? ConvertHelper.NewGuid() : entity.SnNum;

            entity.IncludeAll();
            int line = this.Supplier.Add(entity);

            if (line > 0)
            {
                CacheHelper.Remove(key);
            }
            return(line);
        }
        public static Supplier ToDto(this SupplierEntity entity, Hashtable seenObjects, Hashtable parents)
        {
            OnBeforeEntityToDto(entity, seenObjects, parents);
            var dto = new Supplier();

            if (entity != null)
            {
                if (seenObjects == null)
                {
                    seenObjects = new Hashtable();
                }
                seenObjects[entity] = dto;

                parents = new Hashtable(parents)
                {
                    { entity, null }
                };

                // Map dto properties
                dto.SupplierId   = entity.SupplierId;
                dto.CompanyName  = entity.CompanyName;
                dto.ContactName  = entity.ContactName;
                dto.ContactTitle = entity.ContactTitle;
                dto.Address      = entity.Address;
                dto.City         = entity.City;
                dto.Region       = entity.Region;
                dto.PostalCode   = entity.PostalCode;
                dto.Country      = entity.Country;
                dto.Phone        = entity.Phone;
                dto.Fax          = entity.Fax;
                dto.HomePage     = entity.HomePage;


                // Map dto associations
                // 1:n Products association of Product entities
                if (entity.Products != null && entity.Products.Any())
                {
                    dto.Products = new ProductCollection(entity.Products.RelatedArray(seenObjects, parents));
                }
            }

            OnAfterEntityToDto(entity, seenObjects, parents, dto);
            return(dto);
        }
Exemplo n.º 22
0
        public void TestSupplierConstructorValidData()
        {
            string       name = "gert";
            string       note = "total fed note";
            SupplierType type = SupplierType.Cruise;

            DataAccessFacadeStub stub   = new DataAccessFacadeStub();
            SupplierEntity       entity = new SupplierEntity(type, note, name);

            Supplier supplier = new Supplier(stub, entity);

            string       expectedName = "gert";
            string       expectedNote = "total fed note";
            SupplierType expectedType = SupplierType.Cruise;

            Assert.AreEqual(expectedNote, supplier.Note);
            Assert.AreEqual(expectedName, supplier.Name);
            Assert.AreEqual(expectedType, supplier.Type);
        }
Exemplo n.º 23
0
        public ActionResult GetSupplierList()
        {
            int                   pageIndex = WebUtil.GetFormValue <int>("pageIndex", 1);
            int                   pageSize  = WebUtil.GetFormValue <int>("pageSize", 15);
            string                SupNum    = WebUtil.GetFormValue <string>("SupNum", string.Empty);
            SupplierProvider      provider  = new SupplierProvider();
            SupplierEntity        entity    = new SupplierEntity();
            List <SupplierEntity> list      = provider.GetList();

            if (!list.IsNullOrEmpty())
            {
                List <SupplierEntity> listResult = list.Where(a => a.SupNum.Contains(SupNum) || a.SupName.Contains(SupNum)).ToList();
                List <SupplierEntity> returnList = listResult.Skip((pageIndex - 1) * pageSize).Take(pageSize).OrderByDescending(a => a.ID).ToList();
                string json = ConvertJson.ListToJson <SupplierEntity>(returnList, "List");
                this.ReturnJson.AddProperty("Data", new JsonObject(json));
                this.ReturnJson.AddProperty("RowCount", listResult.Count);
            }
            return(Content(this.ReturnJson.ToString()));
        }
Exemplo n.º 24
0
        public async Task <bool> AddRelationshipByFile(FileEntity fileEntity)
        {
            var pck = new ExcelPackage();

            pck.Load(fileEntity.File.OpenReadStream());
            try
            {
                SupplierEntity supplier = new SupplierEntity
                {
                    Id         = fileEntity.SupplierId,
                    CustomerId = fileEntity.CustomerId
                };
                var result = await Task.Run(() =>
                {
                    var excel        = pck.Workbook.Worksheets.First();
                    var budgets      = new BudgetsService(context).GetBySupplier(supplier);
                    var contracts    = new ContractsService(context).GetBySupplier(supplier).Result;
                    var relationship = new BudgetContractService(context).GetRelationshipBySupplier(supplier);
                    for (int rowNum = 2; rowNum <= excel.Dimension.End.Row; rowNum++)
                    {
                        if (!string.IsNullOrEmpty(excel.Cells[rowNum, 1].Text))
                        {
                            handleRelationShipsExcel(excel, rowNum, contracts, budgets, relationship, supplier);
                        }
                        else
                        {
                            break;
                        }
                    }
                    return(true);
                });

                pck.Dispose();
                await context.SaveChangesAsync();

                return(result);
            }
            catch (Exception e)
            {
                pck.Dispose();
                throw e;
            }
        }
Exemplo n.º 25
0
        public void Add_SupplierRepository_SupplierAdded()
        {
            // Arrange
            SupplierEntity supplierEntity = new SupplierEntity();

            supplierEntity.Id                = 1;
            supplierEntity.Name              = "Pirma";
            supplierEntity.IdCountry         = 1;
            supplierEntity.IsInEuropeanUnion = true;
            supplierEntity.IsVATPayer        = true;
            supplierEntity.VATPercentage     = 21;
            SupplierEntity supplierEntity2 = new SupplierEntity();

            supplierEntity2.Id                = 2;
            supplierEntity2.Name              = "Antra";
            supplierEntity2.IdCountry         = 1;
            supplierEntity2.IsInEuropeanUnion = true;
            supplierEntity2.IsVATPayer        = false;
            supplierEntity2.VATPercentage     = 21;
            SupplierEntity supplierEntity3 = new SupplierEntity();

            supplierEntity3.Id                = 3;
            supplierEntity3.Name              = "Trecia";
            supplierEntity3.IdCountry         = 2;
            supplierEntity3.IsInEuropeanUnion = false;
            supplierEntity3.IsVATPayer        = true;
            supplierEntity3.VATPercentage     = 18;
            InvoiceController invoiceController = new InvoiceController(_clientRepository, _supplierRepository);

            // Act
            _supplierRepository.Add(supplierEntity);
            _supplierRepository.Add(supplierEntity2);
            _supplierRepository.Add(supplierEntity3);

            // Assert

            Assert.AreEqual(_supplierRepository.GetBy(1).Name, "Pirma");
            Assert.AreEqual(_supplierRepository.GetBy(2).IsVATPayer, false);
            Assert.AreEqual(_supplierRepository.GetBy(3).Name, "Trecia");
            Assert.AreEqual(_supplierRepository.GetBy(3).Id, 3);
            Assert.AreEqual(_supplierRepository.GetCount(), 3);
        }
Exemplo n.º 26
0
        public void Create(SupplierEntity item)
        {
            using (var context = new DatabaseContext())
            {
                var e = new Supplier();
                e.Name         = item.Name;
                e.Address      = item.Address;
                e.Email        = item.Email;
                e.Contact      = item.Contact;
                e.Status       = item.Status;
                e.CreatedBy    = item.CreatedBy;
                e.CreatedDate  = item.CreatedDate;
                e.ModifiedBy   = item.ModifiedBy;
                e.ModifiedDate = item.ModifiedDate;
                context.Suppliers.Add(e);
                context.SaveChanges();

                item.ID = e.ID;
            }
        }
Exemplo n.º 27
0
        public ActionResult AddSupplier()
        {
            string SupNum = WebUtil.GetQueryStringValue <string>("SupNum");

            if (SupNum.IsEmpty())
            {
                ViewBag.Supplier = new SupplierEntity();
                ViewBag.SupType  = EnumHelper.GetOptions <ESupType>((int)ESupType.Invented, "请选择供应商类型");
                return(View());
            }
            else
            {
                SupplierProvider provider = new SupplierProvider();
                SupplierEntity   entity   = provider.GetSupplier(SupNum);
                entity           = entity == null ? new SupplierEntity() : entity;
                ViewBag.SupType  = EnumHelper.GetOptions <ESupType>(entity.SupType, "请选择供应商类型");
                ViewBag.Supplier = entity;
                return(View());
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// 绑定供应商代码
        /// </summary>
        public void BindSupplierCode()
        {
            DataSet        dataSet        = new DataSet();
            SupplierEntity supplierEntity = new SupplierEntity();

            dataSet = supplierEntity.GetSupplierCode();
            if (dataSet != null)
            {
                DataTable dt = dataSet.Tables[0].Copy();
                dt.Rows.InsertAt(dt.NewRow(), 0);
                this.lueCode.Properties.DataSource    = dt;
                this.lueCode.Properties.DisplayMember = "CODE";
                this.lueCode.Properties.ValueMember   = "CODE";
                lueCode.ItemIndex = 0;

                grdCrtlCode.MainView   = gridViewCode;
                grdCrtlCode.DataSource = dataSet.Tables[0];
                gridViewCode.BestFitColumns();
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// 获得所有供应商信息
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="pageInfo"></param>
        /// <returns></returns>
        public List <SupplierEntity> GetList()
        {
            //List<SupplierEntity> listResult = CacheHelper.Get(CacheKey.JOOSHOW_SUPPLIER_CACHE) as List<SupplierEntity>;
            //if (!listResult.IsNullOrEmpty())
            //{
            //    return listResult;
            //}
            SupplierEntity entity = new SupplierEntity();

            entity.IncludeAll();
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            List <SupplierEntity> listResult = this.Supplier.GetList(entity);

            //if (!listResult.IsNullOrEmpty())
            //{
            //    CacheHelper.Insert(CacheKey.JOOSHOW_SUPPLIER_CACHE, listResult);
            //}
            return(listResult);
        }
Exemplo n.º 30
0
        private void gridLoad()
        {
            try
            {
                Execute        objExecute = new Execute();
                string         Query      = "[dbo].[spGetAllSupplierView]";
                SqlParameter[] para       = new SqlParameter[]
                {
                };
                DataTable dt = (DataTable)objExecute.Executes(Query, ReturnType.DataTable, para, CommandType.StoredProcedure);

                SupplierEntity        objSupplierEntity;
                List <SupplierEntity> lstSupplier = new List <SupplierEntity>();

                foreach (DataRow dr in dt.Rows)
                {
                    objSupplierEntity = new SupplierEntity
                    {
                        intSupplierID  = (int)dr["intSupplierID"],
                        vcSupplierName = dr["vcSupplierName"].ToString(),
                        vcAddress      = dr["vcAddress"].ToString(),
                        vcCity         = dr["vcCity"].ToString(),
                        vcEmail        = dr["vcEmail"].ToString(),
                        intContactNo   = (int)dr["intContactNo"],
                    };

                    lstSupplier.Add(objSupplierEntity);
                }

                dgvSupplierView.DataSource          = null;
                dgvSupplierView.AutoGenerateColumns = false;
                dgvSupplierView.DataSource          = lstSupplier;

                GlobleList = lstSupplier.ToList();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Data Loading Error");
                Logger.LoggError(ex, "GetAllSupplierView");
            }
        }
Exemplo n.º 31
0
 private void ShowItem(SupplierEntity ent)
 {
     lblId.Text = ent.Id.HasValue ? ent.Id.Value.ToString() : string.Empty;
     txtName.Text = ent.Name;
     txtAddress.Text = ent.Address;
     txtAddress2.Text = ent.Address2;
     txtPhone.Text = ent.Phone;
     txtEmail.Text = ent.Email;
     txtComment.Text = ent.Comment;
     var found = allSeries.Where(s => s.Id == ent.NrSerieId).FirstOrDefault();
     if (found != null)
         cbNumberSerie.Text = found.ToString();
 }
Exemplo n.º 32
0
 private void NewItem()
 {
     current = SupplierEntity.Empty;
     ShowItem(current);
 }
Exemplo n.º 33
0
        private void gridSuppliers_SelectionChanged(object sender, EventArgs e)
        {
            if (gridSuppliers.SelectedCells == null || gridSuppliers.SelectedCells.Count == 0)
                current = SupplierEntity.Empty;
            else
                current = gridSuppliers.Rows[gridSuppliers.SelectedCells[0].RowIndex].DataBoundItem as SupplierEntity;

            ShowItem(current);
        }