Exemplo n.º 1
0
        public ActionResult DeleteItem(string Id)
        {
            string        ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            DocumentsType model          = new DocumentsType()
            {
                Id = Int32.Parse(MyModels.Decode(Id, API.Models.Settings.SecretId + ControllerName).ToString())
            };

            try
            {
                if (model.Id > 0)
                {
                    model.CreatedBy  = int.Parse(HttpContext.Request.Headers["Id"]);
                    model.ModifiedBy = int.Parse(HttpContext.Request.Headers["Id"]);
                    DocumentsTypeService.DeleteItem(model);
                    TempData["MessageSuccess"] = "Xóa thành công";
                    return(Json(new MsgSuccess()));
                }
                else
                {
                    TempData["MessageError"] = "Xóa Không thành công";
                    return(Json(new MsgError()));
                }
            }
            catch {
                TempData["MessageSuccess"] = "Xóa không thành công";
                return(Json(new MsgError()));
            }
        }
Exemplo n.º 2
0
        public ActionResult UpdateStatus([FromQuery] string Ids, Boolean Status)
        {
            string        ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            DocumentsType item           = new DocumentsType()
            {
                Id = Int32.Parse(MyModels.Decode(Ids, API.Models.Settings.SecretId + ControllerName).ToString()), Status = Status
            };

            try
            {
                if (item.Id > 0)
                {
                    item.CreatedBy  = int.Parse(HttpContext.Request.Headers["Id"]);
                    item.ModifiedBy = int.Parse(HttpContext.Request.Headers["Id"]);
                    dynamic UpdateStatus = DocumentsTypeService.UpdateStatus(item);
                    TempData["MessageSuccess"] = "Cập nhật Trạng Thái thành công";
                    return(Json(new MsgSuccess()));
                }
                else
                {
                    TempData["MessageError"] = "Cập nhật Trạng Thái Không thành công";
                    return(Json(new MsgError()));
                }
            }
            catch
            {
                TempData["MessageSuccess"] = "Cập nhật Trạng Thái không thành công";
                return(Json(new MsgError()));
            }
        }
Exemplo n.º 3
0
        public ActionResult SaveItem(DocumentsType model)
        {
            string             ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
            int                IdDC           = Int32.Parse(MyModels.Decode(model.Ids, API.Models.Settings.SecretId + ControllerName).ToString());
            DocumentsTypeModel data           = new DocumentsTypeModel()
            {
                Item = model
            };

            if (ModelState.IsValid)
            {
                if (model.Id == IdDC)
                {
                    model.CreatedBy  = int.Parse(HttpContext.Request.Headers["Id"]);
                    model.ModifiedBy = int.Parse(HttpContext.Request.Headers["Id"]);
                    DocumentsTypeService.SaveItem(model);
                    if (model.Id > 0)
                    {
                        TempData["MessageSuccess"] = "Cập nhật thành công";
                    }
                    else
                    {
                        TempData["MessageSuccess"] = "Thêm mới thành công";
                    }
                    return(RedirectToAction("Index"));
                }
            }
            return(View(data));
        }
Exemplo n.º 4
0
        public async Task <bool> UpdateDocumentType(DocumentsType documentype)
        {
            var currentDocumentType = await GetSpecificDocumentType(documentype.DocumentTypeId);

            currentDocumentType.DocumentType = documentype.DocumentType;
            currentDocumentType.Status       = documentype.Status;
            int rows = await _context.SaveChangesAsync();

            return(rows > 0);
        }
Exemplo n.º 5
0
        //zwolnienie
        public Document(int iId, Patient iPatient, DocumentsType iDocType, DateTime iExemptionFrom, DateTime iExemptionTo, string iExemptionNumber, string iCompanyName, string iOddzialNFZ)
        {
            Id = iId;
            Pat = iPatient;
            DocType = iDocType;
            ExemptionFrom = iExemptionFrom;
            ExemptionTo = iExemptionTo;
            ExemptionsNumber = iExemptionNumber;
            CompanyName = iCompanyName;
            OddzialNFZ = iOddzialNFZ;

            /////
            MedicamentsList = new List<Medicament>();
        }
Exemplo n.º 6
0
        public FileContentResult Index(string title)
        {
            byte[]        data;
            string        basedpath       = Server.MapPath("/Documents/");
            string        temp            = title.Replace("-", "_");
            string        displayfilename = temp + ".pdf";
            DocumentsType doctype         = (DocumentsType)Enum.Parse(typeof(DocumentsType), temp);
            string        filename        = doctype == DocumentsType.Terms_and_Conditions ? "tc_16105D23-086E-4F61-B0C2-6E858C1C6D4F.pdf" : "pp_EEF86C55-0B07-430C-9A7F-D3C81D350B3A.pdf";

            try
            {
                FileStream stream = new FileStream(basedpath + @"\" + filename, FileMode.Open, FileAccess.Read);
                data = new byte[stream.Length];
                stream.Read(data, 0, data.Length);
                string mimeType = "application/pdf";
                Response.AppendHeader("Content-Disposition", "inline; filename=" + displayfilename);
                stream.Close();
                return(File(data, mimeType));
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Exemplo n.º 7
0
 //recepta
 public Document(int iId, Patient iPatient, DocumentsType iDocType, List<Medicament> iMedicamentsList)
 {
     Id = iId;
     Pat = iPatient;
     DocType = iDocType;
     //MedicamentsList = new List<Medicaments>();
     MedicamentsList = iMedicamentsList;
     ExemptionFrom = DateTime.Now;
     ExemptionTo = new DateTime(1990, 01, 01);
     ExemptionsNumber = "None";
     CompanyName = "None";
     OddzialNFZ = "Brak";
 }
Exemplo n.º 8
0
 public async Task InsertDocumentType(DocumentsType documentype)
 {
     _context.DocumentType.Add(documentype);
     await _context.SaveChangesAsync();
 }
        public async Task <bool> Update(DocumentsType documentype)
        {
            await _documentsTypesRepository.UpdateDocumentType(documentype);

            return(true);
        }
 public async Task Add(DocumentsType doctype)
 {
     await _documentsTypesRepository.InsertDocumentType(doctype);
 }