示例#1
0
        public IHttpActionResult Query()
        {
            try
            {
                var request = Context.GetCurrentRequest();
                var siteId  = request.GetQueryInt("siteId");

                var isOrganization = request.GetPostBool("isOrganization");
                var civicName      = request.GetPostString("civicName");
                var orgName        = request.GetPostString("orgName");
                var queryCode      = request.GetPostString("queryCode");

                var dataInfo = DataDao.Query(siteId, isOrganization, civicName, orgName, queryCode);
                if (dataInfo == null)
                {
                    return(NotFound());
                }

                var fileInfoList = new List <FileInfo>();
                if (dataInfo.IsReplyFiles)
                {
                    fileInfoList = FileDao.GetFileInfoList(siteId, dataInfo.Id);
                }

                return(Ok(new
                {
                    Value = dataInfo,
                    FileInfoList = fileInfoList
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public IHttpActionResult Submit()
        {
            try
            {
                var request = Context.GetCurrentRequest();
                var siteId  = request.GetQueryInt("siteId");
                if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId))
                {
                    return(Unauthorized());
                }

                var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetPostString("contentIds"));
                var departmentId  = request.GetPostInt("departmentId");

                foreach (var contentId in contentIdList)
                {
                    DataDao.UpdateDepartmentId(siteId, contentId, departmentId);

                    LogManager.Translate(siteId, contentId, request.AdminId, departmentId);
                }

                return(Ok(new
                {
                    Value = contentIdList
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#3
0
        private static async Task <List <dynamic> > GetFundExcessReturn(string fundCode, DateTime begin, DateTime end)
        {
            var indexQuotations = DataDao.GetIndexQuotations("000985", begin, end);
            var navs            = await DataService.GetFundNavs(fundCode);

            var result = new List <dynamic>();

            while (begin <= end)
            {
                var quotations = indexQuotations.Where(x => x.Date >= begin && x.Date <= begin.AddDays(7)).ToList();
                if (!quotations.Any())
                {
                    begin = begin.AddDays(7);
                    continue;
                }

                var indexRate = quotations.Last().Close / quotations.First().Close - 1;
                var subNavs   = navs.Where(x => x.Date >= begin && x.Date <= begin.AddDays(7)).ToList();
                if (!subNavs.Any())
                {
                    begin = begin.AddDays(7);
                    continue;
                }

                dynamic excessReturn = new ExpandoObject();
                excessReturn.Begin        = begin.AddDays(1);
                excessReturn.End          = begin.AddDays(7);
                excessReturn.ExcessReturn = subNavs.Last().AccUnitNav / subNavs[0].AccUnitNav - 1 - indexRate;
                result.Add(excessReturn);

                begin = begin.AddDays(7);
            }

            return(result);
        }
示例#4
0
        public ActionResult BoXL()
        {
            var dao = new DataDao();

            ViewBag.boxl  = dao.BoXLlist();
            ViewBag.MaLSP = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "1", Text = "Điện Thoại"
                },
                new SelectListItem {
                    Value = "2", Text = "Máy Tính Để Bàn"
                },
                new SelectListItem {
                    Value = "3", Text = "Laptop"
                },
                new SelectListItem {
                    Value = "9", Text = "Tivi"
                },
                new SelectListItem {
                    Value = "10", Text = "Âm thanh"
                },
                new SelectListItem {
                    Value = "11", Text = "Khác"
                }
            }, "Value", "Text");
            return(View());
        }
示例#5
0
        public ActionResult DophanGia()
        {
            var dao = new DataDao();

            ViewBag.dophangia = dao.Dophangialist();
            ViewBag.MaLSP     = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "1", Text = "Điện Thoại"
                },
                new SelectListItem {
                    Value = "2", Text = "Máy Tính Để Bàn"
                },
                new SelectListItem {
                    Value = "3", Text = "Laptop"
                },
                new SelectListItem {
                    Value = "9", Text = "Tivi"
                },
                new SelectListItem {
                    Value = "11", Text = "Khác"
                }
            }, "Value", "Text");
            return(View());
        }
示例#6
0
        private static List <dynamic> GetStyleExcessReturn(string index, DateTime begin, DateTime end)
        {
            var indexQuotations = DataDao.GetIndexQuotations("000985", begin, end);
            var styleQuotations = DataDao.GetIndexQuotations(index, begin, end);
            var result          = new List <dynamic>();

            while (begin <= end)
            {
                var quotations = indexQuotations.Where(x => x.Date >= begin && x.Date <= begin.AddDays(7)).ToList();
                if (!quotations.Any())
                {
                    begin = begin.AddDays(7);
                    continue;
                }

                var indexRate   = quotations.Last().Close / quotations.First().Close - 1;
                var quotations2 = styleQuotations.Where(x => x.Date >= begin && x.Date <= begin.AddDays(7)).ToList();
                if (!quotations2.Any())
                {
                    break;
                }

                dynamic excessReturn = new ExpandoObject();
                excessReturn.Begin        = begin.AddDays(1);
                excessReturn.End          = begin.AddDays(7);
                excessReturn.ExcessReturn = quotations2.Last().Close / quotations2.First().Close - 1 - indexRate;
                result.Add(excessReturn);

                begin = begin.AddDays(7);
            }

            return(result);
        }
示例#7
0
        public ActionResult QuangDuong()
        {
            var dao = new DataDao();

            ViewBag.quangduong = dao.QuangDuonglist();
            ViewBag.MaLSP      = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "44", Text = "Xe Cộ - Ô Tô"
                },
                new SelectListItem {
                    Value = "46", Text = "Xe Cộ - Xe đạp"
                },
                new SelectListItem {
                    Value = "45", Text = "Xe Cộ - Xe máy"
                },
                new SelectListItem {
                    Value = "47", Text = "Xe Cộ - Phụ tùng, đồ bảo hộ"
                },
                new SelectListItem {
                    Value = "48", Text = "Xe Cộ - Xe chuyên dụng"
                },
                new SelectListItem {
                    Value = "49", Text = "Xe Cộ - Xe máy điện"
                }
            }, "Value", "Text");
            return(View());
        }
        public IHttpActionResult GetConfig()
        {
            try
            {
                var request = Context.GetCurrentRequest();
                var siteId  = request.GetQueryInt("siteId");
                if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId))
                {
                    return(Unauthorized());
                }

                var contentIdList = TranslateUtils.StringCollectionToIntList(request.GetQueryString("contentIds"));

                var dataInfoList = new List <DataInfo>();
                foreach (var contentId in contentIdList)
                {
                    var contentInfo = DataDao.GetDataInfo(contentId);
                    if (contentInfo == null)
                    {
                        continue;
                    }

                    dataInfoList.Add(contentInfo);
                }

                return(Ok(new
                {
                    Value = dataInfoList
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#9
0
        // GET: Admin/Data
        public ActionResult LoaiSanPham()
        {
            var dao = new DataDao();

            ViewBag.LSP = dao.loaiSanPhamall();
            return(View());
        }
示例#10
0
        public ActionResult Model()
        {
            var dao = new DataDao();

            ViewBag.modeles = dao.Modelslist();
            return(View());
        }
示例#11
0
        public ActionResult Mua()
        {
            var dao = new DataDao();

            ViewBag.mua   = dao.Mualist();
            ViewBag.MaLSP = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "50", Text = "Thể Thao- Máy tập thể thao"
                },
                new SelectListItem {
                    Value = "51", Text = "Thể Thao - Golf"
                },
                new SelectListItem {
                    Value = "52", Text = "Thể Thao - Cầu lông"
                },
                new SelectListItem {
                    Value = "53", Text = "Thể Thao - Bóng bàn"
                },
                new SelectListItem {
                    Value = "54", Text = "Thể Thao - Tennis"
                },
                new SelectListItem {
                    Value = "55", Text = "Thể Thao - Bóng đá"
                },
                new SelectListItem {
                    Value = "56", Text = "Thể Thao - Bơi lội"
                },
                new SelectListItem {
                    Value = "57", Text = "Thể Thao - Môn thể thao khác"
                },
                new SelectListItem {
                    Value = "58", Text = "Thời Trang - Thời trang nữ"
                },
                new SelectListItem {
                    Value = "59", Text = "Thời Trang - Giày dép nữ"
                },
                new SelectListItem {
                    Value = "60", Text = "Thời Trang - Phụ kiện nữ"
                },
                new SelectListItem {
                    Value = "61", Text = "Thời Trang - Thời trang nam"
                },
                new SelectListItem {
                    Value = "62", Text = "Thời Trang - Giày dép nam"
                },
                new SelectListItem {
                    Value = "63", Text = "Thời Trang - Phụ kiện nam"
                },
                new SelectListItem {
                    Value = "64", Text = "Thời Trang - Mỹ phẩm - làm đẹp"
                }
            }, "Value", "Text");
            return(View());
        }
        public IHttpActionResult Submit(int contentId)
        {
            try
            {
                var request = Context.GetCurrentRequest();
                var siteId  = request.GetQueryInt("siteId");
                if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId))
                {
                    return(Unauthorized());
                }

                var replyContent = request.GetPostString("replyContent");
                var fileInfoList = request.GetPostObject <List <FileInfo> >("fileInfoList");

                var fileInfoListDatabase = FileDao.GetFileInfoList(siteId, contentId);

                DataDao.UpdateStateAndReply(siteId, contentId, replyContent, fileInfoList.Count > 0);

                LogManager.Reply(siteId, contentId, request.AdminId);

                foreach (var fileInfo in fileInfoList)
                {
                    if (fileInfo.Id == 0)
                    {
                        fileInfo.SiteId = siteId;
                        fileInfo.DataId = contentId;
                        FileDao.Insert(fileInfo);
                    }
                }

                foreach (var fileInfoDatabase in fileInfoListDatabase)
                {
                    if (fileInfoList.Exists(f => f.Id == fileInfoDatabase.Id))
                    {
                        continue;
                    }

                    var filePath = Context.UtilsApi.GetUploadFilePath(siteId, fileInfoDatabase.FileName);
                    if (System.IO.File.Exists(filePath))
                    {
                        System.IO.File.Delete(filePath);
                    }
                    FileDao.Delete(fileInfoDatabase.Id);
                }

                return(Ok(new
                {
                    Value = true
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#13
0
        public ActionResult ChoNgoi()
        {
            var dao = new DataDao();

            ViewBag.chongoi = dao.ChoNgoilsit();
            ViewBag.MaLSP   = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "44", Text = "Xe Cộ - Ô Tô"
                }
            }, "Value", "Text");
            return(View());
        }
示例#14
0
        public ActionResult Case()
        {
            var dao = new DataDao();

            ViewBag.cases = dao.Caselist();
            ViewBag.MaLSP = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "2", Text = "Máy Tính Để Bàn"
                }
            }, "Value", "Text");
            return(View());
        }
示例#15
0
        public static List <FundAssetConfig> GetFundAssetConfigs(string fundCode)
        {
            var configs = DataDao.GetFundAssetConfigs(fundCode);

            if (DataHelper.IsDataReady(configs?.LastOrDefault()))
            {
                return(configs);
            }
            else
            {
                configs = EmService.GetFundAssetConfigs(fundCode);
                DataDao.UpdateFundAssetConfigs(configs);
                return(configs);
            }
        }
示例#16
0
        public static async Task <List <FundScale> > GetFundScales(string fundCode)
        {
            var scales = DataDao.GetFundScales(fundCode);

            if (DataHelper.IsDataReady(scales?.LastOrDefault()))
            {
                return(scales);
            }
            else
            {
                scales = await EmService.GetFundScales(fundCode);

                DataDao.UpdateFundScales(scales);
                return(scales);
            }
        }
示例#17
0
        public static async Task <List <IndexConstituent> > GetIndexConstituents(string indexCode)
        {
            var constituents = DataDao.GetIndexConstituents(indexCode);

            if (DataHelper.IsDataReady(constituents?.FirstOrDefault()))
            {
                return(constituents);
            }
            else
            {
                constituents = await SwService.GetIndexConstituents(indexCode);

                DataDao.UpdateIndexConstituents(constituents);
                return(constituents);
            }
        }
示例#18
0
        public static async Task <List <FundNav> > GetFundNavs(string fundCode)
        {
            var navs = DataDao.GetFundNavs(fundCode);

            if (DataHelper.IsDataReady(navs?.LastOrDefault()))
            {
                return(navs);
            }
            else
            {
                navs = await EmService.GetFundNavs(fundCode);

                DataDao.UpdateFundNavs(navs);
                return(navs);
            }
        }
示例#19
0
        public ActionResult Pin()
        {
            var dao = new DataDao();

            ViewBag.pin   = dao.Pinlist();
            ViewBag.MaLSP = new SelectList(new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "1", Text = "Điện Thoại"
                },
                new SelectListItem {
                    Value = "3", Text = "Laptop"
                },
            }, "Value", "Text");
            return(View());
        }
示例#20
0
        public static async Task <List <FundStockPosition> > GetFundStockPositions(string fundCode, DateTime date)
        {
            var positions = DataDao.GetFundStockPositions(fundCode, date);

            if (DataHelper.IsDataReady(positions?.FirstOrDefault()))
            {
                return(positions);
            }
            else
            {
                positions = await EmService.GetFundStockPositions(fundCode, date);

                DataDao.UpdateFundStockPositions(positions);
                return(positions);
            }
        }
示例#21
0
 public ActionResult DoiSx(DoiSX doiSX)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().DoiSX(doiSX);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("DoiSx", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("DoiSx"));
 }
示例#22
0
 public ActionResult KichThuoc(KichThuoc kichThuoc)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().KichThuoc(kichThuoc);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("KichThuoc", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("KichThuoc"));
 }
示例#23
0
 public ActionResult Mausac(MauSac mauSac)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().MauSac(mauSac);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("Mausac", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("Mausac"));
 }
示例#24
0
 public ActionResult HopSo(HopSo hopSo)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().Hopso(hopSo);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("HopSo", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("HopSo"));
 }
示例#25
0
 public ActionResult PhuKien(PhuKien phuKien)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().Phukien(phuKien);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("PhuKien", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("PhuKien"));
 }
示例#26
0
 public ActionResult QuangDuong(Quangduong quangduong)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().QuangDuong(quangduong);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("QuangDuong", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("QuangDuong"));
 }
示例#27
0
 public ActionResult BoXL(BoXL boXL)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().BoXL(boXL);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("BoXL", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("BoXL"));
 }
示例#28
0
 public ActionResult ChoNgoi(ChoNgoi choNgoi)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().ChoNgoi(choNgoi);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("ChoNgoi", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("ChoNgoi"));
 }
示例#29
0
 public ActionResult HedieuHanh(HeDieuHanh heDieuHanh)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().Hedieuhanh(heDieuHanh);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("HedieuHanh", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("HedieuHanh"));
 }
示例#30
0
 public ActionResult LoaiSanPham(LoaiSanPham loaiSanPham)
 {
     if (ModelState.IsValid)
     {
         bool check = new DataDao().LoaiSanPham(loaiSanPham);
         if (check)
         {
             SetAlert("thêm thành công", "success");
             return(RedirectToAction("LoaiSanPham", "Data"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm không thành công");
         }
     }
     return(View("LoaiSanPham"));
 }