예제 #1
0
        public static Response SaveAttachment(PatientHistoryModel history)
        {
            try
            {
                using (MySqlConnection conn = ConecctionModel.conn)
                {
                    conn.Open();
                    int idresult = 0;

                    string SP = AppManagement.SP_Save_Patient_Attachments;

                    MySqlCommand cmd = new MySqlCommand(SP, conn);
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@pidentification", history.Identification);
                    cmd.Parameters.AddWithValue("@pnote", history.Note);
                    cmd.Parameters.AddWithValue("@pphoto", history.Photo);

                    cmd.ExecuteNonQuery();


                    return(new Response {
                        IsSuccessful = true, ResponseMessage = AppManagement.MSG_SaveAttachment_Success
                    });
                }
            }
            catch (Exception ex)
            {
                return(new Response {
                    IsSuccessful = false, ResponseMessage = AppManagement.MSG_SaveAttachment_FailureDefault
                });
            }
        }
예제 #2
0
        public static ResponseHistoriesList GetAllHistories(PatientHistoryModel history)
        {
            List <PatientHistoryModel> histories = new List <PatientHistoryModel>();

            using (MySqlConnection conn = ConecctionModel.conn)
            {
                conn.Open();
                string       SP  = AppManagement.SP_GetAll_Histories;
                MySqlCommand cmd = new MySqlCommand(SP, conn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@pidentification", history.Identification);
                cmd.Parameters.AddWithValue("@pDate", history.Date);

                MySqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    PatientHistoryModel _history = new PatientHistoryModel();
                    _history.IdHistory      = Convert.ToInt32(rdr["id_history"].ToString());
                    _history.Identification = rdr["id_patient"].ToString();
                    _history.Note           = rdr["note"].ToString();
                    if (!(rdr["date"] is DBNull))
                    {
                        _history.Date = Convert.ToDateTime(rdr["date"]);
                    }
                    _history.Photo = rdr["photo"].ToString();

                    histories.Add(_history);
                }

                rdr.Close();

                return(new ResponseHistoriesList {
                    IsSuccessful = true, ResponseMessage = AppManagement.MSG_GetAllHistories_Success, ResponseHistories = histories
                });
            }
        }