コード例 #1
0
ファイル: MSoLuongSuCoController.cs プロジェクト: zggcd/ITT
        public void ActionIndex(MSoLuongSuCoModel model)
        {
            if (ViewPage.CurrentPage.MenuID > 0)
            {
                MenuID = ViewPage.CurrentPage.MenuID;
            }

            var dbQuery = ModSoLuongSuCoService.Instance.CreateQuery()
                          .Where(o => o.Activity == true)
                          .Where(State > 0, o => (o.State & State) == State)
                          .WhereIn(MenuID > 0, o => o.MenuID, WebMenuService.Instance.GetChildIDForWeb_Cache("SoLuongSuCo", MenuID, ViewPage.CurrentLang.ID))
                          .OrderByDesc(o => o.Order)
                          .Take(PageSize)
                          .Skip(PageSize * model.Page);

            ViewBag.Data      = dbQuery.ToList();
            model.TotalRecord = dbQuery.TotalRecord;
            model.PageSize    = PageSize;
            ViewBag.Model     = model;
        }
コード例 #2
0
        public void ActionUpdateBaoCaoUCSC(ModBaoCaoTongHopEntity entityBc, MSoLuongSuCoModel entitySuCo, string endCode)
        {
            int userId = HL.Lib.Global.CPLogin.UserID;
            var entity = ModBaoCaoTongHopService.Instance.CreateQuery()
                        .Where(userId > 0, o => o.UserID == userId)
                        .Where(o => o.Code == endCode)
                        .ToSingle();
            if (entity != null)
            {
                DateTime date = DateTime.Now;

                entityBc.ID = entity.ID;
                entityBc.UserID = entity.UserID;
                entityBc.UserID1 = userId;
                entityBc.MenuID = entity.MenuID;
                entityBc.State = entity.State;
                entityBc.Name = entity.Name;
                entityBc.Code = entity.Code;
                entityBc.Order = entity.Order;
                entityBc.Published = entity.Published;
                entityBc.Published1 = date;
                entityBc.Activity = false;

                var lstSuCo = ModSoLuongSuCoService.Instance.CreateQuery().Where(o => o.BaoCaoTongHopID == entity.ID).ToList();
                if (lstSuCo != null) ModSoLuongSuCoService.Instance.Delete(lstSuCo);
                int c = entitySuCo.MN.Length;
                for (int i = 0; i < c; i++)
                {
                    var suCo = new ModSoLuongSuCoEntity();
                    bool flag = false;
                    if (entitySuCo.SoLuong[i] > 0)
                    {
                        suCo.SoLuong = entitySuCo.SoLuong[i];
                        flag = true;
                    }
                    if (entitySuCo.TuXuLy[i] > 0)
                    {
                        suCo.TuXuLy = entitySuCo.TuXuLy[i];
                        flag = true;
                    }
                    if (entitySuCo.ToChucHoTro[i] > 0)
                    {
                        suCo.ToChucHoTro = entitySuCo.ToChucHoTro[i];
                        flag = true;
                    }
                    if (entitySuCo.ToChucNuocNgoaiHoTro[i] > 0)
                    {
                        suCo.ToChucNuocNgoaiHoTro = entitySuCo.ToChucNuocNgoaiHoTro[i];
                        flag = true;
                    }
                    if (entitySuCo.DeNghi[i] > 0)
                    {
                        suCo.DeNghi = entitySuCo.DeNghi[i];
                        flag = true;
                    }
                    if (entitySuCo.ThietHaiUocTinh[i] > 0)
                    {
                        suCo.ThietHaiUocTinh = entitySuCo.ThietHaiUocTinh[i];
                        flag = true;
                    }
                    if (flag == true)
                    {
                        int id = ModBaoCaoTongHopService.Instance.Save(entityBc);
                        suCo.BaoCaoTongHopID = id;
                        suCo.MenuID = entitySuCo.MN[i];
                        suCo.Published = date;
                        suCo.Order = GetMaxOrder_SoSuCo();
                        suCo.Activity = true;

                        ModSoLuongSuCoService.Instance.Save(suCo);
                    }
                }

                ViewBag.BaoCao = entityBc;

                ViewPage.Alert("Cập nhật báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
                ViewPage.Navigate("/vn/Thanh-vien/DS-bc-tong-hop-su-co.aspx");
            }
        }
コード例 #3
0
        public void ActionAddBCTongHopUCSC(ModBaoCaoTongHopEntity entity, MSoLuongSuCoModel entitySuCo)
        {
            ViewBag.BaoCao = entity;

            DateTime date = DateTime.Now;
            string   code = "BCTHSC" + ModBaoCaoTongHopService.Instance.GetMaxID();

            entity.Name      = code;
            entity.Code      = Data.GetCode(code);
            entity.UserID    = Lib.Global.CPLogin.UserID;
            entity.Order     = GetMaxOrder_BCTongHop();
            entity.Published = date;
            entity.Activity  = false;

            int c = entitySuCo.MN.Length;

            for (int i = 0; i < c; i++)
            {
                var  suCo = new ModSoLuongSuCoEntity();
                bool flag = false;
                if (entitySuCo.SoLuong[i] > 0)
                {
                    suCo.SoLuong = entitySuCo.SoLuong[i];
                    flag         = true;
                }
                if (entitySuCo.TuXuLy[i] > 0)
                {
                    suCo.TuXuLy = entitySuCo.TuXuLy[i];
                    flag        = true;
                }
                if (entitySuCo.ToChucHoTro[i] > 0)
                {
                    suCo.ToChucHoTro = entitySuCo.ToChucHoTro[i];
                    flag             = true;
                }
                if (entitySuCo.ToChucNuocNgoaiHoTro[i] > 0)
                {
                    suCo.ToChucNuocNgoaiHoTro = entitySuCo.ToChucNuocNgoaiHoTro[i];
                    flag = true;
                }
                if (entitySuCo.DeNghi[i] > 0)
                {
                    suCo.DeNghi = entitySuCo.DeNghi[i];
                    flag        = true;
                }
                if (entitySuCo.ThietHaiUocTinh[i] > 0)
                {
                    suCo.ThietHaiUocTinh = entitySuCo.ThietHaiUocTinh[i];
                    flag = true;
                }
                if (flag == true)
                {
                    int id = ModBaoCaoTongHopService.Instance.Save(entity);
                    suCo.BaoCaoTongHopID = id;
                    suCo.MenuID          = entitySuCo.MN[i];
                    suCo.Published       = date;
                    suCo.Order           = GetMaxOrder_SoSuCo();
                    suCo.Activity        = true;

                    ModSoLuongSuCoService.Instance.Save(suCo);
                }
            }

            ViewPage.Alert("Tạo mới báo cáo thành công! Chúng tôi sẽ xem xét và phê duyệt báo cáo của bạn sớm nhất có thể.");
            ViewPage.Navigate("/vn/Thanh-vien/DS-bc-tong-hop-su-co.aspx");
        }