示例#1
0
        public OperateResult UpdateMedicine(MedicineView view, string account)
        {
            if (view.Id < 1)
            {
                return(new OperateResult()
                {
                    Code = 500, Message = "选定的药品无效,请重新选择"
                });
            }
            var medicine = _context.Medicines.Find(view.Id);

            medicine.Name            = view.Name;
            medicine.Code            = view.Code;
            medicine.UpdateTime      = DateTime.Now;
            medicine.Updator         = account;
            medicine.DateinProduced  = view.DateinProduced;
            medicine.EndTime         = view.EndTime;
            medicine.ExpirationDate  = view.ExpirationDate;
            medicine.Inventory.Total = view.InventoryNum ?? medicine.Inventory.Total;
            try
            {
                _context.SaveChanges();
                return(new OperateResult());
            }
            catch (Exception e)
            {
                return(new OperateResult()
                {
                    Code = 500, Message = e.Message
                });
            }
        }
示例#2
0
        public ActionResult AssignMedicinetoDepartment()
        {
            string medicineString = Request["selectedMedicine"].ToString();

            string[]     medicineArray = medicineString.Split(',');
            MedicineView medicine      = new MedicineView();

            medicine.Name             = medicineArray[0];
            medicine.Quantity         = Convert.ToInt32(medicineArray[1]);
            medicine.batchNumber      = Convert.ToString(medicineArray[2]);
            medicine.EntryDate        = medicineArray[3] + "," + medicineArray[4];
            medicine.ExpiryDate       = medicineArray[5] + "," + medicineArray[6];
            medicine.medicineID       = Convert.ToInt32(medicineArray[7]);
            medicine.AvaiableQuantity = Convert.ToInt32(medicineArray[8]);
            return(View(medicine));
        }
        internal List <MedicineView> GetMedicine(int center_id)
        {
            string query = "select tbl_medicines.name MedicineName,tbl_medicines_of_centers.quantity PresentStock from tbl_medicines join tbl_medicines_of_centers on tbl_medicines.id=tbl_medicines_of_centers.medicine_id  where tbl_medicines_of_centers.center_id='" + center_id + "'";
            List <MedicineView> medicinesList = new List <MedicineView>();

            aSqlCommand = new SqlCommand(query, aConnectionManager.GetConnection());
            SqlDataReader aSqlDataReader = aSqlCommand.ExecuteReader();

            while (aSqlDataReader.Read())
            {
                MedicineView aMedicineView = new MedicineView();
                aMedicineView.MedicineName = aSqlDataReader["MedicineName"].ToString();
                aMedicineView.PresentStock = (int)aSqlDataReader["PresentStock"];
                medicinesList.Add(aMedicineView);
            }
            aConnectionManager.CloseConnection();
            return(medicinesList);
        }
示例#4
0
        void ReleaseDesignerOutlets()
        {
            if (AlarmImageView != null)
            {
                AlarmImageView.Dispose();
                AlarmImageView = null;
            }

            if (MedicineNameLabel != null)
            {
                MedicineNameLabel.Dispose();
                MedicineNameLabel = null;
            }

            if (MedicineReminderLabel != null)
            {
                MedicineReminderLabel.Dispose();
                MedicineReminderLabel = null;
            }

            if (MedicineView != null)
            {
                MedicineView.Dispose();
                MedicineView = null;
            }

            if (SelectCheckBox != null)
            {
                SelectCheckBox.Dispose();
                SelectCheckBox = null;
            }

            if (ViewLeadingConstraint != null)
            {
                ViewLeadingConstraint.Dispose();
                ViewLeadingConstraint = null;
            }

            if (ViewLeadingConstraintToCheckBox != null)
            {
                ViewLeadingConstraintToCheckBox.Dispose();
                ViewLeadingConstraintToCheckBox = null;
            }
        }
示例#5
0
        public OperateResult AddMedicine(MedicineView view, string account)
        {
            Medicine medicine = new Medicine()
            {
                Name           = view.Name,
                Code           = view.Code,
                CreateTime     = DateTime.Now,
                Creator        = account,
                DateinProduced = view.DateinProduced,
                EndTime        = view.EndTime,
                ExpirationDate = view.ExpirationDate,
                IsDelete       = false,
                Status         = (int)EDataStatus.valid
            };

            medicine.Inventory.IsDelete   = false;
            medicine.Inventory.Status     = (int)EDataStatus.valid;
            medicine.Inventory.Total      = view.InventoryNum ?? 0;
            medicine.Inventory.Batch      = view.Batch;
            medicine.Inventory.CreateTime = DateTime.Now;
            medicine.Inventory.Creator    = account;
            _context.Medicines.Add(medicine);

            try
            {
                _context.SaveChanges();
                return(new OperateResult());
            }
            catch (Exception e)
            {
                return(new OperateResult()
                {
                    Code = 500, Message = e.Message
                });
            }
        }
示例#6
0
        void ReleaseDesignerOutlets()
        {
            if (AppointmentLoadingIndicator != null)
            {
                AppointmentLoadingIndicator.Dispose();
                AppointmentLoadingIndicator = null;
            }

            if (BackgroundToHeaderConstraint != null)
            {
                BackgroundToHeaderConstraint.Dispose();
                BackgroundToHeaderConstraint = null;
            }

            if (DateLabel != null)
            {
                DateLabel.Dispose();
                DateLabel = null;
            }

            if (HeaderView != null)
            {
                HeaderView.Dispose();
                HeaderView = null;
            }

            if (HeaderViewHeightConstraint != null)
            {
                HeaderViewHeightConstraint.Dispose();
                HeaderViewHeightConstraint = null;
            }

            if (MedicineLoadingIndicator != null)
            {
                MedicineLoadingIndicator.Dispose();
                MedicineLoadingIndicator = null;
            }

            if (MedicineNoDataCenterView != null)
            {
                MedicineNoDataCenterView.Dispose();
                MedicineNoDataCenterView = null;
            }

            if (MedicineNoDataView != null)
            {
                MedicineNoDataView.Dispose();
                MedicineNoDataView = null;
            }

            if (MedicineView != null)
            {
                MedicineView.Dispose();
                MedicineView = null;
            }

            if (NameLabel != null)
            {
                NameLabel.Dispose();
                NameLabel = null;
            }

            if (NameLeadingConstraint != null)
            {
                NameLeadingConstraint.Dispose();
                NameLeadingConstraint = null;
            }

            if (NameTopConstraint != null)
            {
                NameTopConstraint.Dispose();
                NameTopConstraint = null;
            }

            if (NextAppointmentAlertLabel != null)
            {
                NextAppointmentAlertLabel.Dispose();
                NextAppointmentAlertLabel = null;
            }

            if (NextAppointmentDateLabel != null)
            {
                NextAppointmentDateLabel.Dispose();
                NextAppointmentDateLabel = null;
            }

            if (NextAppointmentDateLabelBottomToTitleTopConstraint != null)
            {
                NextAppointmentDateLabelBottomToTitleTopConstraint.Dispose();
                NextAppointmentDateLabelBottomToTitleTopConstraint = null;
            }

            if (NextAppointmentTitleBottomToAlertTopConstraint != null)
            {
                NextAppointmentTitleBottomToAlertTopConstraint.Dispose();
                NextAppointmentTitleBottomToAlertTopConstraint = null;
            }

            if (NextAppointmentTitleLabel != null)
            {
                NextAppointmentTitleLabel.Dispose();
                NextAppointmentTitleLabel = null;
            }

            if (NextAppointmentTitleToBottomConstraint != null)
            {
                NextAppointmentTitleToBottomConstraint.Dispose();
                NextAppointmentTitleToBottomConstraint = null;
            }

            if (NextAppointmentTitleToTopConstraint != null)
            {
                NextAppointmentTitleToTopConstraint.Dispose();
                NextAppointmentTitleToTopConstraint = null;
            }

            if (NextAppointmentView != null)
            {
                NextAppointmentView.Dispose();
                NextAppointmentView = null;
            }

            if (NextAppointmentViewBottomConstraint != null)
            {
                NextAppointmentViewBottomConstraint.Dispose();
                NextAppointmentViewBottomConstraint = null;
            }

            if (NextMedicineLabel != null)
            {
                NextMedicineLabel.Dispose();
                NextMedicineLabel = null;
            }

            if (NoDataCenterView != null)
            {
                NoDataCenterView.Dispose();
                NoDataCenterView = null;
            }

            if (NoDataLeftView != null)
            {
                NoDataLeftView.Dispose();
                NoDataLeftView = null;
            }

            if (NoDataRightView != null)
            {
                NoDataRightView.Dispose();
                NoDataRightView = null;
            }

            if (VideoCallButton != null)
            {
                VideoCallButton.Dispose();
                VideoCallButton = null;
            }

            if (WelcomeLabel != null)
            {
                WelcomeLabel.Dispose();
                WelcomeLabel = null;
            }
        }
 private void UpdateDesignForSelectedState()
 {
     MedicineView.BackgroundColor = UIColor.FromRGB((byte)231, (byte)255, (byte)255);
     MedicineView.AddBorder(UIColor.FromRGB((byte)226, (byte)226, (byte)226), 20);
     MedicineView.AddShadow(UIColor.FromRGB((byte)210, (byte)210, (byte)210), 4, 2, 0);
 }
 private void UpdateDesignForNormalState()
 {
     MedicineView.BackgroundColor = UIColor.White;
     MedicineView.AddBorder(UIColor.White, 20);
     MedicineView.AddShadow(UIColor.FromRGB((byte)175, (byte)175, (byte)175), 4, 0, 0);
 }
示例#9
0
 public string UpdateMedicine(MedicineView view)
 {
     return(JsonHelper.Instance.Serialize(_medicineService.AddMedicine(view, Account)));
 }
示例#10
0
 public ActionResult AddMedicine(MedicineView medicine)
 {
     pharmacy = new Pharmacy(_userName);
     pharmacy.AddMedicine(medicine);
     return(RedirectToAction("ViewAllMedicines", "Home"));
 }