Пример #1
0
        public List<Supplier> GetSuppliersMatchingFullName(string str)
        {
            try
            {
                List<Supplier> supplierList = null;

                var supppliers = from s in dc.tblSuppliers
                                 where s.supplierName.StartsWith(str) && s.supplierStatus.ToUpper() != "BLOCK"
                                 select s;


                if (null != supppliers && supppliers.Count() > 0)
                {
                    supplierList = new List<Supplier>();
                    foreach (tblSupplier s in supppliers)
                    {
                        Supplier sup = new Supplier();
                        sup.supplierId = s.supplierId;
                        sup.supplierName = s.supplierName;
                        sup.supplierStatus = s.supplierStatus;
                        sup.supplierContactNumber = s.supplierContactNo;
                        sup.supplierAddress = s.supplierAddress;
                        supplierList.Add(sup);
                    }
                }

                return supplierList;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
 private void getTableSupplierEquivalentFromSupplierEntity(ref tblSupplier tblSupplierObj, Supplier s)
 {
     try
     {
         tblSupplierObj.supplierName = s.supplierName;
         tblSupplierObj.supplierStatus = s.supplierStatus;
         tblSupplierObj.supplierContactNo = s.supplierContactNumber;
         tblSupplierObj.supplierAddress = s.supplierAddress;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
        public void AddSupplier(Supplier s)
        {
            try
            {
                tblSupplier tblSupplierObj = new tblSupplier();
                getTableSupplierEquivalentFromSupplierEntity(ref tblSupplierObj, s);
                dc.tblSuppliers.InsertOnSubmit(tblSupplierObj);
                dc.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }


        }
Пример #4
0
 private void GetCorrespondingtblSupplierFromSupplier(ref tblSupplier sup, Supplier _SupplierTobeEdited)
 {
     //return new tblSupplier
     //{
     sup.supplierId = (int)_SupplierTobeEdited.supplierId;
     sup.supplierName = _SupplierTobeEdited.supplierName;
     sup.supplierStatus = _SupplierTobeEdited.supplierStatus;
     sup.supplierContactNo = _SupplierTobeEdited.supplierContactNumber;
     sup.supplierAddress = _SupplierTobeEdited.supplierAddress;
     //};
 }
Пример #5
0
        public void UpdateSupplierDetails(Supplier _SupplierTobeEdited)
        {
            //tblSupplier updated = GetCorrespondingtblSupplierFromSupplier(_SupplierTobeEdited);

            tblSupplier toBeUpdated = (from s in dc.tblSuppliers
                                       where s.supplierId == _SupplierTobeEdited.supplierId
                                       select s).FirstOrDefault();

            GetCorrespondingtblSupplierFromSupplier(ref toBeUpdated, _SupplierTobeEdited);

            dc.SubmitChanges();
        }
Пример #6
0
 private void BindSupplierToRespectiveFields(Supplier s)
 {
     //txtFullName.Text = s.supplierName;
     //txtContactNo1.Text = s.supplierContactNumber;
     //txtAddress.Text = s.supplierAddress;
     //cboSupplierStatus.Text = s.supplierStatus;
 }