Esempio n. 1
0
        public AddOrder()
        {
            InitializeComponent();
            spl = new SupplierList();

            foreach (Supplier s in spl)
            {
                cmbSupplier.Items.Add(s.Name);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Load all Products, and product properties (Supplier, OrderList, ProductReturnList)
        /// from the DB into the app ProductList
        /// </summary>
        public async void LoadProductsAsync()
        {
            List <Product> products = null;

            try
            {
                products = await PersistencyService.LoadProductsAsync();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw;
            }

            if (products != null)
            {
                foreach (Product p in products)
                {
                    // Set the Supplier, Orders, and ProductReturns for the current Product
                    // Product has a required supplier
                    try
                    {
                        // Find the single supplier matching the supplier foreign key on the product
                        p.Supplier = SupplierList.Single(s => s.Id.Equals(p.SupplierId));
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(e);
                        throw;
                    }


                    // Get Orders in the OrderList with a foreign key to the current Product in the foreach
                    List <Order> productOrderList = OrderList.Where(o => o.ProductId.Equals(p.Id)).ToList();
                    if (productOrderList != null && productOrderList.Count > 0)
                    {
                        p.FillOrderList(productOrderList);
                    }

                    // Get ProductReturns in the prList with a foreign key to the current Product in the foreach
                    List <ProductReturn> prList = ProductReturnList.Where(pr => pr.ProductId.Equals(p.Id)).ToList();
                    if (prList != null && prList.Count > 0)
                    {
                        p.FillProductReturnList(prList);
                    }

                    // At last, add the product the productList
                    ProductList.Add(p);
                }
            }
            else
            {
                throw new ArgumentNullException("Products list null");
            }
        }
        //Adds a new supplier to the DB-Grace
        public bool AddNewSupplier(int supplierID, string name, string phoneNum, string email, string street, string city, string county, string additionalInfo)
        {
            SupplierList = DataLayer.getAllSuppliers();
            ISupplier supplier;

            DataLayer.AddNewSupplierToDB(supplierID, name, phoneNum, email, street, city, county, additionalInfo);
            supplier = SupplierFactory.GetSupplier(supplierID, name, phoneNum, email, street, city, county, additionalInfo);   // Using a Factory to create the user entity object. ie seperating object creation from business logic
            SupplierList.Add(supplier);
            // Add a reference to the newly created object to the Models UserList
            //Gets the DataLayer to add the new user to the DB.
            return(true);
        }
        void BindControls()
        {
            List <SupplierList> sList     = PurchasingLogic.ListSuppliers();
            SupplierList        selectAll = new SupplierList();

            selectAll.SupplierID   = "All";
            selectAll.SupplierName = "All";
            sList.Add(selectAll);
            DdlSupplier.DataSource = sList;
            DdlSupplier.DataBind();
            DdlSupplier.SelectedIndex = sList.Count() - 1;
        }
        //private void XFPopupCancel_Clicked(object sender, EventArgs e)
        //{
        //    XFCVCompanyPopup.IsVisible = false;
        //}

        private void XFListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            XFCVCompanyPopup.IsVisible = false;
            SupplierList sl = (SupplierList)e.SelectedItem;

            selectedCompany = result.compareListDetails.supplierList.Where(x => x.companyName == sl.companyName).FirstOrDefault();
            RateComparisionList.ItemsSource = result.compareListDetails.retailerList.Where(x => x.companyId == selectedCompany.companyId);

            XFLBLCompanyName.Source = selectedCompany.logo;
            XFLBKCompanyRate.Text   = $"{selectedCompany.rate:0.00}" + "c";
            // XFLblAnnualSavings.Text = "$" + " " + selectedCompany.futureAnnualSavings.ToString();
        }
 protected void Clear_Click(object sender, EventArgs e)
 {
     ID.Text        = "";
     FirstName.Text = "";
     LastName.Text  = "";
     Age.Text       = "";
     Gender.Text    = "";
     AlbertaHealthCareNumber.Text = "";
     MedicalAlertDetails.Text     = "";
     CategoryList.ClearSelection();
     SupplierList.ClearSelection();
 }
Esempio n. 7
0
        public void CreateProduct(Product p)
        {
            // TODO check if varenr og navn eksisterer i forvejen
            // if check here


            if (p.Supplier == null)
            {
                // Supplier or any of suppliers properties are null
                throw new ArgumentNullException("Some supplier information is missing");
            }

            if (p.Supplier.Id != 0)
            {
                // If the supplier is not 0, that means the Supplier was selected from the dropdownlist

                // Set the SupplierId on the Product
                p.SupplierId = p.Supplier.Id;
            }
            else
            {
                // The supplier id is zero, which means it was typed in and not selected
                // should now check if a supplier already exists with that name or create a new one

                // Check if the Supplier already exists in the list
                if (SupplierList.Where(s => s.Id.Equals(p.SupplierId)).Count() > 0)
                {
                    // Exists in the list update the Supplier instead
                    UpdateSupplier(p.Supplier);
                    new MessageDialog("Updating Supplier").ShowAsync();
                }
                else
                {
                    // Does not exist in the list, create a new one
                    CreateSupplier(p.Supplier);
                    new MessageDialog("Creating Supplier").ShowAsync();
                }
            }

            try
            {
                // Add in DB1
                PersistencyService.InsertProductAsync(p);

                // Add to ProductList
                ProductList.Add(p);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
        }
 protected void Clear(object sender, EventArgs e)
 {
     ID.Text              = "";
     Name.Text            = "";
     QuantityPerUnit.Text = "";
     UnitPrice.Text       = "";
     UnitsInStock.Text    = "";
     UnitsOnOrder.Text    = "";
     ReorderLevel.Text    = "";
     Discontinued.Checked = false;
     CategoryList.ClearSelection();
     SupplierList.ClearSelection();
 }
Esempio n. 9
0
        public List <SupplierList> GetListSupplierInfo()
        {
            List <SupplierList> list = new List <SupplierList>();
            string    query          = "select s.id, s.name, s.address, s.phone, st.name as N'group' from Supplier as s, SupplierType as st where s.type = st.id";
            DataTable data           = DataProvider.Instance.ExcuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                SupplierList sl = new SupplierList(item);
                list.Add(sl);
            }
            return(list);
        }
Esempio n. 10
0
 protected void Clear_Click(object sender, EventArgs e)
 {
     ProductList.ClearSelection();
     ProductID.Text   = "";
     ProductName.Text = "";
     SupplierList.ClearSelection();   //reset to prompt line
     CategoryList.SelectedIndex = -1; //reset to prompt line
     QuantityPerUnit.Text       = "";
     UnitPrice.Text             = "";
     UnitsInStock.Text          = "";
     UnitsOnOrder.Text          = "";
     ReorderLevel.Text          = "";
     Discontinued.Checked       = false;
 }
Esempio n. 11
0
 public Boolean addnewSupplier(string SupplierID, string CompanyName, string Email, string Phone, string Street, string City, string County, string Country)
 {
     try
     {
         ISupplier theSupplier = SupplierFactory.GetSupplier(SupplierID, CompanyName, Email, Phone, Street, City, County, Country); // Using a Factory to create the user entity object. ie seperating object creation from business logic
         SupplierList.Add(theSupplier);                                                                                             // Add a reference to the newly created object to the Models UserList
         DataLayer.addNewSupplierToDB(theSupplier);                                                                                 //Gets the DataLayer to add the new user to the DB.
         return(true);
     }
     catch (System.Exception excep)
     {
         return(false);
     }
 }
        bool CheckIfSupplierNotExist(List <SupplierList> sList, SupplierList ItemToAdd)
        {
            bool isNotExist = false;

            foreach (SupplierList s in sList)
            {
                if (s.SupplierID == ItemToAdd.SupplierID)
                {
                    return(isNotExist);
                }
            }
            isNotExist = true;
            return(isNotExist);
        }
Esempio n. 13
0
 protected void Clear_Click(object sender, EventArgs e)
 {
     ProductID.Text       = "";
     ProductName.Text     = "";
     QuantityPerUnit.Text = "";
     UnitPrice.Text       = "";
     UnitsInStock.Text    = "";
     UnitsOnOrder.Text    = "";
     ReorderLevel.Text    = "";
     Discontinued.Checked = false;
     SupplierList.ClearSelection();
     CategoryList.ClearSelection();
     //optionally
     ProductList.ClearSelection();
 }
Esempio n. 14
0
        public SearchOrder()
        {
            InitializeComponent();
            //dataGridView2.DataSource = ol;
            //cmbSupp.DataSource = spl;
            //cmbSupp.DisplayMember = "Name";
            //cmbSupp.ValueMember = "supplierID";
            dataGridView2.DataSource = ol;
            spl = new SupplierList();

            foreach (Supplier s in spl)
            {
                cmbSupp.Items.Add(s.Name);
            }
        }
Esempio n. 15
0
        public Types.PagedList <Supplier> ApiToDomain(SupplierList value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new Types.PagedList <Supplier>
            {
                Page = value.Page,
                ItemsPerPage = value.PerPage,
                TotalItems = value.Total,
                List = value.List?.Select(ApiToDomain).ToList()
            });
        }
Esempio n. 16
0
 public static void UpdateSupplier(string SupplierID, string SupplierName, string GSTRegistrationNo, string ContactName, int PhoneNo, int FaxNo, string Address, int OrderLeadTime, string Discontinued)
 {
     using (SA45Team12AD entities = new SA45Team12AD())
     {
         SupplierList supplier = entities.SupplierLists.Where(s => s.SupplierID == SupplierID).First <SupplierList>();
         supplier.SupplierName      = SupplierName;
         supplier.GSTRegistrationNo = GSTRegistrationNo;
         supplier.ContactName       = ContactName;
         supplier.PhoneNo           = PhoneNo;
         supplier.FaxNo             = FaxNo;
         supplier.Address           = Address;
         supplier.OrderLeadTime     = OrderLeadTime;
         supplier.Discontinued      = Discontinued;
         entities.SaveChanges();
     }
 }
Esempio n. 17
0
 public static string getSupplierList()
 {
     List<SupplierList> IsupplierList = new List<SupplierList>();
     SupplierList supplier = new SupplierList();
     DataTable dtSupplier = new DataTable();
     dtSupplier = CrystalConnection.CreateDataTableWithoutTransaction("usp_GetAllSupplierList");
     foreach (DataRow dr in dtSupplier.Rows)
     {
         supplier = new SupplierList();
         supplier.SupplierId = Convert.ToInt32(dr["SupplierID"]);
         supplier.SupplierName = dr["SupplierName"].ToString();
         IsupplierList.Add(supplier);
     }
     string sJSON = "";
     var oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
     return sJSON = oSerializer.Serialize(IsupplierList);
 }
        /// <summary>
        /// Fetch SupplierList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public SupplierList Fetch(SupplierCriteria criteria)
        {
            SupplierList item = (SupplierList)Activator.CreateInstance(typeof(SupplierList), true);

            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(item);
            }

            // Fetch Child objects.
            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand("[dbo].[CSLA_Supplier_Select]", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    command.Parameters.AddWithValue("@p_NameHasValue", criteria.NameHasValue);
                    command.Parameters.AddWithValue("@p_Addr1HasValue", criteria.Addr1HasValue);
                    command.Parameters.AddWithValue("@p_Addr2HasValue", criteria.Addr2HasValue);
                    command.Parameters.AddWithValue("@p_CityHasValue", criteria.CityHasValue);
                    command.Parameters.AddWithValue("@p_StateHasValue", criteria.StateHasValue);
                    command.Parameters.AddWithValue("@p_ZipHasValue", criteria.ZipHasValue);
                    command.Parameters.AddWithValue("@p_PhoneHasValue", criteria.PhoneHasValue);
                    using (var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new SupplierFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return(item);
        }
Esempio n. 19
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            var selectedNode = suppliersTreeView.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }

            var localSupplierId = int.Parse(selectedNode.Name);
            var supplier        = SupplierList.GetSupplier(localSupplierId);

            supplier.Delete();

            suppliersTreeView.SelectedNode = null;

            BuildTree();
        }
        public JsonResult GetSupplierbyName(string nameString, bool?errorCheck)
        {
            if (!errorCheck.HasValue)
            {
                RatingsViewModel RatingModel = (RatingsViewModel)TempData["SearchedResults"];
                TempData.Keep("SearchedResults");
                List <SelectListItem> SupplierList;
                if (RatingModel != null)
                {
                    var rateSuppliers = RatingModel.RatingRecords.Select(r => new SelectListItem {
                        Text = r.SupplierName + " CID:" + r.CID, Value = r.CID.ToString()
                    }).ToList();
                    var modifiedlist       = selectSupplierscid;
                    var NotinListSuppliers = (from fulllist in modifiedlist
                                              where !(rateSuppliers.Any(i => i.Value == fulllist.Value))
                                              select fulllist).ToList();


                    if (NotinListSuppliers != null)
                    {
                        SupplierList = NotinListSuppliers;
                    }
                    else
                    {
                        SupplierList = modifiedlist;
                    }
                }
                else
                {
                    var modifiedlist = selectSupplierscid;
                    SupplierList = modifiedlist;
                }

                var newSuppliercache = string.IsNullOrWhiteSpace(nameString) ? SupplierList :
                                       SupplierList.Where(s => s.Text.StartsWith(nameString, StringComparison.InvariantCultureIgnoreCase));
                return(Json(newSuppliercache, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var newSuppliercache = string.IsNullOrWhiteSpace(nameString) ? selectSupplierscid :
                                       selectSupplierscid.Where(s => s.Text.StartsWith(nameString, StringComparison.InvariantCultureIgnoreCase));
                return(Json(newSuppliercache, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 21
0
 public void BindSupplierList()
 {
     try
     {
         SupplierController sysmgr = new SupplierController();
         List <Supplier>    info   = sysmgr.Supplier_List();
         info.Sort((x, y) => x.CompanyName.CompareTo(y.CompanyName));
         SupplierList.DataSource     = info;
         SupplierList.DataTextField  = nameof(Supplier.CompanyName); // look in .data xxxx.cs entity to find out what to put in these
         SupplierList.DataValueField = nameof(Supplier.SupplierID);
         SupplierList.DataBind();
         SupplierList.Items.Insert(0, "select...");
     }
     catch (Exception ex)
     {
         errormsgs.Add("File Error: " + GetInnerException(ex).Message);
         LoadMessageDisplay(errormsgs, "alert alert-warning");
     }
 }
Esempio n. 22
0
 protected void BindSupplierList()
 {
     try
     {
         SupplierController sysmgr   = new SupplierController();
         List <Supplier>    datainfo = sysmgr.Supplier_List();
         datainfo.Sort((x, y) => x.CompanyName.CompareTo(y.CompanyName));
         SupplierList.DataSource     = datainfo;
         SupplierList.DataTextField  = nameof(Supplier.CompanyName);
         SupplierList.DataValueField = nameof(Supplier.SupplierID);
         SupplierList.DataBind();
         SupplierList.Items.Insert(0, "..select");
     }
     catch (Exception ex)
     {
         errormsgs.Add(GetInnerException(ex).Message);
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
 }
Esempio n. 23
0
 public void BindSupplierList()
 {
     //TODO: code the method to load the SupplierList control
     try
     {
         SupplierController sysmgr = new SupplierController();
         List <Supplier>    info   = sysmgr.Suppliers_List();
         info.Sort((x, y) => x.CompanyName.CompareTo(y.CompanyName));
         SupplierList.DataSource     = info;
         SupplierList.DataTextField  = nameof(Supplier.CompanyName);
         SupplierList.DataValueField = nameof(Supplier.SupplierID);
         SupplierList.DataBind();
         SupplierList.Items.Insert(0, "select ...");
     }
     catch (Exception ex)
     {
         errormsgs.Add("File Error: " + GetInnerException(ex).Message);
         LoadMessageDisplay(errormsgs, "alert alert-warning");
     }
 }
 protected void BindSupplierList()
 {
     try
     {
         Controller03    sysmgr = new Controller03();
         List <Entity03> info   = null;
         info = sysmgr.List();
         info.Sort((x, y) => x.ContactName.CompareTo(y.ContactName));
         SupplierList.DataSource     = info;
         SupplierList.DataTextField  = nameof(Entity03.ContactName);
         SupplierList.DataValueField = nameof(Entity03.SupplierID);
         SupplierList.DataBind();
         SupplierList.Items.Insert(0, "select...");
     }
     catch (Exception ex)
     {
         errormsgs.Add(GetInnerException(ex).ToString());
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
 }
Esempio n. 25
0
        /*
         * This method will search supplier info
         * @author A.K.M. Nazmul Islam on 30th january 2016
         */
        private void OnSearch()
        {
            SupplierManager supplierManager = new SupplierManager();

            SupplierList.Clear();
            for (Iterator i = supplierManager.searchSuppliers(SearchSupplierByPhone).iterator(); i.hasNext();)
            {
                SupplierInfo   supplierInfo   = (SupplierInfo)i.next();
                SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ();
                supplierInfoNJ.ProfileInfoNJ.Id        = supplierInfo.getProfileInfo().getId();
                supplierInfoNJ.ProfileInfoNJ.FirstName = supplierInfo.getProfileInfo().getFirstName();
                supplierInfoNJ.ProfileInfoNJ.LastName  = supplierInfo.getProfileInfo().getLastName();
                supplierInfoNJ.ProfileInfoNJ.Phone     = supplierInfo.getProfileInfo().getPhone();
                supplierInfoNJ.ProfileInfoNJ.Fax       = supplierInfo.getProfileInfo().getFax();
                supplierInfoNJ.ProfileInfoNJ.Email     = supplierInfo.getProfileInfo().getEmail();
                supplierInfoNJ.ProfileInfoNJ.Website   = supplierInfo.getProfileInfo().getWebsite();
                supplierInfoNJ.Remarks = supplierInfo.getRemarks();
                SupplierList.Add(supplierInfoNJ);
            }
        }
Esempio n. 26
0
        //constructor
        public ManageSupplierList()
        {
            //loading supplier list
            SupplierManager supplierManager = new SupplierManager();

            for (Iterator i = supplierManager.getAllSuppliers().iterator(); i.hasNext();)
            {
                SupplierInfo   supplierInfo   = (SupplierInfo)i.next();
                SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ();
                supplierInfoNJ.ProfileInfoNJ.Id        = supplierInfo.getProfileInfo().getId();
                supplierInfoNJ.ProfileInfoNJ.FirstName = supplierInfo.getProfileInfo().getFirstName();
                supplierInfoNJ.ProfileInfoNJ.LastName  = supplierInfo.getProfileInfo().getLastName();
                supplierInfoNJ.ProfileInfoNJ.Phone     = supplierInfo.getProfileInfo().getPhone();
                supplierInfoNJ.ProfileInfoNJ.Fax       = supplierInfo.getProfileInfo().getFax();
                supplierInfoNJ.ProfileInfoNJ.Email     = supplierInfo.getProfileInfo().getEmail();
                supplierInfoNJ.ProfileInfoNJ.Website   = supplierInfo.getProfileInfo().getWebsite();
                supplierInfoNJ.Remarks = supplierInfo.getRemarks();
                SupplierList.Add(supplierInfoNJ);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        SqlConnection con = new SqlConnection(
            WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);

        con.Open();
        string     query = "select privilege from EMPLOYEE where employeeID = " + Session["user"];
        SqlCommand cmd   = new SqlCommand(query, con);

        if (Convert.ToInt32(cmd.ExecuteScalar()) == 0)
        {
            Response.Redirect("~/Login.aspx");
        }
        con.Close();

        if (!IsPostBack)
        {
            con = new SqlConnection(
                WebConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString);
            con.Open();
            query = "select Dept_number, Dept_name  from DEPARTMENT";
            cmd   = new SqlCommand(query, con);
            DepartmentList.DataSource = cmd.ExecuteReader();
            DepartmentList.DataBind();
            ListItem defaultDept = new ListItem("Select department", "-1");
            DepartmentList.Items.Insert(0, defaultDept);
            con.Close();
            con.Open();
            query = "select companyID, company_name  from SUPPLIER ORDER BY company_name";
            cmd   = new SqlCommand(query, con);
            SupplierList.DataSource = cmd.ExecuteReader();
            SupplierList.DataBind();
            ListItem defaultSupp = new ListItem("Select supplier", "-1");
            SupplierList.Items.Insert(0, defaultSupp);
            con.Close();
        }
    }
Esempio n. 28
0
        private void BtnListSupp_Click(object sender, EventArgs e)
        {
            SupplierRepository repository = new SupplierRepository();
            List <Supplier>    suppliers  = repository.GetSuppliers().ToList();

            if (suppliers.Count == 0)
            {
                MessageBox.Show("No Records To Display.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            ReportDocument report = new SupplierList();

            report.SetDataSource(suppliers);
            report.SetParameterValue("@Company", Properties.Settings.Default.COMPANYNAME.ToUpper());
            report.SetParameterValue("@Branch", Properties.Settings.Default.BRANCHNAME.ToUpper());
            report.SetParameterValue("@Username", Properties.Settings.Default.USERNAME.ToUpper());
            Form form = new frmPrint(report);

            form.Text = "Supplier Master List";
            form.Show();
        }
Esempio n. 29
0
 protected void BindSupplierList()
 {
     try
     {
         SupplierController sysmgr = new SupplierController();
         List <Supplier>    info   = null;
         info = sysmgr.Supplier_List();
         info.Sort((x, y) => x.ContactName.CompareTo(y.ContactName));
         SupplierList.DataSource     = info;
         SupplierList.DataTextField  = nameof(Supplier.ContactName);
         SupplierList.DataValueField = nameof(Supplier.SupplierID);
         SupplierList.DataBind();
         SupplierList.Items.Insert(0, "select...");
     }
     catch (Exception ex)
     {
         //using the specialized error handling DataList control
         errormsgs.Add(GetInnerException(ex).ToString());
         LoadMessageDisplay(errormsgs, "alert alert-danger");
     }
 }
Esempio n. 30
0
        public void CreateSupplierList()
        {
            SupplierList.Clear();

            SqlConnection  con      = Methods.AccessDatabase();
            SqlDataAdapter autoNode = new SqlDataAdapter("SELECT * From [SUPPLIER]", con);
            DataTable      dt       = new DataTable();

            autoNode.Fill(dt);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                SUPPLIER newSupplier = new SUPPLIER();

                newSupplier.SupplierID      = Convert.ToInt16(dt.Rows[i]["Supplier_ID"]);
                newSupplier.SupplierName    = dt.Rows[i]["Supplier_Name"].ToString();
                newSupplier.SupplierDetails = dt.Rows[i]["Supplier_Details"].ToString();

                SupplierList.Add(newSupplier);
            }
        }
Esempio n. 31
0
        /// <summary>
        /// Fetch SupplierList.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public SupplierList Fetch(SupplierCriteria criteria)
        {
            SupplierList item = (SupplierList)Activator.CreateInstance(typeof(SupplierList), true);

            bool cancel = false;

            OnFetching(criteria, ref cancel);
            if (cancel)
            {
                return(item);
            }

            // Fetch Child objects.
            string commandText = String.Format("SELECT [SuppId], [Name], [Status], [Addr1], [Addr2], [City], [State], [Zip], [Phone] FROM [dbo].[Supplier] {0}", ADOHelper.BuildWhereStatement(criteria.StateBag));

            using (var connection = new SqlConnection(ADOHelper.ConnectionString))
            {
                connection.Open();
                using (var command = new SqlCommand(commandText, connection))
                {
                    command.Parameters.AddRange(ADOHelper.SqlParameters(criteria.StateBag));
                    using (var reader = new SafeDataReader(command.ExecuteReader()))
                    {
                        if (reader.Read())
                        {
                            do
                            {
                                item.Add(new SupplierFactory().Map(reader));
                            } while(reader.Read());
                        }
                    }
                }
            }

            MarkOld(item);
            MarkAsChild(item);
            OnFetched();
            return(item);
        }
Esempio n. 32
0
        protected void BindCategoryList()
        {
            try
            {
                CategoryController sysmger = new CategoryController();

                List <Category> datainfo = sysmger.Category_List();
                datainfo.Sort((x, y) => x.CategoryName.CompareTo(y.CategoryName));

                SupplierList.DataSource     = datainfo;
                SupplierList.DataTextField  = nameof(Category.CategoryName);
                SupplierList.DataValueField = nameof(Category.CategoryID);
                SupplierList.DataBind();
                SupplierList.DataBind();
                SupplierList.Items.Insert(0, "select...");
            }
            catch (Exception ex)
            {
                errormsgs.Add(GetInnerException(ex).ToString());
                LoadMessageDisplay(errormsgs, "alert alert-danger");
            }
        }
Esempio n. 33
0
    protected void SelectButton_Click(object sender, EventArgs e)
    {
        string Key = StrKey.Text.ToString();

        if (Key == null || Key.Equals(""))
        {
            Jscript.AjaxAlert(this, "请输入关键字!");
            return;
        }
        List <Supplier> list = new List <Supplier>();

        list = Leyp.SQLServerDAL.Factory.getSupplierDAL().getSearchListByKey(Key);
        if (list.Count == 0)
        {
            Label1.Visible = true;
        }
        else
        {
            SupplierList.DataSource = list;
            SupplierList.DataBind();
        }
    }