Exemplo n.º 1
0
        public JsonResult GetAll()
        {
            //Khai báo lấy dữ liệu
            PROVINCE_BUS     bus  = new PROVINCE_BUS();
            List <fieldpara> lipa = new List <fieldpara>
            {
                new fieldpara("UNIVERSITYCODE", _ses.gUNIVERSITYCODE, 0)
            };
            //order by theorder, with pagesize and the page
            var li = bus.getAllBy2("NAME", lipa.ToArray());

            bus.CloseConnection();
            //District
            DISTRICT_BUS        busDistrict = new DISTRICT_BUS();
            List <DISTRICT_OBJ> liDistrict  = busDistrict.getAllBy2("NAME");

            busDistrict.CloseConnection();
            TOWN_BUS        busTown = new TOWN_BUS();
            List <TOWN_OBJ> liTown  = busTown.getAllBy2("NAME");

            busTown.CloseConnection();
            foreach (var objDistrict in liDistrict)
            {
                PROVINCE_OBJ objAp = new PROVINCE_OBJ
                {
                    CODE       = objDistrict.CODE,
                    CODEVIEW   = objDistrict.CODEVIEW,
                    NAME       = objDistrict.NAME,
                    BEGINDATE  = objDistrict.BEGINDATE,
                    ENDDATE    = objDistrict.ENDDATE,
                    NOTE       = objDistrict.NOTE,
                    LOCK       = objDistrict.LOCK,
                    PARENTCODE = objDistrict.PARENTCODE,
                    THETYPE    = objDistrict.THETYPE
                };
                li.Add(objAp);
            }
            foreach (var objTown in liTown)
            {
                PROVINCE_OBJ objAp = new PROVINCE_OBJ
                {
                    CODE       = objTown.CODE,
                    CODEVIEW   = objTown.CODEVIEW,
                    NAME       = objTown.NAME,
                    BEGINDATE  = objTown.BEGINDATE,
                    ENDDATE    = objTown.ENDDATE,
                    NOTE       = objTown.NOTE,
                    LOCK       = objTown.LOCK,
                    PARENTCODE = objTown.PARENTCODE,
                    THETYPE    = objTown.THETYPE
                };
                li.Add(objAp);
            }
            //li = li.Skip((page - 1) * pageSize).Take(pageSize).ToList();
            return(Json(new
            {
                lst = li, //Danh sách
                ret = 0   //ok
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public int District(string parentcode, out ReportDataSource datasource, out ReportParameter[] parameter, out string filename, out string title)
        {
            int              ret          = 0;
            var              province     = new PROVINCE_BUS().GetByID(new PROVINCE_OBJ.BusinessObjectID(parentcode));
            var              nameProvince = province.NAME;
            DISTRICT_BUS     bus          = new DISTRICT_BUS();
            List <fieldpara> li           = new List <fieldpara>();
            DataSet          ds           = new DataSet();

            li.Add(new fieldpara("parentcode", parentcode));
            ret = bus.getAllBy2(ref ds, "DataSetDistrict", "codeview", li.ToArray());
            bus.CloseConnection();
            //Trả về datasourse theo đúng tên khi thiết kế
            ReportDataSource rpd = new ReportDataSource("DataSetDistrict", ds.Tables["DataSetDistrict"]);

            datasource = rpd;
            //Danh sách các tham số nếu report có được
            //Ví dụ: ReportParameter[] rpp = new ReportParameter[] { new ReportParameter("title", "Helelo"), new ReportParameter("studentinfo", "Người không mang họ") };
            ReportParameter[] rpp = new ReportParameter[]
            {
                new ReportParameter("nameProvince", nameProvince)
            };
            parameter = rpp;
            //Đường dẫn tương đối đến file report
            filename = "report/District/Danhmuchuyen.rdlc";
            //Tiêu đề sau này dùng để gán lên trên tiêu đề của tab trong trình duyệt
            title = "Danh sách huyện";
            return(0);
        }
Exemplo n.º 3
0
        // GET: District

        public JsonResult getAll(string provinceCode)
        {
            List <DISTRICT_OBJ> li = null;
            //Khai báo lấy dữ liệu
            DISTRICT_BUS     bus  = new DISTRICT_BUS();
            List <fieldpara> lipa = new List <fieldpara>();

            lipa.Add(new fieldpara("UNIVERSITYCODE", ses.gUNIVERSITYCODE, 0));
            lipa.Add(new fieldpara("PROVINCECODE", provinceCode, 0));
            //order by theorder, with pagesize and the page
            li = bus.getAllBy2(" THEORDER ", lipa.ToArray());
            bus.CloseConnection();
            //li = li.Skip((page - 1) * pageSize).Take(pageSize).ToList();
            return(Json(new
            {
                lst = li, //Danh sách
                ret = 0   //ok
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public List <DISTRICT_OBJ> GetAllSearch(string parentcode, string name, string nametype, string note, string notetype)
        {
            List <DISTRICT_OBJ> li = null;

            //Khai báo lấy dữ liệu
            DISTRICT_BUS     bus  = new DISTRICT_BUS();
            List <fieldpara> lipa = new List <fieldpara>();

            lipa.Add(new fieldpara("PARENTCODE", parentcode, 0));
            if (!string.IsNullOrEmpty(name))
            {
                lipa.Add(new fieldpara("NAME", name, (int)(nametype.ToUpper() == "TRUE" ? searchType.NONE : searchType.LIKE)));
            }
            if (!string.IsNullOrEmpty(note))
            {
                lipa.Add(new fieldpara("NOTE", note, (int)(notetype.ToUpper() == "TRUE" ? searchType.NONE : searchType.LIKE)));
            }
            //order by theorder, with pagesize and the page
            li = bus.getAllBy2(" NAME ", lipa.ToArray());
            bus.CloseConnection();
            //li = li.Skip((page - 1) * pageSize).Take(pageSize).ToList();
            return(li);
        }