Ejemplo n.º 1
0
        public ActionResult ThongTinThemCapNhat(string Id)
        {
            var duLieuOutput = new CommonChucVu.ChucVuOutput.ThongTinChucVu();

            try
            {
                if (!string.IsNullOrEmpty(Id))
                {
                    var input = new CommonInput.DocThongTinInput {
                        Id = Id
                    };
                    var output = XuLyAPI.ApiJsonPost(APIUrl.ChucVu.DocThongTin, input) as CommonOutput;
                    if (output == null)
                    {
                        throw new Exception(ConstantValues.Message.LoiServer);
                    }
                    if (output.KetQua != 1)
                    {
                        throw new Exception(output.ThongBao);
                    }
                    duLieuOutput = JsonConvert.DeserializeObject <CommonChucVu.ChucVuOutput.ThongTinChucVu>(output.DuLieu.ToString());
                }
            }
            catch (Exception)
            {
            }
            return(PartialView("_ThemCapNhatPartial", duLieuOutput));
        }
Ejemplo n.º 2
0
        public ActionResult XuLyLuu(CommonChucVu.ChucVuInput.ThongTinChucVu input)
        {
            var model  = new CommonOutput();
            var input2 = new CommonChucVu.ChucVuOutput.ThongTinChucVu();

            ViewBag.DanhSachViTri      = StaticList.ViTriChucVus();
            ViewBag.DanhSachThuocTrang = StaticList.ThuocTrangs();
            try
            {
                input2.Id       = input.Id;
                input2.Ten      = input.Ten;
                input2.MoTa     = input.MoTa;
                input2.ThuTu    = input.ThuTu;
                input2.KichHoat = input.KichHoat;
                input2.Ma       = input.Ma;
                var url    = !string.IsNullOrEmpty(input.Id) ? APIUrl.ChucVu.Sua : APIUrl.ChucVu.Them;
                var output = XuLyAPI.ApiJsonPost(url, input) as CommonOutput;
                if (output == null)
                {
                    throw new Exception(ConstantValues.Message.LoiServer);
                }
                if (output.KetQua == 1)
                {
                    model.KetQua   = 1;
                    model.ThongBao = ConstantValues.Message.ThanhCong;
                    ViewBag.KetQua = 1;
                    return(PartialView("_ThemCapNhatPartial", new CommonChucVu.ChucVuOutput.ThongTinChucVu()));
                }
                else
                {
                    return(PartialView("_ThemCapNhatPartial", input2));
                }
            }
            catch (Exception ex)
            {
                model.KetQua   = 0;
                model.ThongBao = ConstantValues.Message.ThatBai;
                return(PartialView("_ThemCapNhatPartial", input2));
            }
        }