Пример #1
0
        public string ListDerp()
        {
            StringBuilder s       = new StringBuilder();
            int           manv    = int.Parse(CookieCls.GetMaNV());
            var           derp_nv = (from a in db.NhanViens
                                     from b in db.NhomNhanVienCTs
                                     where a.NhomNVID == b.NhomNVID && a.MaNV == manv && b.LID.Equals(lid)
                                     select new { a.NhomNVID, b.TenNhom }).SingleOrDefault();

            s.Append("<table style=width:100%><tbody>");
            s.Append("<tr style=height:30px;cursor:pointer onclick=ChonFac(\"" + derp_nv.NhomNVID + "\")>");
            s.Append("<td style=color:#A9D0F5;font-weight:bold;font-size:14px>" + derp_nv.TenNhom + "</td>");
            s.Append("</tr>");

            var derp_list = (from a in db.PhanBoPBs
                             from b in db.NhomNhanVienCTs
                             where a.NhomNVID == b.NhomNVID && a.MaNV == manv && b.LID.Equals(lid)
                             select new { b.NhomNVID, b.TenNhom });

            if (derp_list.Count() > 0)
            {
                foreach (var v in derp_list)
                {
                    s.Append("<tr style=height:30px;cursor:pointer onclick=ChonFac(\"" + v.NhomNVID + "\")>");
                    s.Append("<td style=color:#A9D0F5;font-weight:bold;font-size:14px>" + v.TenNhom + "</td>");
                    s.Append("</tr>");
                }
            }
            s.Append("</tbody></table>");
            return("" + s);
        }
Пример #2
0
 public string GetFullName()
 {
     if (CookieCls.GetMaNV() != "")
     {
         return(CookieCls.GetFullname());
     }
     return("");
 }
        public ActionResult LoadMenuVideo()
        {
            StringBuilder s    = new StringBuilder();
            string        LID  = CookieCls.GetLanguge();
            int           manv = int.Parse(CookieCls.GetMaNV());
            string        data = "";

            s.Append("<table id='listMenuVideo' width='100%' class='mytable'>");
            s.Append("<thead>");
            s.Append("<tr style='height:50px'>");
            s.Append("<td style='width:200px;text-align:left;font-size:18px'>Title</td>");
            s.Append("<td style='width:200px;text-align:left;font-size:18px'>Title Web</td>");
            s.Append("<td style='width:300px;text-align:left;font-size:18px'>Link</td>");
            s.Append("<td style='width:70px;text-align:center;font-size:18px'>Home</td>");
            s.Append("<td style='width:80px;text-align:center;font-size:18px'>Column 3</td>");
            s.Append("<td style='width:80px;text-align:center;font-size:18px'>Column 4</td>");
            s.Append("<td style='width:70px;text-align:center;font-size:18px'>Thứ tự</td>");
            s.Append("</tr>");
            s.Append("</thead>");
            s.Append("</table>");


            var dt = (from a in db.LMenuByLefts
                      where a.Display == true
                      select new { a.IDMenu, a.Title, a.Link, a.IdFc, a.DisplayHome, a.TitleWeb, a.STT, a.STTWeb }).OrderBy(x => x.STT);

            if (dt.Count() > 0)
            {
                s.Append("<div class='scrollbar' style='overflow-y:overlay;max-height:" + (AS.sHeight() - 370) + "px'>");
                s.Append("<table id='listMenuVideo' width='100%' class='mytable'>");
                foreach (var r in dt)
                {
                    string DisplayHome = r.DisplayHome == true ? " checked=checked" : "";
                    string col3        = r.IdFc == "col3" ? " checked=checked" : "";
                    string col4        = r.IdFc == "col4" ? " checked=checked" : "";
                    s.Append("<tr id='tr" + r.IDMenu + "'>");

                    s.Append("<td class='heading' style='width:200px;height:50px;'>" + r.Title + "</td>");
                    s.Append("<td class='heading' style='width:200px;height:50px;'><input class='txtn' type='text' id='txtTitle" + r.IDMenu + "' value='" + r.TitleWeb + "' onchange='UpdateTitleWeb(" + r.IDMenu + ")' style='width:90%;' /></td>");
                    s.Append("<td class='heading' style='width:300px;height:50px;'>" + r.Link + "</td>");

                    s.Append("<td style='width:70px; text-align:center;'><label class='lbcheck' style='z-index:1000'><input class='chkhidden' value='" + r.IDMenu + "' type='checkbox' " + DisplayHome + " onchange=\"CheckHome(" + r.IDMenu + ")\" id='chkHome" + r.IDMenu + "'> <span class='text'></span></label></td>");

                    s.Append("<td style='width:80px; text-align:center;'> <label class='lbcheck' style='z-index:1000'><input class='chkhidden' value='" + r.IDMenu + "' type='checkbox' " + col3 + " onchange=\"CheckColumn(" + r.IDMenu + ",3)\" id='chkColumn3" + r.IDMenu + "'> <span class='text'></span></label></td>");
                    s.Append("<td style='width:80px; text-align:center;'> <label class='lbcheck' style='z-index:1000'><input class='chkhidden' value='" + r.IDMenu + "' type='checkbox' " + col4 + " onchange=\"CheckColumn(" + r.IDMenu + ",4)\" id='chkColumn4" + r.IDMenu + "'> <span class='text'></span></label></td>");
                    s.Append("<td class='heading' style='width:70px;height:50px;'><input class='txtn' type='text' id='txtSTTWeb" + r.IDMenu + "' value='" + r.STTWeb + "' onchange='UpdateSTTWeb(" + r.IDMenu + ")' style='width:90%;' /></td>");


                    s.Append("</tr>");
                }
                s.Append("</table>");
                s.Append("</div>");
            }
            //s.Append("</table>");
            data = "" + s;
            return(Json(new { success = true, data }, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
 public string Menu()
 {
     try
     {
         if (CookieCls.GetMaNV() != "")
         {
             StringBuilder s = new StringBuilder();
             s.Append("<ul class='sidebar-menu scrollbarmenu' style='height:" + (sHeight() - 140) + "px'>");
             var dmc = (from a in db.DanhMucChas
                        from b in db.DanhMucChaCTs
                        from c in db.PhanQuyens
                        from d in db.DanhMucs
                        where a.MaDMC == b.MaDMC && b.LID.Equals(lid) && a.HienThi == true && c.MaDM == d.MaDM && d.MaDMC == a.MaDMC && c.MaNV == manv
                        // orderby a.ThuTu ascending
                        select new { a.MaDMC, b.TenDMC, a.CssClass, a.ThuTu }).Distinct().OrderBy(x => x.ThuTu);
             if (dmc.Count() > 0)
             {
                 foreach (var item in dmc)
                 {
                     s.Append("<li class='treeview active'><a ><i class='" + item.CssClass + "'></i><span>" + item.TenDMC + "</span><span class='pull-right-container'><i class='fa fa-angle-left pull-rightd'></i></span></a>");
                     s.Append("<ul class='treeview-menu' id='menu'>");
                     var dm = (from f1 in db.DanhMucs
                               from f2 in db.DanhMucCTs
                               from f3 in db.PhanQuyens
                               where f1.MaDM == f2.MaDM && f2.LID.Equals(lid) && f1.HienThi == true && f1.MaDMC == item.MaDMC && f1.MaDM == f3.MaDM && f3.MaNV == manv
                               // orderby f1.ThuTu descending
                               select new { f1.MaDM, f1.Site, f2.TenDM, f1.ThuTu }
                               ).Distinct().OrderBy(x => x.ThuTu);
                     // int cout2 = dm.Count();
                     if (dm.Count() > 0)
                     {
                         foreach (var row in dm)
                         {
                             s.Append("<li><a href='/" + row.Site + "' title='" + row.TenDM + "'><i class='fa fa-circle-o'></i>" + row.TenDM + "</a></li>");
                         }
                     }
                     s.Append("</ul>");
                 }
                 s.Append("</li></ul>");
             }
             return("" + s);
         }
     }
     catch { }
     return("");
 }
        public ActionResult ChangPass(string MatKhau_old, string MatKhau_new)
        {
            int    manv      = int.Parse(CookieCls.GetMaNV());
            string passw_old = MyClss.Encode(MatKhau_old);
            string passw_new = MyClss.Encode(MatKhau_new);
            var    checkUser = from a in db.DangNhaps
                               where a.MaNV == manv && a.Pass.Equals(passw_old)
                               select a;

            if (checkUser.Count() <= 0)
            {
                return(Json("0", JsonRequestBehavior.AllowGet));//Pass old không đúng
            }
            else
            {
                var login = db.DangNhaps.Where(a => a.MaNV == manv).SingleOrDefault();
                login.Pass = passw_new;
                db.SaveChanges();
                return(Json("1", JsonRequestBehavior.AllowGet));//Update Pass success
            }
        }
Пример #6
0
        // GET: PerSite
        public ActionResult Index()
        {
            string action = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();

            if (CookieCls.GetMaNV() == "" || CookieCls.GetMaNV() == null)
            {
                Session["WebID"] = "/" + action;
                return(PartialView(@"~/Views/Login/Index.cshtml"));
            }
            else
            {
                int    manv    = int.Parse(CookieCls.GetMaNV());
                string languge = CookieCls.GetLanguge();
                var    heading = (from a in db.DanhMucs
                                  from b in db.DanhMucCTs
                                  from c in db.DanhMucChas
                                  from d in db.DanhMucChaCTs
                                  where a.MaDM == b.MaDM && c.MaDMC == d.MaDMC && a.MaDMC == c.MaDMC && b.LID.Equals(d.LID) && b.LID.Equals(languge) && a.Site.Equals(action)
                                  select new { d.TenDMC, b.TenDM }).Distinct();
                if (heading.Count() > 0)
                {
                    ViewData["HeadingTenDM"]    = heading.SingleOrDefault().TenDM.ToUpper();
                    ViewData["HeadingTopRight"] = "<li><a><i class='fa fa-dashboard'></i>" + heading.SingleOrDefault().TenDMC + "</a></li><li class='active'>" + heading.SingleOrDefault().TenDM + "</li>";
                }
                var pq = from a in db.PhanQuyens
                         from b in db.DanhMucs
                         where a.MaDM == b.MaDM && a.MaNV == manv && b.Site.Equals(action)
                         select a;
                if (pq.Count() > 0)
                {
                    return(View());
                }
                else
                {
                    return(PartialView(@"~/Views/Home/Error404.cshtml"));
                }
            }
        }
        public async Task <ActionResult> GetAllRss(string AllNewsPaper)
        {
            string[] newspaper = AllNewsPaper.Split(',');
            int      manv      = int.Parse(CookieCls.GetMaNV());

            for (int i = 1; i < newspaper.Length; i++)
            {
                Conn.UpdateRowData("insert into mProcess(MaNV,NewspaperId,DateUpdate) values(" + manv + "," + int.Parse(newspaper[i]) + ",getdate())");

                int newspaperMenuId = int.Parse(newspaper[i]);
                var region          = from a in db.mNewspapers
                                      where a.NewspaperId == newspaperMenuId
                                      select new { a.Languge };
                var listNewspaperMenu = from a in db.mNewspaperMenus
                                        where a.NewspaperId == newspaperMenuId && a.Display == true
                                        select new { a.rssLink, a.NewspaperMenuId };
                if (region.Count() > 0)
                {
                    if (listNewspaperMenu.Count() > 0)
                    {
                        switch (region.SingleOrDefault().Languge)
                        {
                        case "Vie":
                            foreach (var item in listNewspaperMenu)
                            {
                                await Task.Run(() => rssVie.GetRSS(item.rssLink, item.NewspaperMenuId, manv));
                            }
                            break;

                        default: break;
                        }
                    }
                }
            }
            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LOAD_NHANVIEN_INSERT()
        {
            StringBuilder s    = new StringBuilder();
            string        LID  = CookieCls.GetLanguge();
            int           manv = int.Parse(CookieCls.GetMaNV());
            string        data = "";

            var loadnv = from a in db.NhanViens
                         from b in db.NhomNhanViens
                         from c in db.NhomNhanVienCTs
                         where a.NhomNVID == b.NhomNVID && b.NhomNVID == c.NhomNVID && c.LID.Equals(LID)
                         select new { a.NhomNVID, a.MaNV, a.SoThe, a.HoTen, a.GioiTinh, a.HienThi, c.TenNhom };

            if (loadnv.Count() > 0)
            {
                int stt = 1;
                foreach (var r in loadnv)
                {
                    s.Append("<tr id='tr_modal" + r.MaNV + "'>");

                    s.Append("<td style='text-align:center'>" + stt + "</td>");
                    s.Append("<td  style=''  id='mnv" + r.MaNV + "'>");
                    s.Append("<div style='' class=\"custom-select\"><select style='width:100%; height:30px' onchange=\"UpdateNV('" + r.MaNV + "')\"  id='slnhom_modal_action" + r.MaNV + "'>");
                    var derp2 = from a in db.NhomNhanVienCTs
                                from b in db.NhomNhanViens
                                where a.NhomNVID == b.NhomNVID && a.LID.Equals(LID)
                                orderby b.STT ascending
                                select new { a.NhomNVID, a.TenNhom };
                    if (derp2.Count() > 0)
                    {
                        foreach (var r2 in derp2)
                        {
                            s.Append("<option value='" + r2.NhomNVID + "' " + (r.NhomNVID == r2.NhomNVID ? "selected" : "") + ">" + r2.TenNhom + "</option>");
                        }
                    }

                    s.Append("</select></div>");
                    s.Append("</td>");

                    s.Append("<td>");
                    s.Append("<input type='text' id='txtSoThe" + r.MaNV + "' class='txtn'  onchange=\"UpdateNV('" + r.MaNV + "')\"  style='width:100%' value='" + r.SoThe + "'>");
                    s.Append("</td>");
                    s.Append("<td>");
                    s.Append("<input type='text' id='txtHoTen" + r.MaNV + "' class='txtn'  onchange=\"UpdateNV('" + r.MaNV + "')\"  style='width:100%' value='" + r.HoTen + "'>");
                    s.Append("</td>");
                    string ht    = r.HienThi == true ? " checked=checked" : "";
                    string gtnam = r.GioiTinh == 1 ? " checked=checked" : "";
                    string gtnu  = r.GioiTinh == 0 ? " checked=checked" : "";

                    var dn = from a in db.DangNhaps
                             where a.MaNV == r.MaNV && a.Allow == true
                             select a;
                    string LG = dn.Count() > 0 ? " checked=checked" : "";

                    s.Append("<td style='text-align:center;'> <div class='radio'> <label><input name='form-field-radio" + r.MaNV + "' type='radio' value='1' onchange=\"UpdateNV('" + r.MaNV + "')\"  class='colored-blue chkhidden' " + gtnam + " id='chkNam" + r.MaNV + "'><span class='text'>Nam</span>  </label> <label><input name='form-field-radio" + r.MaNV + "' type='radio' value='0' onchange=\"UpdateNV('" + r.MaNV + "')\"  class='colored-danger chkhidden' " + gtnu + "  id='chkNu" + r.MaNV + "'> <span class='text'>Nữ</span>  </label></div></td>");
                    s.Append("<td style='text-align:center'><label class='lbcheck' style='z-index:1000'><input style='z-index:1' class='chkhidden' " + LG + " type='checkbox' onchange=\"UpdateNVDangNhap('" + r.MaNV + "')\"  id='chkLogin" + r.MaNV + "'> <span class='text' style='z-index:0'></span></td>");
                    s.Append("<td  style='text-align:center;'>");

                    s.Append("<input type='button' id='delModal" + r.MaNV + "' class='imgdel'  onclick=\"DeleteNV('" + r.MaNV + "')\">");
                    s.Append("</td>");
                    s.Append("</tr>");
                    stt++;
                }
            }

            data = "" + s;
            return(Json(new { success = true, data }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LOAD_NHANVIEN_MODAL()
        {
            StringBuilder s    = new StringBuilder();
            string        LID  = CookieCls.GetLanguge();
            int           manv = int.Parse(CookieCls.GetMaNV());
            string        data = "";

            s.Append("<table class='mytable' style='width:100%;float:left'>");
            s.Append("<thead>");
            s.Append("<tr style='Height:40px'>");
            s.Append("<td style='width:40px;text-align:center'>" + AS.GetTT("tt_stt") + "</td>");
            s.Append("<td style='width:100px'>" + AS.GetTT("tt_bp") + "</td>");
            s.Append("<td style='width:100px'>" + AS.GetTT("tt_card") + "</td>");
            s.Append("<td style='width:150px'>" + AS.GetTT("tt_ht") + "</td>");
            s.Append("<td style='width:100px; text-align:center'>" + AS.GetTT("tt_sex") + "</td>");
            s.Append("<td style='width:70px; text-align:center'>" + AS.GetTT("tt_login") + "</td>");
            s.Append("<td style='text-align:center; width:50px'>#</td>");
            s.Append("</tr>");
            s.Append("<tr>");
            s.Append("<td></td>");
            s.Append("<td>");
            s.Append("<div style='width:100%' class=\"custom-select\"><select style='width:100%; height:30px;z-index:10' id='slnhom_modal' onchange='ShowDataByPage_Modal(1)'>");
            var derp = from a in db.NhomNhanVienCTs
                       from b in db.NhomNhanViens
                       where a.NhomNVID == b.NhomNVID && a.LID.Equals(LID)
                       orderby b.STT ascending
                       select new { a.NhomNVID, a.TenNhom };

            if (derp.Count() > 0)
            {
                s.Append("<option value='' class='option_empty'>Chọn bộ phận</option>");
                foreach (var r in derp)
                {
                    s.Append("<option value='" + r.NhomNVID + "'>" + r.TenNhom + "</option>");
                }
            }
            s.Append("</select></div>");
            s.Append("</td>");
            s.Append("<td><input type='text' class='cal' style='width:100%;height:30px' id='txtsothe_modal' onkeyup='ShowDataByPage_Modal(1);'></td>");
            s.Append("<td><input type='text' class='cal' style='width:100%;height:30px' id='txthoten_modal'></td>");
            s.Append("<td style='text-align:center'> <div class='radio'> <label><input name='form-field-radio' type='radio' class='colored-blue chkhidden' id='chkNam' value='1' checked='checked'>     <span class='text'>Nam</span>  &nbsp;</label><label><input name='form-field-radio' type='radio' value='0' class='colored-danger chkhidden' id='chkNu'> <span class='text'>Nữ</span>  </label></div></td>");
            s.Append("<td style='width:70px; text-align:center'><label class='lbcheck' style='z-index:1000'><input class='chkhidden' type='checkbox' checked='checked' id='chkLogin_modal'> <span class='text' style='z-index:1'></span></td>");

            s.Append("<td style='font-weight:bold;color:#69B20E;width:5%' align='center'>");
            s.Append("<input type='button' class='add2' style='cursor:pointer;border:none' id='btnInsertNV' onclick=\"InsertNV()\">");
            s.Append("</td>");
            s.Append("</tr>");
            s.Append("</thead>");

            s.Append("<tbody id='body_dsnv'>");
            var loadnv = from a in db.NhanViens
                         from b in db.NhomNhanViens
                         from c in db.NhomNhanVienCTs
                         where a.NhomNVID == b.NhomNVID && b.NhomNVID == c.NhomNVID && c.LID.Equals(LID)
                         select new { a.NhomNVID, a.MaNV, a.SoThe, a.HoTen, a.GioiTinh, a.HienThi, c.TenNhom };

            if (loadnv.Count() > 0)
            {
                int stt = 1;
                foreach (var r in loadnv)
                {
                    s.Append("<tr id='tr_modal" + r.MaNV + "'>");

                    s.Append("<td style='text-align:center'>" + stt + "</td>");
                    s.Append("<td  style=''  id='mnv" + r.MaNV + "'>");
                    s.Append("<div style='' class=\"custom-select\"><select style='width:100%; height:30px' onchange=\"UpdateNV('" + r.MaNV + "')\"  id='slnhom_modal_action" + r.MaNV + "'>");
                    var derp2 = from a in db.NhomNhanVienCTs
                                from b in db.NhomNhanViens
                                where a.NhomNVID == b.NhomNVID && a.LID.Equals(LID)
                                orderby b.STT ascending
                                select new { a.NhomNVID, a.TenNhom };
                    if (derp2.Count() > 0)
                    {
                        foreach (var r2 in derp2)
                        {
                            s.Append("<option value='" + r2.NhomNVID + "' " + (r.NhomNVID == r2.NhomNVID ? "selected" : "") + ">" + r2.TenNhom + "</option>");
                        }
                    }

                    s.Append("</select></div>");
                    s.Append("</td>");

                    s.Append("<td>");
                    s.Append("<input type='text' id='txtSoThe" + r.MaNV + "' class='txtn'  onchange=\"UpdateNV('" + r.MaNV + "')\"  style='width:100%' value='" + r.SoThe + "'>");
                    s.Append("</td>");
                    s.Append("<td>");
                    s.Append("<input type='text' id='txtHoTen" + r.MaNV + "' class='txtn'  onchange=\"UpdateNV('" + r.MaNV + "')\"  style='width:100%' value='" + r.HoTen + "'>");
                    s.Append("</td>");
                    string ht    = r.HienThi == true ? " checked=checked" : "";
                    string gtnam = r.GioiTinh == 1 ? " checked=checked" : "";
                    string gtnu  = r.GioiTinh == 0 ? " checked=checked" : "";

                    var dn = from a in db.DangNhaps
                             where a.MaNV == r.MaNV && a.Allow == true
                             select a;
                    string LG = dn.Count() > 0 ? " checked=checked" : "";

                    s.Append("<td style='text-align:center;'> <div class='radio'> <label><input name='form-field-radio" + r.MaNV + "' type='radio' value='1' onchange=\"UpdateNV('" + r.MaNV + "')\"  class='colored-blue chkhidden' " + gtnam + " id='chkNam" + r.MaNV + "'><span class='text'>Nam</span>  </label> <label><input name='form-field-radio" + r.MaNV + "' type='radio' value='0' onchange=\"UpdateNV('" + r.MaNV + "')\"  class='colored-danger chkhidden' " + gtnu + "  id='chkNu" + r.MaNV + "'> <span class='text'>Nữ</span>  </label></div></td>");
                    s.Append("<td style='text-align:center'><label class='lbcheck' style='z-index:1000'><input style='z-index:1' class='chkhidden' " + LG + " type='checkbox' onchange=\"UpdateNVDangNhap('" + r.MaNV + "')\"  id='chkLogin" + r.MaNV + "'> <span class='text' style='z-index:0'></span></td>");
                    s.Append("<td  style='text-align:center;'>");

                    s.Append("<input type='button' id='delModal" + r.MaNV + "' class='imgdel'  onclick=\"DeleteNV('" + r.MaNV + "')\">");
                    s.Append("</td>");
                    s.Append("</tr>");
                    stt++;
                }
            }
            s.Append("</tbody>");
            s.Append("</table>");

            data = "" + s;
            return(Json(new { success = true, data }, JsonRequestBehavior.AllowGet));
        }
        public ActionResult LOAD_QUYEN_BY_MANV_COPY(string sSoThe)
        {
            StringBuilder s    = new StringBuilder();
            string        LID  = CookieCls.GetLanguge();
            int           manv = int.Parse(CookieCls.GetMaNV());
            string        data = "";

            try
            {
                var varmanv = from a in db.NhanViens
                              where a.SoThe.Equals(sSoThe)
                              select new { a.MaNV };
                int mnv = varmanv.FirstOrDefault().MaNV;

                string[] clmenucha = { "bg-red", "bg-blue", "bg-purple", "bg-olive", "bg-yellow" };
                int      cha       = 0;
                var      loaddmCha = (from a in db.DanhMucChaCTs
                                      from b in db.DanhMucChas
                                      from c in db.DanhMucs
                                      from d in db.NhanVienChucNangs
                                      where a.MaDMC == b.MaDMC && b.MaDMC == c.MaDMC && c.MaDM == d.MaDM && a.LID.Equals(LID) && d.MaNV == mnv && b.HienThi == true && c.HienThi == true
                                      select new { b.MaDMC, a.TenDMC }).Distinct();
                if (loaddmCha.Count() > 0)
                {
                    s.Append("<div class='scrollbar' style='overflow-y:scroll;max-height:" + (AS.sHeight() - 300) + "px;' >");
                    s.Append("<ul class='timeline'>");
                    foreach (var r in loaddmCha)
                    {
                        s.Append("  <li class='time-label'> <span class='" + clmenucha[cha].ToString() + "'>" + r.TenDMC + "</span> </li>");
                        cha++;
                        if (cha >= clmenucha.Count())
                        {
                            cha = 0;
                        }
                        int madmc  = r.MaDMC;
                        var loadmd = (from a in db.DanhMucs
                                      from b in db.DanhMucCTs
                                      from c in db.NhanVienChucNangs
                                      from d in db.NhanViens
                                      where a.MaDM == b.MaDM && a.MaDM == c.MaDM && c.MaNV == d.MaNV && b.LID.Equals(LID) && a.MaDMC == madmc && d.MaNV == manv && a.HienThi == true
                                      orderby a.ThuTu
                                      select new { a.MaDM, a.MaDMC, a.Site, b.TenDM, a.ThuTu }).Distinct();
                        if (loadmd.Count() > 0)
                        {
                            string[] color = { "bg-blue", "bg-yellow", "bg-red", "bg-purple", "bg-olive" };
                            int      clo   = 0;
                            foreach (var r2 in loadmd)
                            {
                                s.Append("<li> <i class='fa fa-check " + color[clo].ToString() + "'></i><div class='timeline-item'><h3 class='timeline-header'><a>" + r2.TenDM + "</a></h3>");
                                clo++;
                                if (clo >= color.Count())
                                {
                                    clo = 0;
                                }
                                s.Append(" <div class='timeline-body'>");
                                int mdm    = r2.MaDM;
                                var loadcn = from a in db.DanhMucs
                                             from b in db.ChucNangs
                                             from c in db.NhanVienChucNangs
                                             where a.MaDM == b.MaDM && b.MaDM == c.MaDM && b.MaCN == c.MaCN && c.MaNV == manv && c.MaDM == mdm && b.LID.Equals(LID) && a.HienThi == true
                                             select new { a.MaDM, b.TenCN, c.MaCN };
                                if (loadcn.Count() > 0)
                                {
                                    foreach (var r3 in loadcn)
                                    {
                                        s.Append(" <label class='btn btn-border btn-lg outline'>" + r3.TenCN + "</label>");
                                    }
                                }
                                s.Append("</div>");
                            }
                            s.Append(" </div></li>");
                        }
                    }

                    s.Append("<li><i class='fa fa-clock-o bg-gray'></i></li>");
                    s.Append("</ul>");
                }


                data = "" + s;

                return(Json(new { success = true, data }, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(Json("", JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult SyncData()
        {
            StringBuilder s = new StringBuilder();

            if (ClsData.btnSync == "")
            {
                ClsData.btnSync = Conn.getInfo("select HoTen from NhanVien where MaNV=" + int.Parse(CookieCls.GetMaNV()) + "");

                if (ClsData.listRequest.Count > 0)
                {
                    string insertdata = "";
                    for (int i = 0; i < ClsData.listRequest.Count; i++)
                    {
                        insertdata += "insert into rssNews(rssID,NewspaperMenuId,Title,IconRss,IconSave,Link,[Description],Summary,rssDate,DateInput,Effect,MaNV) values(" + string.Join(",", ClsData.listRequest[i]) + "," + CookieCls.GetMaNV() + ")";
                    }
                    Conn.InsertBatch(insertdata);
                }
                ClsData.ClearArray();

                db.mProcesses.RemoveRange(db.mProcesses);
                db.SaveChanges();
                //Conn.UpdateRowData("delete from mProcess");
            }
            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
Пример #12
0
        public ActionResult ListSelected(string sID)
        {
            StringBuilder s    = new StringBuilder();
            string        LID  = CookieCls.GetLanguge();
            int           manv = int.Parse(CookieCls.GetMaNV());
            int           ID   = int.Parse(sID);
            string        data = "";
            var           dt   = (from a in db.mNewspapers
                                  from b in db.mNewspaperMenus
                                  from c in db.wNewsMenuIds
                                  where a.Display == true && a.Languge.Equals("vie") && b.Display == true && a.NewspaperId == b.NewspaperId && c.NewspaperMenuId == b.NewspaperMenuId && c.sID == ID
                                  orderby a.Stt ascending
                                  select new { a.NewspaperId, a.Title, a.Stt }).Distinct();

            string[] clmenucha = { "bg-red", "bg-blue", "bg-purple", "bg-olive", "bg-yellow" };
            int      cha       = 0;
            string   tenmenu   = (from a in db.wMenu2 where a.sID == ID select new { a.Name }).FirstOrDefault().Name.ToUpper();

            if (dt.Count() > 0)
            {
                //s.Append("<div class='scrollbar1' style='overflow-y:scroll;max-height:" + (AS.sHeight() - 300) + "px;' >");

                s.Append("<ul class=\"timeline\" >");

                foreach (var item in dt)
                {
                    int NewspaperId = item.NewspaperId;
                    s.Append("<li class=\"time-label\"> <span class=\"" + clmenucha[cha].ToString() + "\">" + item.Title + "</span> </li>");
                    cha++;
                    if (cha >= clmenucha.Count())
                    {
                        cha = 0;
                    }
                    //DataTable dt2 = Conn.getTable("select F1.NewspaperMenuId,F1.Title,(select count(*) From wNewsMenuId F2 where F2.sID='" + sID + "' and F2.NewspaperMenuId=F1.NewspaperMenuId) as Count_Menu from mNewspaperMenu F1 where F1.Display=1 and F1.NewspaperId=" + dt.Rows[i]["NewspaperId"].ToString() + " order by F1.STT");
                    var dt2 = from a in db.mNewspaperMenus
                              from b in db.wNewsMenuIds
                              where a.Display == true && a.NewspaperId == NewspaperId && b.sID == ID && a.NewspaperMenuId == b.NewspaperMenuId
                              orderby a.Stt ascending
                              select new { a.NewspaperMenuId, a.Title };

                    string[] color = { "bg-blue", "bg-yellow", "bg-red", "bg-purple", "bg-olive" };

                    int c = 0;
                    if (dt2.Count() > 0)
                    {
                        foreach (var item2 in dt2)
                        {
                            var dt3 = from a in db.wNewsMenuIds
                                      where a.sID == ID && a.NewspaperMenuId == item2.NewspaperMenuId
                                      select a;
                            string checkdemenu = dt3.Count() == 0 ? "" : " checked=checked";

                            s.Append("<li id='limn" + item2.NewspaperMenuId + "'> <i class=\"fa fa-check " + color[c].ToString() + "\"></i><div class=\"timeline-item\"><div style=\"margin:0;padding: 10px;font-size: 16px;\">" + item2.Title + "");
                            s.Append("<label class=\"lbcheck\" style=\"float: right;margin-top: 0px;\"><input type=\"checkbox\" " + checkdemenu + " id=\"idSelected" + item2.NewspaperMenuId + "\" onclick=\"CheckListSelected('" + sID + "'," + item2.NewspaperMenuId + ")\"/></label></div>");


                            c++;
                            if (c >= color.Count())
                            {
                                c = 0;
                            }
                            s.Append("</div></li>");
                        }
                    }
                }
                s.Append("<li><i class='fa fa-clock-o bg-gray'></i></li>");
                s.Append("</ul>");
                //s.Append("</div>");
            }
            else
            {
                s.Append("<strong style='color:Red; text-align:center; font-size:20px;margin-left:10px'>Chưa có trang báo</strong>");
            }
            data = "" + tenmenu + "#$%^" + s;
            return(Json(new { success = true, data }, JsonRequestBehavior.AllowGet));
        }