Esempio n. 1
0
        public ActionResult Edit(Price collection)
        {
            try
            { // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    // TODO: Add insert logic here

                    PriceDao  bdDao = new PriceDao();
                    UserLogin us    = (UserLogin)Session[CommonConstant.USER_SESSION];

                    collection.ModifiedDate = Hepper.GetDateServer();

                    collection.ModifiedBy = us.UserName;
                    if (bdDao.Update(collection) > 0)
                    {
                        SetAlert("Sửa thành công", "success");
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        SetAlert("Không sửa được", "danger");
                    }
                }
                return(View());
            }
            catch
            {
                SetAlert("Không sửa được", "danger");
                return(View());
            }
        }
 public ActionResult Delete(Product product)
 {
     if (((User)Session[Constants.USER_INFO]).GroupID == Constants.GROUP_ADMIM)
     {
         var pricemodel = new PriceDao().ListByProductID(product.ID);
         for (int i = 0; i < pricemodel.Count; i++)
         {
             var model = new PriceDao().Remove(pricemodel[i]);
         }
         var result = new ProductDao().Remove(product);
         if (result)
         {
             SetAlert("Xoá Product thành công", Constants.ALERTTYPE_SUCCESS);
             new LogDao().SetLog("Admin_Product_Delete", "Xoá Product thành công", ((User)Session[Constants.USER_INFO]).ID);
             return(RedirectToAction("Index", "Product"));
         }
         else
         {
             SetAlert("Xoá Product không thành công", Constants.ALERTTYPE_ERROR);
             new LogDao().SetLog("Admin_Product_Delete", "Xoá Product không thành công", ((User)Session[Constants.USER_INFO]).ID);
             return(RedirectToAction("Index", "Product"));
         }
     }
     SetAlert("Tài khoản của bạn không có quyền", Constants.ALERTTYPE_ERROR);
     new LogDao().SetLog("Admin_Product_Delete", "Tài khoản của bạn không có quyền", ((User)Session[Constants.USER_INFO]).ID);
     return(RedirectToAction("Index", "Product"));
 }
        // GET: Admin/Price
        public ActionResult Index()
        {
            SetActiveSlideBar(Constants.SLIDEBAR_AD_PRICE);
            var PriceModel = new PriceDao().ListAllPrice();

            new LogDao().SetLog("Admin_Price_Index", null, ((User)Session[Constants.USER_INFO]).ID);
            return(View(PriceModel));
        }
        public ActionResult Detail(long id)
        {
            SetActiveSlideBar(Constants.SLIDEBAR_AD_PRICE);
            var PriceModel = new PriceDao().GetDetail(id);

            new LogDao().SetLog("Admin_Price_Detail", null, ((User)Session[Constants.USER_INFO]).ID);
            return(View(PriceModel));
        }
Esempio n. 5
0
        // GET: Price/Edit/5
        public ActionResult Edit(long id)
        {
            PriceDao bdDao = new PriceDao();
            var      sl    = bdDao.FindByID(id);

            //if (sl.Status == true) { ViewBag.Status = "Kích hoạt"; }
            //else { ViewBag.Status = "Khóa"; }
            return(View(sl));
        }
Esempio n. 6
0
        public DataTable GetMutualFundList()
        {
            DataTable dtGetMutualFund = new DataTable();
            PriceDao  priceDao        = new PriceDao();

            try
            {
                dtGetMutualFund = priceDao.GetMutualFundList();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dtGetMutualFund);
        }
Esempio n. 7
0
        public DataTable GetAllScehmeList(int amcCode)
        {
            DataTable dtGetAllScehmeList = new DataTable();
            PriceDao  priceDao           = new PriceDao();

            try
            {
                dtGetAllScehmeList = priceDao.GetAllScehmeList(amcCode);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dtGetAllScehmeList);
        }
Esempio n. 8
0
        public DataSet GetSchemeListCategoryConcatenation(int amcCode, string categoryCode)
        {
            DataSet  dsGetSchemeFromOverAllCategoryList = new DataSet();
            PriceDao PriceObj = new PriceDao();

            try
            {
                dsGetSchemeFromOverAllCategoryList = PriceObj.GetSchemeFromOverAllCategoryList(amcCode, categoryCode);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dsGetSchemeFromOverAllCategoryList);
        }
Esempio n. 9
0
        public DataSet GetNavOverAllCategoryList()
        {
            DataSet  dsGetOverAllCategoryList = new DataSet();
            PriceDao PriceObj = new PriceDao();

            try
            {
                dsGetOverAllCategoryList = PriceObj.GetNavOverAllCategoryList();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dsGetOverAllCategoryList);
        }
Esempio n. 10
0
        public DataSet GetSchemeListCategorySubCategory(int amcCode, string categoryCode, string subCategory)
        {
            DataSet  dsSchemeListCategorySubCategory = new DataSet();
            PriceDao PriceObj = new PriceDao();

            try
            {
                dsSchemeListCategorySubCategory = PriceObj.GetSchemeListCategorySubCategory(amcCode, categoryCode, subCategory);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dsSchemeListCategorySubCategory);
        }
Esempio n. 11
0
        public DataSet GetFactSheetSchemeDetails(int schemePlanId, int month, int year)
        {
            DataSet  dsFactsheetschemeDetails = new DataSet();
            PriceDao PriceObj = new PriceDao();

            try
            {
                dsFactsheetschemeDetails = PriceObj.GetFactSheetSchemeDetails(schemePlanId, month, year);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dsFactsheetschemeDetails);
        }
Esempio n. 12
0
        /***********************************************Bhoopendra's code for factsheet***************************************************************/
        /// <summary>
        ///
        /// </summary>
        /// <param name="Flag"></param>
        /// <param name="StartDate"></param>
        /// <param name="EndDate"></param>
        /// <param name="Search"></param>
        /// <param name="CurrentPage"></param>
        /// <returns></returns>
        ///
        public DataTable GetMFFundPerformance(int amcCode, string subCategory)
        {
            DataTable dtMFFund = new DataTable();
            PriceDao  PriceObj = new PriceDao();

            try
            {
                dtMFFund = PriceObj.GetMFFundPerformance(amcCode, subCategory);
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dtMFFund);
        }
Esempio n. 13
0
        public DataSet BindddlMFSubCategory()
        {
            DataSet  dsGetSubCategory = new DataSet();
            PriceDao priceDao         = new PriceDao();

            try
            {
                dsGetSubCategory = priceDao.BindddlMFSubCategory();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            return(dsGetSubCategory);
        }
        public ActionResult Delete(Price price)
        {
            var result = new PriceDao().Remove(price);

            if (result)
            {
                SetAlert("Xoá Price thành công", Constants.ALERTTYPE_SUCCESS);
                new LogDao().SetLog("Admin_Price_Delete", "Xoá Price thành công", ((User)Session[Constants.USER_INFO]).ID);
                return(RedirectToAction("Index", "Price"));
            }
            else
            {
                SetAlert("Xoá Price không thành công", Constants.ALERTTYPE_ERROR);
                new LogDao().SetLog("Admin_Price_Delete", "Xoá Price không thành công", ((User)Session[Constants.USER_INFO]).ID);
            }
            return(View("Index"));
        }
Esempio n. 15
0
        public ActionResult Delete(long id)
        {
            try
            {
                // TODO: Add delete logic here

                PriceDao   bdDao = new PriceDao();
                ProjectDao prDao = new ProjectDao();
                if (prDao.FindByPrice(id).Count > 0)
                {
                    SetAlert("Đang sử dụng không được phép xóa", Common.CommonConstant.ALERT_DANGER);
                    return(RedirectToAction("Index"));
                }
                bdDao.Delete(id);
                // SetAlert("Xóa thành công", "success");
                return(RedirectToAction("Index"));
            }
            catch
            {
                // SetAlert("Không xóa được", "danger");
                return(View());
            }
        }
        public int GetAMFICountSnapshot(string Flag, String Search, int CurrentPage)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetAMFICountSnapshot(Flag, Search, CurrentPage));
        }
Esempio n. 17
0
        public int GetEquityCountSnapshot(string Flag, String Search)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetEquityCountSnapshot(Flag, Search));
        }
Esempio n. 18
0
        public int GetEquityCount(string Flag, DateTime StartDate, DateTime EndDate, String Search)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetEquityCount(Flag, StartDate, EndDate, Search));
        }
Esempio n. 19
0
        public DataSet GetEquityRecord(string Flag, DateTime StartDate, DateTime EndDate, String Search)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetEquityRecord(Flag, StartDate, EndDate, Search));
        }
Esempio n. 20
0
        public DataSet GetEquitySnapshot(string Flag, String Search)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetEquitySnapshot(Flag, Search));
        }
Esempio n. 21
0
        // GET: Price
        public ActionResult Index()
        {
            PriceDao bdDao = new PriceDao();

            return(View(bdDao.ToList()));
        }
Esempio n. 22
0
        public int GetAMFICountSnapshot(string Flag, String Search, int CurrentPage, int amfiCode, int schemeCode, int selectAllCode)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetAMFICountSnapshot(Flag, Search, CurrentPage, amfiCode, schemeCode, selectAllCode));
        }
Esempio n. 23
0
        public DataSet GetAMFISnapshot(string Flag, String Search, int amfiCode, int schemeCode, int selectAllCode, int All, string CategoryCode)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetAMFISnapshot(Flag, Search, amfiCode, schemeCode, selectAllCode, All, CategoryCode));
        }
        public int GetAMFICount(string Flag, DateTime StartDate, DateTime EndDate, String Search, int CurrentPage)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetAMFICount(Flag, StartDate, EndDate, Search, CurrentPage));
        }
Esempio n. 25
0
        public DataSet GetAMFIRecord(string Flag, DateTime StartDate, DateTime EndDate, String Search, int amfiCode, int schemeCode, int selectAllCode, int All, string CategoryCode)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetAMFIRecord(Flag, StartDate, EndDate, Search, amfiCode, schemeCode, selectAllCode, All, CategoryCode));
        }
Esempio n. 26
0
        public int GetAMFICount(string Flag, DateTime StartDate, DateTime EndDate, String Search, int CurrentPage, int amfiCode, int schemeCode, int selectAllCode)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetAMFICount(Flag, StartDate, EndDate, Search, CurrentPage, amfiCode, schemeCode, selectAllCode));
        }
        public ActionResult Edit(Product product, HttpPostedFileBase postedFile)
        {
            if (((User)Session[Constants.USER_INFO]).GroupID == Constants.GROUP_ADMIM)
            {
                product.Image = "temp";
                if (ModelState.IsValid)
                {
                    var    userinfo     = (User)Session[Constants.USER_INFO];
                    string fullfilename = "";
                    if (postedFile != null)
                    {
                        //Luu ten fie, luu y bo sung thu vien using System.IO;
                        string filename = Path.GetFileName(postedFile.FileName);
                        fullfilename = filename.Split('.')[0] + "(" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ")." + filename.Split('.')[1];
                        //Luu duong dan cua file
                        string path = Path.Combine(Server.MapPath("~/Data/ImgAuthor"), fullfilename);
                        postedFile.SaveAs(path);

                        product.Image = fullfilename;
                    }
                    if (product.ProductStatus > 0)
                    {
                        if (!string.IsNullOrEmpty(product.ProductStatus.ToString()))
                        {
                            product.PromotionPrice = product.Price - product.Price * (product.ProductStatus / 100);
                        }
                    }

                    var cate = new ProductCategoryDao().GetDetail((long)product.CategoryID);
                    product.Code       = cate.MetaTitle.ToString() + "_" + product.ID.ToString();
                    product.Image      = fullfilename;
                    product.Status     = true;
                    product.ModifiedBy = userinfo.UserName;
                    product.MetaTitle  = Unicode.RemoveUnicode(product.Name).Replace(" ", "-").Replace("&", "va").ToLower().ToString();
                    product.Tag        = Unicode.RemoveUnicode(product.Name).ToLower().ToString();
                    //product.ModifiedBy = Session[Constants.USER_USERNAME].ToString();

                    var result = new ProductDao().Update(product);

                    if (result)
                    {
                        //Cập nhật lại hình sau khi update

                        //Begin (Tạo giá)
                        var pricemodel = new PriceDao();
                        //if (pricemodel.CheckByPrice(product.ID, product.Price, product.PromotionPrice) == false)
                        //{
                        pricemodel.SetStatusFalse(product.ID);
                        var price = new Price();
                        price.PriceValue     = product.Price;
                        price.PromotionPrice = product.PromotionPrice;
                        price.Name           = product.Name;
                        price.ProductID      = product.ID;
                        price.CreatedBy      = userinfo.UserName;

                        pricemodel.Insert(price);
                        //End (Tạo giá)

                        SetAlert("Thay đổi thông tin Product thành công", Constants.ALERTTYPE_SUCCESS);
                        new LogDao().SetLog("Admin_Product_Edit", "Thay đổi thông tin Product thành công", ((User)Session[Constants.USER_INFO]).ID);
                        return(RedirectToAction("Index", "Product"));
                    }
                    else
                    {
                        SetAlert("Thay đổi thông tin Product không thành công", Constants.ALERTTYPE_ERROR);
                        new LogDao().SetLog("Admin_Product_Edit", "Thay đổi thông tin Product không thành công", ((User)Session[Constants.USER_INFO]).ID);
                        return(RedirectToAction("Index", "Product"));
                    }
                }
                else
                {
                    new LogDao().SetLog("Admin_Product_Edit", "Dữ liệu không hợp lệ", ((User)Session[Constants.USER_INFO]).ID);
                    return(View("Edit", product));
                }
            }
            SetAlert("Tài khoản của bạn không có quyền", Constants.ALERTTYPE_ERROR);
            new LogDao().SetLog("Admin_Product_Edit", "Tài khoản của bạn không có quyền", ((User)Session[Constants.USER_INFO]).ID);
            return(RedirectToAction("Index", "Product"));
        }
Esempio n. 28
0
        public DataTable GetMissingNAVSchemeList(int amcCode, string categoryCode, int schemePlancode, DateTime fromDate, DateTime toDate)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetMissingNAVSchemeList(amcCode, categoryCode, schemePlancode, fromDate, toDate));
        }
        public ActionResult Create(Product product, HttpPostedFileBase postedFile)
        {
            if (((User)Session[Constants.USER_INFO]).GroupID == Constants.GROUP_ADMIM)
            {
                if (postedFile != null)
                {
                    product.Image = "temp";
                }
                if (ModelState.IsValid)
                {
                    string path;
                    string filename     = "";
                    string fullfilename = "";
                    var    userinfo     = (User)Session[Constants.USER_INFO];
                    if (postedFile == null)
                    {
                        filename     = "computer-icons-user-profile-login-my-account-icon-png-clip-art.png"; //  lấy 1 file mặc định không thêm ảnh"
                        fullfilename = filename.Split('.')[0] + "(" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ")." + filename.Split('.')[1];
                        //postedFile.SaveAs(path);
                    }
                    else
                    {
                        //Luu ten fie, luu y bo sung thu vien using System.IO;
                        filename     = Path.GetFileName(postedFile.FileName);
                        fullfilename = filename.Split('.')[0] + "(" + DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ")." + filename.Split('.')[1];
                        //Luu duong dan cua file
                        path = Path.Combine(Server.MapPath("~/Data/ImgProduct"), fullfilename);
                        postedFile.SaveAs(path);
                    }
                    if (product.ProductStatus > 0)
                    {
                        if (!string.IsNullOrEmpty(product.ProductStatus.ToString()))
                        {
                            product.PromotionPrice = product.Price - product.Price * (product.ProductStatus / 100);
                        }
                    }

                    var cate = new ProductCategoryDao().GetDetail((long)product.CategoryID);
                    product.Code      = cate.MetaTitle.ToString() + "_" + product.ID.ToString();
                    product.Image     = fullfilename;
                    product.Status    = true;
                    product.CreatedBy = userinfo.UserName;
                    product.MetaTitle = Unicode.RemoveUnicode(product.Name).Replace(" ", "-").Replace("&", "va").ToLower().ToString();
                    product.Tag       = Unicode.RemoveUnicode(product.Name).ToLower().ToString();

                    long id = new ProductDao().Insert(product);
                    if (id > 0)
                    {
                        //Begin (Tạo giá)
                        var pricemodel = new PriceDao();
                        pricemodel.SetStatusFalse(id);
                        var price = new Price();
                        price.PriceValue     = product.Price;
                        price.PromotionPrice = product.PromotionPrice;
                        price.Name           = product.Name;
                        price.ProductID      = product.ID;
                        product.CreatedBy    = userinfo.UserName;
                        //price.CreatedBy = Session[Constants.USER_USERNAME].ToString();

                        pricemodel.Insert(price);
                        //End (Tạo giá)

                        SetAlert("Tạo Product thành công", Constants.ALERTTYPE_SUCCESS);
                        new LogDao().SetLog("Admin_Product_Create", "Tạo Product thành công", ((User)Session[Constants.USER_INFO]).ID);
                        return(RedirectToAction("Index", "Product"));
                    }
                    else
                    {
                        SetAlert("Tạo Product không thành công", Constants.ALERTTYPE_ERROR);
                        new LogDao().SetLog("Admin_Product_Create", "Tạo Product không thành công", ((User)Session[Constants.USER_INFO]).ID);
                        return(RedirectToAction("Index", "Product"));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Dữ liệu không lệ");
                    new LogDao().SetLog("Admin_Product_Create", "Dữ liệu không hợp lệ", ((User)Session[Constants.USER_INFO]).ID);
                    return(View("Create", product));
                }
            }
            SetAlert("Tài khoản của bạn không có quyền", Constants.ALERTTYPE_ERROR);
            new LogDao().SetLog("Admin_Product_Create", "Tài khoản của bạn không có quyền", ((User)Session[Constants.USER_INFO]).ID);
            return(RedirectToAction("Index", "Product"));
        }
        public DataSet GetEquitySnapshot(string Flag, String Search, int CurrentPage)
        {
            PriceDao PriceObj = new PriceDao();

            return(PriceObj.GetEquitySnapshot(Flag, Search, CurrentPage));
        }