protected void ShortListSuppliers_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(SearchCompanyName.Text))
     {
         errormsgs.Add("Enter a company name.");
         LoadMessageDisplay(errormsgs, "alert alert-warning");
     }
     else
     {
         try
         {
             SupplierController sysmgr = new SupplierController();
             List <Supplier>    info   = sysmgr.Suppliers_GetByPartialCompanyName(SearchCompanyName.Text);
             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 ...");
             if (info.Count == 0)
             {
                 errormsgs.Add("No suppliers found with supplied company name");
                 LoadMessageDisplay(errormsgs, "alert alert-warning");
             }
         }
         catch (Exception ex)
         {
             errormsgs.Add("File Error: " + GetInnerException(ex).Message);
             LoadMessageDisplay(errormsgs, "alert alert-warning");
         }
     }
 }
예제 #2
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");
     }
 }
예제 #3
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");
     }
 }
예제 #4
0
 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");
     }
 }
예제 #5
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");
     }
 }
예제 #6
0
    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();
        }
    }
예제 #7
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");
     }
 }
예제 #8
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();
        }
    }
예제 #9
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");
            }
        }
예제 #10
0
 protected void BindSupplierList()
 {
     try
     {
         SupplierController sysmgr = new SupplierController();
         List <Supplier>    info   = null;
         info = sysmgr.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();
         ListItem myitem = new ListItem();
         myitem.Value = "0";
         myitem.Text  = "select...";
         SupplierList.Items.Insert(0, myitem);
         //SupplierList.Items.Insert(0, "select...");
     }
     catch (Exception ex)
     {
         ShowMessage(GetInnerException(ex).ToString(), "alert alert-danger");
     }
 }