Esempio n. 1
0
        //Hiệu chỉnh đơn đăng ký
        public ActionResult Editforleave(string madangky)
        {
            //check login
            if (!IsLogged())
            {
                return(BackToLogin());
            }

            DanhmucServices       service            = new DanhmucServices();
            PhongBanModels        parampb            = new PhongBanModels();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();

            foreach (var item in lstResult_phongban)
            {
                sbphongban.Append(string.Format("<option value='{0}'>{1}</option>", item.maphongban, item.tenphongban));
            }
            ViewBag.sbphongban = sbphongban.ToString();

            if (madangky != "0" && madangky != null)
            {
                FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config"));
                madangky   = AES.DecryptText(madangky, function.ReadXMLGetKeyEncrypt());
                MaDangKyNP = madangky;
                AbsentModels param = new AbsentModels();
                param.manghiphep = madangky.Trim();
                AbsentServices      service_dangky   = new AbsentServices();
                List <AbsentModels> lstResult_dangky = service_dangky.SelectRows_Danhsachnghiphep_11111(param);
                if (lstResult_dangky.Count > 0)
                {
                    if (lstResult_dangky[0].duyetcap1 == "1")
                    {
                    }

                    string[] chuoi = lstResult_dangky[0].ngaysinh.Split('/');
                    if (chuoi.Length == 3)
                    {
                        lstResult_dangky[0].ngaysinh  = chuoi[0];
                        lstResult_dangky[0].thangsinh = chuoi[1];
                        lstResult_dangky[0].namsinh   = chuoi[2];
                    }
                    else if (chuoi.Length == 2)
                    {
                        lstResult_dangky[0].thangsinh = chuoi[0];
                        lstResult_dangky[0].namsinh   = chuoi[1];
                    }
                    else
                    {
                        lstResult_dangky[0].namsinh = chuoi[0];
                    }

                    if (lstResult_dangky.Count > 0)
                    {
                        return(View(lstResult_dangky[0]));
                    }
                }
            }
            return(View());
        }
        public ActionResult Createtrainning(string idmalophc)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }

            daotao_taolopModels        param         = new daotao_taolopModels();
            List <daotao_taolopModels> lstResult_lop = new List <daotao_taolopModels>();
            SaudaotaoServices          service_lop   = new SaudaotaoServices();

            param.email   = Session["thudientu"].ToString();
            lstResult_lop = service_lop.SelectRows_Laydslophoctheo_nhanvien(param);

            if (idmalophc == null)
            {
                StringBuilder sblophoc = new StringBuilder();
                sblophoc.Append(string.Format("<option value='{0}'>{1}</option>", "0", "Chọn tên lớp học"));
                foreach (var item in lstResult_lop)
                {
                    sblophoc.Append(string.Format("<option value='{0}'>{1}</option>", item.malop, item.tenlop));
                }
                ViewBag.sblophoc = sblophoc.ToString();
            }
            else
            {
                StringBuilder sblophoc = new StringBuilder();
                foreach (var item in lstResult_lop.Where(p => p.malop == int.Parse(idmalophc.Trim())))
                {
                    sblophoc.Append(string.Format("<option value='{0}'>{1}</option>", item.malop, item.tenlop));
                }
                ViewBag.sblophoc = sblophoc.ToString();
            }

            //phong ban
            PhongBanModels        parampb            = new PhongBanModels();
            DanhmucServices       service            = new DanhmucServices();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();

            foreach (var item in lstResult_phongban)
            {
                sbphongban.Append(string.Format("<option value={0}>{1}</option>", item.maphongban, item.tenphongban));
            }
            ViewBag.sbphongban = sbphongban.ToString();



            return(View());
        }
Esempio n. 3
0
        public ActionResult Vacationlist()
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            DanhmucServices       service            = new DanhmucServices();
            PhongBanModels        parampb            = new PhongBanModels();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();

            foreach (var item in lstResult_phongban)
            {
                sbphongban.Append(string.Format("<option value='{0}'>{1}</option>", item.maphongban, item.tenphongban));
            }
            ViewBag.sbphongban = sbphongban.ToString();
            return(View());
        }
        public ActionResult Index_EmployeeYear()
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            DanhmucServices service = new DanhmucServices();
            PhongBanModels  parampb = new PhongBanModels();

            lstResult_phongban = new List <PhongBanModels>();
            lstResult_phongban = service.SelectRows(parampb);
            StringBuilder sbphongban    = new StringBuilder();
            string        maphongban    = Session["maphongban"].ToString().Trim();
            string        machucdanhkpi = Session["chucdanhkpi"].ToString().Trim();
            string        pb            = "";

            if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1")
            {
                var lstpban = lstResult_phongban.Where(p => p.maphongban == maphongban).ToList();
                if (lstpban.Count() > 0)
                {
                    pb = "<option value=" + 0 + ">" + "Lựa chọn phòng ban" + "</option>";
                    pb = pb + "<option value=" + lstpban[0].maphongban + ">" + lstpban[0].tenphongban + "</option>";
                }

                foreach (var item in lstResult_phongban.Where(p => p.maphongban != maphongban))
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            else
            {
                foreach (var item in lstResult_phongban.Where(p => p.maphongban == maphongban))
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            ViewBag.sbphongban = pb.ToString();
            var lstphongban = lstResult_phongban.Where(p => p.maphongban == maphongban).ToList();

            lstphongban[0].xoa         = machucdanhkpi;
            lstphongban[0].sodienthoai = DateTime.Now.ToString("MM/yyyy");
            return(View(lstphongban[0]));
        }
        public ActionResult Index()
        {
            //check login
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            DanhmucServices       service            = new DanhmucServices();
            PhongBanModels        parampb            = new PhongBanModels();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();
            string pb        = "";
            string thudientu = Session["thudientu"].ToString().Trim();

            if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1")
            {
                //var lstpban = lstResult_phongban.Where(p => p.maphongban == maphongban).ToList();
                //if (lstpban.Count() > 0)
                //    pb = "<option value=" + lstpban[0].maphongban + ">" + lstpban[0].tenphongban + "</option>";
                //pb = pb + "<option value=0>Chọn phòng ban</option>";
                foreach (var item in lstResult_phongban)
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            else
            {
                foreach (var item in lstResult_phongban.Where(p => p.email == thudientu || p.sodienthoai == thudientu || p.ghichu == thudientu ||
                                                              p.ghichu1 == thudientu || p.ghichu2 == thudientu))
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            ViewBag.sbphongban = pb.ToString();


            //foreach (var item in lstResult_phongban.Where(p=>p.phongban_congtruong=="0"))
            //{
            //    sbphongban.Append(string.Format("<option value='{0}'>{1}</option>", item.maphongban, item.tenphongban));
            //}
            // ViewBag.sbphongban = sbphongban.ToString();
            return(View());
        }
Esempio n. 6
0
        public JsonResult SelectRows(PhongBanModels model)
        {
            PhongBanModels        param     = new PhongBanModels();
            DanhmucServices       service   = new DanhmucServices();
            List <PhongBanModels> lstResult = service.SelectRows(param);
            StringBuilder         sbResult  = new StringBuilder();
            StringBuilder         sbRows    = new StringBuilder();

            if (lstResult.Count > 0)
            {
                string strSTT = "";
                int    i      = 1;

                foreach (var item in lstResult)
                {
                    strSTT = i.ToString();

                    if (item.madonvi == "1")
                    {
                        item.tendonvi = "Công ty cổ phẩn Ricons";
                    }
                    sbRows.Append(PrepareDataJson(item, strSTT));
                    i++;
                }
                if (sbRows.Length > 0)
                {
                    sbRows.Remove(sbRows.Length - 1, 1);
                }
            }
            sbResult.Append("{");
            sbResult.Append("\"isHeader\":\"" + "111" + "\",");
            sbResult.Append("\"currentRow\":\"" + lstResult.Count + "\",");
            sbResult.Append("\"Pages\":\"" + lstResult.Count + "\",");
            if (model.maphongban != "0")
            {
                sbResult.Append("\"SubRow\":\"" + "true" + "\",");
                sbResult.Append("\"RowID\":\"" + model.maphongban + "\",");
            }
            sbResult.Append("\"data\":[" + sbRows.ToString() + "]");
            sbResult.Append("}");

            return(Json(sbResult.ToString(), JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public ActionResult Editforleave(string madangky, AbsentModels model, string luu)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }

            if (model.nghiphep == "on")
            {
                model.nghiphep = "1";
            }
            else
            {
                model.nghikhac = "0";
            }

            if (model.nghikhongluong == "on")
            {
                model.nghikhongluong = "1";
            }
            else
            {
                model.nghikhac = "0";
            }

            if (model.nghithaisan == "on")
            {
                model.nghithaisan = "1";
            }
            else
            {
                model.nghikhac = "0";
            }

            if (model.conkh == "on")
            {
                model.conkh = "1";
            }
            else
            {
                model.conkh = "0";
            }

            if (model.canhankh == "on")
            {
                model.canhankh = "1";
            }
            else
            {
                model.canhankh = "0";
            }

            if (model.chame_mat == "on")
            {
                model.chame_mat = "1";
            }
            else
            {
                model.chame_mat = "0";
            }

            if (model.ongba_mat == "on")
            {
                model.ongba_mat = "1";
            }
            else
            {
                model.ongba_mat = "0";
            }

            if (model.thangsinh.ToString() != "")
            {
                model.ngaysinh = model.ngaysinh + "/" + model.thangsinh.ToString();
            }
            if (model.namsinh.ToString() != "")
            {
                model.ngaysinh = model.ngaysinh + "/" + model.namsinh.ToString();
            }

            model.xoa        = "0";
            model.nguoitao   = int.Parse(Session["userid"].ToString());
            model.ngaytao    = "GETDATE()";
            model.manghiphep = MaDangKyNP;
            AbsentServices service = new AbsentServices();

            model.manghiphep = service.Insert_Donxinnghiphep(model);

            DanhmucServices service_pb = new DanhmucServices();
            PhongBanModels  parampb    = new PhongBanModels();

            parampb.maphongban = model.maphongban.ToString().Trim();
            List <PhongBanModels> lstResult_phongban = service_pb.SelectRows(parampb);

            if (lstResult_phongban.Count > 0)
            {
                string hotento = "";
                if (lstResult_phongban[0].hovaten.ToString() != "")
                {
                    hotento = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(lstResult_phongban[0].hovaten.ToString().Trim().ToLower());
                }
                if (lstResult_phongban[0].email.ToString().Trim() != "")
                {
                    #region
                    string mailto = lstResult_phongban[0].email.ToString().Trim();
                    model.tenphongban = lstResult_phongban[0].tenphongban.ToString().Trim();
                    string strEncryptCode = MaDangKyNP + "0070pXQSeNsQRuzoCmUYfuX/vA==6";
                    string mailcapquanly  = "";
                    if (model.machucdanh == "1" && double.Parse(model.songayxinnghi) > 2)
                    {
                        if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "1")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("1"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "2")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("2"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "3")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("3"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "4")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("4"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "5")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("5"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "6")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("6"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "7")
                        {
                            mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("7"));
                        }

                        string[] chuoitach = mailcapquanly.Split('/');
                        strEncryptCode = strEncryptCode + "&emailto=" + chuoitach[0] + "&hotento=" + chuoitach[1];
                    }
                    else if (model.machucdanh == "2")
                    {
                        if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "1")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("1"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "2")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("2"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "3")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("3"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "4")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("4"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "5")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("5"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "6")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("6"));
                        }

                        else if (lstResult_phongban[0].thuocquanly.ToString().Trim() == "7")
                        {
                            mailto = string.Format(Functiontring.ReturnStringFormatEmail("7"));
                        }

                        string[] chuoicap1 = mailto.Split('/');
                        mailto  = chuoicap1[0].Trim();
                        hotento = chuoicap1[1].Trim();

                        mailcapquanly = string.Format(Functiontring.ReturnStringFormatEmail("1")); /// Goi cho tong giam doc
                        string[] chuoitach = mailcapquanly.Split('/');
                        strEncryptCode = strEncryptCode + "&emailto=" + chuoitach[0] + "&hotento=" + chuoitach[1];
                    }
                    #endregion

                    send_Mail(strEncryptCode, mailto, "Đơn xin nghỉ phép", "Nội dung", model, hotento);
                }
                return(RedirectToAction("Vacationlist", "Absent"));
            }
            else
            {
                return(RedirectToAction("Editforleave"));
            }


            //return View();
        }
Esempio n. 8
0
        //Thêm mới đơn đăng ký
        public ActionResult Registerforleave()
        {
            //check login
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            DanhmucServices       service            = new DanhmucServices();
            PhongBanModels        parampb            = new PhongBanModels();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();

            foreach (var item in lstResult_phongban)
            {
                sbphongban.Append(string.Format("<option value='{0}'>{1}</option>", item.maphongban, item.tenphongban));
            }
            ViewBag.sbphongban = sbphongban.ToString();

            AbsentServices service_nghiphep = new AbsentServices();
            AbsentModels   param            = new AbsentModels();

            int loginid = 0;

            if (Session["userid"].ToString().Trim() != "1")
            {
                loginid = int.Parse(Session["userid"].ToString());
            }
            param.nguoitao = loginid;

            List <AbsentModels> lstResult_songaynghi = service_nghiphep.SelectRows_Danhsachnghiphep_songayphep(param);
            double songayphep = double.Parse(DateTime.Now.Month.ToString("00"));

            foreach (var item in lstResult_songaynghi)
            {
                double songayxinnghi = double.Parse(item.songayxinnghi);
                if (songayphep >= 0)
                {
                    if (item.canhankh.Trim() == "1" && songayxinnghi >= 3)
                    {
                        songayphep = songayphep + 3 - songayxinnghi;
                    }

                    else if (item.conkh.Trim() == "1" && songayxinnghi >= 1)
                    {
                        songayphep = songayphep + 1 - songayxinnghi;
                    }

                    else if (item.chame_mat.Trim() == "1" && songayxinnghi >= 3)
                    {
                        songayphep = songayphep + 3 - songayxinnghi;
                    }

                    else if (item.ongba_mat.Trim() == "1")
                    {
                        songayphep = songayphep - songayxinnghi;
                    }

                    else if (item.nghiphep.Trim() == "1" && songayphep >= 1)
                    {
                        songayphep = songayphep - songayxinnghi;
                    }
                }
            }
            if (songayphep >= 1)
            {
                songayphep = songayphep - 1;
            }
            else
            {
                songayphep = 0;
            }
            List <AbsentModels> lstsongayphep = new List <AbsentModels>();

            param = new AbsentModels();
            param.songayphepconlai = songayphep.ToString();
            lstsongayphep.Insert(0, param);
            return(View(lstsongayphep[0]));
        }
Esempio n. 9
0
        public void MailLich(string NoiDung, string path, string filename, string maphongban, int phongban_congtruong, string matuan)
        {
            string sMailGui = System.Configuration.ConfigurationManager.AppSettings["MailSend"];
            string sPass    = System.Configuration.ConfigurationManager.AppSettings["MailPass"];
            string sHost    = System.Configuration.ConfigurationManager.AppSettings["MailHost"];
            string sPort    = System.Configuration.ConfigurationManager.AppSettings["MailPort"];
            string sTieuDe  = System.Configuration.ConfigurationManager.AppSettings["ScheduleSubject"];
            string sMailTo  = System.Configuration.ConfigurationManager.AppSettings["schedulerman"];

            // gui mail

            var fromAddress = new MailAddress(sMailGui);

            string fromPassword = sPass;
            string subject      = sTieuDe;
            string body         = NoiDung;

            DanhmucServices service = new DanhmucServices();
            PhongBanModels  parampb = new PhongBanModels();
            Item_weedModels Week    = new Item_weedModels();

            List <PhongBanModels>  lstResult_phongban;
            List <Item_weedModels> lstResult_Item_weedModels;
            List <PhongBanModels>  y = null;
            List <Item_weedModels> z = null;
            var lstcaptrentt         = y;
            var lstweekitemtt        = z;

            lstResult_Item_weedModels = service.SelectRows_giaovien(Week);
            lstweekitemtt             = lstResult_Item_weedModels.Where(x => x.matuan == matuan).ToList();

            if (phongban_congtruong == 0)
            {
                lstResult_phongban = service.SelectRows(parampb);
                lstcaptrentt       = lstResult_phongban.Where(p => p.maphongban == maphongban).ToList();
                if (lstcaptrentt[0].email.ToString().Trim() == null)
                {
                    sMailTo = "*****@*****.**";
                }
                else
                {
                    sMailTo = lstcaptrentt[0].email;
                }
            }
            else
            {
                lstResult_phongban = service.SelectRows2(parampb);
                lstcaptrentt       = lstResult_phongban.Where(p => p.maphongban == maphongban).ToList();
                if (lstcaptrentt[0].email.ToString().Trim() == null)
                {
                    sMailTo = "*****@*****.**";
                }
                else
                {
                    sMailTo = lstcaptrentt[0].email;
                }
            }

            var toAddress = new MailAddress(sMailTo);

            var smtp = new SmtpClient
            {
                Host                  = sHost,
                Port                  = int.Parse(sPort),
                EnableSsl             = false,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
            };

            //var smtp = new SmtpClient();

            subject = "NEWTECONS WEEKLY REPORT: " + lstcaptrentt[0].tenphongban;
            body    = "<p>Kính gửi Ban Tổng Giám Đốc Công ty Newtecons,</p><p>" + lstcaptrentt[0].tenphongban + " xin phép gửi báo cáo tuần: " + lstweekitemtt[0].tentuan + ". Vui lòng xem file đính kèm.</p>" + "<p>Trân trọng,</p>";

            using (var message = new MailMessage(fromAddress, toAddress)
            {
                IsBodyHtml = true,
                Subject = subject,
                Body = body
            })
            {
                try
                {
                    Attachment data = new Attachment(path, MediaTypeNames.Application.Octet);
                    message.Attachments.Add(data);
                    if (!string.IsNullOrEmpty(lstcaptrentt[0].sodienthoai))
                    {
                        message.CC.Add(lstcaptrentt[0].sodienthoai);
                    }

                    if (!string.IsNullOrEmpty(lstcaptrentt[0].ghichu))
                    {
                        message.CC.Add(lstcaptrentt[0].ghichu);
                    }

                    if (!string.IsNullOrEmpty(lstcaptrentt[0].ghichu1))
                    {
                        message.CC.Add(lstcaptrentt[0].ghichu1);
                    }

                    if (!string.IsNullOrEmpty(lstcaptrentt[0].ghichu2))
                    {
                        message.CC.Add(lstcaptrentt[0].ghichu2);
                    }

                    smtp.Send(message);
                    smtp.Dispose();
                }
                catch (SmtpFailedRecipientsException ex)
                {
                    for (int i = 0; i < ex.InnerExceptions.Length; i++)
                    {
                        SmtpStatusCode status = ex.InnerExceptions[i].StatusCode;
                        if (status == SmtpStatusCode.MailboxBusy || status == SmtpStatusCode.MailboxUnavailable)
                        {
                            // Console.WriteLine("Delivery failed - retrying in 5 seconds.");
                            System.Threading.Thread.Sleep(5000);
                            smtp.Send(message);
                        }
                        else
                        {
                            //  Console.WriteLine("Failed to deliver message to {0}", ex.InnerExceptions[i].FailedRecipient);
                            throw ex;
                        }
                    }
                }
                catch (Exception ex)
                {
                    //  Console.WriteLine("Exception caught in RetryIfBusy(): {0}",ex.ToString());
                    throw ex;
                }
                finally
                {
                    smtp.Dispose();
                }
            }
        }
        public ActionResult Edit(string macuochop)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            Item_weedModels        param          = new Item_weedModels();
            DanhmucServices        service        = new DanhmucServices();
            List <Item_weedModels> lstResult_Tuan = service.SelectRows_giaovien(param);
            StringBuilder          sbtuan         = new StringBuilder();

            foreach (var item in lstResult_Tuan)
            {
                item.tentuan = item.tentuan + "   " + item.tungay + " - " + item.denngay;
                sbtuan.Append(string.Format("<option value='{0}'>{1}</option>", item.matuan, item.tentuan));
            }
            ViewBag.sbtuan = sbtuan.ToString();

            //phong ban
            PhongBanModels        parampb            = new PhongBanModels();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();
            string pb         = "";
            string maphongban = Session["maphongban"].ToString().Trim();

            if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1")
            {
                pb = pb + "<option value=0>Chọn phòng ban</option>";
                foreach (var item in lstResult_phongban)
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            else
            {
                foreach (var item in lstResult_phongban.Where(p => p.maphongban == maphongban))
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            ViewBag.sbphongban = pb.ToString();

            StringBuilder sbphonghop = new StringBuilder();

            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "0", "Lựa chọn Phòng họp"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "1", "Tầng 3 - Phòng họp 1"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "2", "Tầng 3 - Phòng họp 2"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "3", "Tầng 3 - Phòng họp lớn"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "4", "Tầng 3A - Phòng họp nhỏ"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "5", "Tầng 3A - Phòng họp lớn"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "6", "Khác"));
            ViewBag.sbphonghop = sbphonghop.ToString();

            FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config"));

            macuochop = AES.DecryptText(macuochop, function.ReadXMLGetKeyEncrypt());
            DaotaoServices           servicevpp = new DaotaoServices();
            List <WeedMeetingModels> lstResult  = new List <WeedMeetingModels>();

            lstResult = servicevpp.SelectRows_WeedMeeting_hieuchinh(macuochop);
            if (lstResult.Count > 0)
            {
                //replace(/'/g, "daunhaydon").replace(/"/g, '').replace(/&/g, 'daukytuva') + "',";
                lstResult[0].lydobuoihop     = lstResult[0].lydobuoihop.Replace("daunhaydon", "'").Replace("daukytuva", "&");
                lstResult[0].thanhphanthamdu = lstResult[0].thanhphanthamdu.Replace("daunhaydon", "'").Replace("daukytuva", "&");

                //System.Text.RegularExpressions.Regex.Replace(json["noidungcuochop"].ToString().Trim(), @"\n", "\\n").Replace("'", "");
                string   chuoinoidungs  = "";
                string   chuoinoidung   = System.Text.RegularExpressions.Regex.Replace(lstResult[0].noidungcuochop, @"\\n", "\n");
                string[] noisungcuochop = chuoinoidung.Split(new char[] { '\n' });
                for (int i = 0; i < noisungcuochop.Length; i++)
                {
                    chuoinoidungs = chuoinoidungs + noisungcuochop[i].Replace("daunhaydon", "'").Replace("daukytuva", "&") + Environment.NewLine;
                }
                lstResult[0].noidungcuochop = chuoinoidungs;
                return(View(lstResult[0]));
            }

            return(View());
        }
        ///Thêm mới lịch họp tuần

        public ActionResult Create()
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            Item_weedModels        param          = new Item_weedModels();
            DanhmucServices        service        = new DanhmucServices();
            List <Item_weedModels> lstResult_Tuan = service.SelectRows_giaovien(param);
            StringBuilder          sbtuan         = new StringBuilder();

            foreach (var item in lstResult_Tuan)
            {
                item.tentuan = item.tentuan + "   " + item.tungay + " - " + item.denngay;
                sbtuan.Append(string.Format("<option value='{0}'>{1}</option>", item.matuan, item.tentuan));
            }
            ViewBag.sbtuan = sbtuan.ToString();

            //phong ban
            PhongBanModels        parampb            = new PhongBanModels();
            List <PhongBanModels> lstResult_phongban = service.SelectRows(parampb);
            StringBuilder         sbphongban         = new StringBuilder();
            string pb         = "";
            string maphongban = Session["maphongban"].ToString().Trim();

            if (Session["loginid"].ToString().Trim().ToLower() == "admin" || Session["grouptk"].ToString().Trim() == "1")
            {
                pb = pb + "<option value=0>Chọn phòng ban</option>";
                foreach (var item in lstResult_phongban)
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            else
            {
                foreach (var item in lstResult_phongban.Where(p => p.maphongban == maphongban))
                {
                    pb = pb + "<option value=" + item.maphongban + "> " + item.tenphongban + " </option>";
                }
            }
            ViewBag.sbphongban = pb.ToString();

            StringBuilder sbphonghop = new StringBuilder();

            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "0", "Lựa chọn Phòng họp"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "1", "Tầng 3 - Phòng họp 1"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "2", "Tầng 3 - Phòng họp 2"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "3", "Tầng 3 - Phòng họp lớn"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "4", "Tầng 3A - Phòng họp nhỏ"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "5", "Tầng 3A - Phòng họp lớn"));
            sbphonghop.Append(string.Format("<option value={0}>{1}</option>", "6", "Khác"));
            ViewBag.sbphonghop = sbphonghop.ToString();

            StringBuilder sbloaibaocao = new StringBuilder();

            sbloaibaocao.Append(string.Format("<option value={0}>{1}</option>", "1", "Báo cáo tuần CHT/TPB"));
            //sbloaibaocao.Append(string.Format("<option value={0}>{1}</option>", "2", "Báo cáo tuần Thiết Bị"));
            //sbloaibaocao.Append(string.Format("<option value={0}>{1}</option>", "3", "Báo cáo tuần HSSE"));
            //sbloaibaocao.Append(string.Format("<option value={0}>{1}</option>", "4", "Báo cáo tuần QAQC"));
            //sbloaibaocao.Append(string.Format("<option value={0}>{1}</option>", "5", "Báo cáo tuần MEP"));
            ViewBag.sbloaibaocao = sbloaibaocao.ToString();

            return(View());
        }