示例#1
0
        //001
        //public static Model.mdlBranchList LoadBranch()
        //{
        //    //linq code
        //    //var customerList = DataContext.Customers.Where(fld => fld.PlantID.Equals(json.BranchID)).ToList();

        //    var mdlBranchListnew = new Model.mdlBranchList();
        //    var mdlBranchList = new List<Model.mdlBranch>();

        //    List<SqlParameter> sp = new List<SqlParameter>()
        //    {
        //    };

        //    DataTable dtBranch = Manager.DataFacade.DTSQLCommand("SELECT * FROM Branch", sp);

        //    foreach (DataRow drBranch in dtBranch.Rows)
        //    {
        //        var mdlBranch = new Model.mdlBranch();
        //        mdlBranch.BranchID = drBranch["BranchID"].ToString();
        //        mdlBranch.BranchDescription = drBranch["BranchDescription"].ToString();
        //        mdlBranch.CompanyID = drBranch["CompanyID"].ToString();

        //        mdlBranchList.Add(mdlBranch);
        //    }

        //    mdlBranchListnew.BranchList = mdlBranchList;
        //    return mdlBranchListnew;
        //}

        //002

        public static List <Model.mdlBranch> LoadBranch()
        {
            //linq code
            //var customerList = DataContext.Customers.Where(fld => fld.PlantID.Equals(json.BranchID)).ToList();


            var mdlBranchList = new List <Model.mdlBranch>();

            List <SqlParameter> sp = new List <SqlParameter>()
            {
            };

            DataTable dtBranch = Manager.DataFacade.DTSQLCommand("SELECT * FROM Branch", sp);

            foreach (DataRow drBranch in dtBranch.Rows)
            {
                var mdlBranch = new Model.mdlBranch();
                mdlBranch.BranchID          = drBranch["BranchID"].ToString();
                mdlBranch.BranchDescription = drBranch["BranchName"].ToString();
                mdlBranch.CompanyID         = drBranch["CompanyID"].ToString();

                mdlBranchList.Add(mdlBranch);
            }


            return(mdlBranchList);
        }
示例#2
0
        //FOR LINQ MODEL
        public static List <Model.mdlBranch> LoadSomeBranch2(string keyword, string branchid)
        {
            var mdlBranchList = new List <Model.mdlBranch>();

            List <SqlParameter> sp = new List <SqlParameter>()
            {
            };

            DataTable dtBranch = Manager.DataFacade.DTSQLCommand("SELECT * FROM Branch where BranchID IN (" + branchid + ") and (BranchName LIKE '%" + keyword + "%')  order by BranchName", sp);

            foreach (DataRow drBranch in dtBranch.Rows)
            {
                var mdlBranch = new Model.mdlBranch();
                mdlBranch.BranchID          = drBranch["BranchID"].ToString();
                mdlBranch.BranchName        = drBranch["BranchName"].ToString();
                mdlBranch.BranchDescription = drBranch["BranchDescription"].ToString();
                mdlBranch.CompanyID         = drBranch["CompanyID"].ToString();

                mdlBranchList.Add(mdlBranch);
            }

            //mdlBranchListnew.BranchList = mdlBranchList;
            //return mdlBranchListnew;
            return(mdlBranchList);
        }
示例#3
0
        public static List <Model.mdlBranch> GetSearch(string keywordBranch, string branchid)
        {
            var branchlist = DataContext.Branches.Where(fld => fld.BranchID.Contains(branchid) && fld.BranchName.Contains(keywordBranch)).OrderBy(fld => fld.BranchName).ToList();

            var mdlBranchList = new List <Model.mdlBranch>();

            foreach (var branch in branchlist)
            {
                var mdlBranch = new Model.mdlBranch();
                mdlBranch.BranchID          = branch.BranchID;
                mdlBranch.BranchName        = branch.BranchName;
                mdlBranch.BranchDescription = branch.BranchDescription;
                mdlBranch.CompanyID         = branch.CompanyID;

                mdlBranchList.Add(mdlBranch);
            }

            return(mdlBranchList);
        }