示例#1
0
        public ActionResult Edit(string makh)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            KeHoachServices           serKeHoach            = new KeHoachServices();
            TaiKhoanServices          serTaiKhoan           = new TaiKhoanServices();
            StringBuilder             sbHeHoach             = new StringBuilder();
            StringBuilder             sbNguoiThucHien       = new StringBuilder();
            List <KeHoachForCombobox> lstKeHoachForCombobox = serKeHoach.SelectKeHoachForCombobox(new KeHoachModels());
            var keHoachGroup =
                from p in lstKeHoachForCombobox
                where p.makehoachgoc == "0"
                select p;

            foreach (var item in keHoachGroup)
            {
                string strPref = "";
                sbHeHoach.Append(string.Format("<option value='{0}'>{1}</option>", item.maKeHoach, item.noidungmuctieu));
                var subItem =
                    from p in lstKeHoachForCombobox
                    where p.makehoachgoc == item.maKeHoach
                    select p;
                if (subItem.Count() > 0)
                {
                    sbHeHoach.Append(PrefAppendCombobox(lstKeHoachForCombobox, item.maKeHoach, ref strPref));
                }
            }

            foreach (var item in serTaiKhoan.SelectTaiKhoanForCombobox(new M_TaiKhoan()))
            {
                sbNguoiThucHien.Append(string.Format("<option value='{0}'>{1}</option>", item.mataikhoan, item.hoten));
            }
            ViewBag.keHoachs       = sbHeHoach.ToString();
            ViewBag.nguoiThucHiens = sbNguoiThucHien.ToString();

            #region Set Param
            M_KeHoach param        = new M_KeHoach();
            string    strMaKeHoach = "0";
            if (makh != "0" && makh != null)
            {
                FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkeyEncodeLink.config"));
                strMaKeHoach = AES.DecryptText(makh, function.ReadXMLGetKeyEncrypt());
            }
            if (GetPhongBanDonVi() != null)
            {
                param.madonvi   = GetPhongBanDonVi().madonvi;
                param.makehoach = strMaKeHoach;
            }
            #endregion
            makehoach = strMaKeHoach;
            KeHoachServices      service   = new KeHoachServices();
            List <KeHoachModels> lstResult = service.SelectRows(param);
            if (lstResult.Count > 0)
            {
                return(View(lstResult[0]));
            }
            return(View());
        }
示例#2
0
        public ActionResult Create()
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            KeHoachServices           serKeHoach            = new KeHoachServices();
            TaiKhoanServices          serTaiKhoan           = new TaiKhoanServices();
            StringBuilder             sbHeHoach             = new StringBuilder();
            StringBuilder             sbNguoiThucHien       = new StringBuilder();
            List <KeHoachForCombobox> lstKeHoachForCombobox = serKeHoach.SelectKeHoachForCombobox(new KeHoachModels());
            var keHoachGroup =
                from p in lstKeHoachForCombobox
                where p.makehoachgoc == "0"
                select p;

            foreach (var item in keHoachGroup)
            {
                string strPref = "";
                sbHeHoach.Append(string.Format("<option value='{0}'>{1}</option>", item.maKeHoach, item.noidungmuctieu));
                var subItem =
                    from p in lstKeHoachForCombobox
                    where p.makehoachgoc == item.maKeHoach
                    select p;
                if (subItem.Count() > 0)
                {
                    sbHeHoach.Append(PrefAppendCombobox(lstKeHoachForCombobox, item.maKeHoach, ref strPref));
                }
            }

            foreach (var item in serTaiKhoan.SelectTaiKhoanForCombobox(new M_TaiKhoan()))
            {
                sbNguoiThucHien.Append(string.Format("<option value='{0}'>{1}</option>", item.mataikhoan, item.hoten));
            }
            ViewBag.keHoachs       = sbHeHoach.ToString();
            ViewBag.nguoiThucHiens = sbNguoiThucHien.ToString();
            return(View());
        }