Exemplo n.º 1
0
 public static MedicineTimenDate GetMedicineTimenDateByID(int id)
 {
     MedicineTimenDate medicineTimenDate = new MedicineTimenDate();
     SqlMedicineTimenDateProvider sqlMedicineTimenDateProvider = new SqlMedicineTimenDateProvider();
     medicineTimenDate = sqlMedicineTimenDateProvider.GetMedicineTimenDateByID(id);
     return medicineTimenDate;
 }
Exemplo n.º 2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (ddlExistingRecord.SelectedValue != "0")
        {
            string DateRange = " and MedicineDate >= '" + DateTime.Parse(ddlExistingRecord.SelectedValue) + "' and MedicineDate <= '" + DateTime.Parse(ddlExistingRecord.SelectedValue).AddMinutes(1) + "'";
            MedicineTimenDateManager.DeleteMedicineTimenDateByResidentID(int.Parse(Request.QueryString["ResidentID"]), DateRange);
        }
        foreach (GridViewRow gvr in gvMedicaiton.Rows)
        {
            CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect");
            if (chkSelect.Checked)
            {
                TextBox           txtComment        = (TextBox)gvr.FindControl("txtComment");
                MedicineTimenDate medicineTimenDate = new MedicineTimenDate();

                medicineTimenDate.MedicationTimeID = Int32.Parse(chkSelect.ValidationGroup);
                medicineTimenDate.MedicineDate     = ddlExistingRecord.SelectedValue == "0" ? DateTime.Now : DateTime.Parse(ddlExistingRecord.SelectedValue);
                medicineTimenDate.ExtraField1      = txtComment.Text;
                medicineTimenDate.ExtraField2      = getLogin().LoginID.ToString();
                medicineTimenDate.ExtraField3      = getLogin().ExtraField4;
                MedicineTimenDateManager.InsertMedicineTimenDate(medicineTimenDate);
            }
        }

        lblMsg.Visible = true;
        lblNewMedicationAddedSuccessfully.Visible = false;


        loadMedicineTimenDateDate();
        foreach (GridViewRow gvr in gvMedicaiton.Rows)
        {
            CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect");
            chkSelect.Checked = false;
        }
    }
Exemplo n.º 3
0
    public static MedicineTimenDate GetMedicineTimenDateByID(int id)
    {
        MedicineTimenDate            medicineTimenDate            = new MedicineTimenDate();
        SqlMedicineTimenDateProvider sqlMedicineTimenDateProvider = new SqlMedicineTimenDateProvider();

        medicineTimenDate = sqlMedicineTimenDateProvider.GetMedicineTimenDateByID(id);
        return(medicineTimenDate);
    }
Exemplo n.º 4
0
    private void showMedicineTimenDateData()
    {
        MedicineTimenDate medicineTimenDate = new MedicineTimenDate();

        medicineTimenDate = MedicineTimenDateManager.GetMedicineTimenDateByID(Int32.Parse(Request.QueryString["medicineTimenDateID"]));

        ddlMedicationTime.SelectedValue = medicineTimenDate.MedicationTimeID.ToString();
        txtMedicineDate.Text            = medicineTimenDate.MedicineDate;
    }
Exemplo n.º 5
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        MedicineTimenDate medicineTimenDate = new MedicineTimenDate();

        medicineTimenDate.MedicationTimeID = Int32.Parse(ddlMedicationTime.SelectedValue);
        medicineTimenDate.MedicineDate     = txtMedicineDate.Text;
        int resutl = MedicineTimenDateManager.InsertMedicineTimenDate(medicineTimenDate);

        Response.Redirect("AdminMedicineTimenDateDisplay.aspx");
    }
Exemplo n.º 6
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        MedicineTimenDate medicineTimenDate = new MedicineTimenDate();

        medicineTimenDate = MedicineTimenDateManager.GetMedicineTimenDateByID(Int32.Parse(Request.QueryString["medicineTimenDateID"]));
        MedicineTimenDate tempMedicineTimenDate = new MedicineTimenDate();

        tempMedicineTimenDate.MedicineTimenDateID = medicineTimenDate.MedicineTimenDateID;

        tempMedicineTimenDate.MedicationTimeID = Int32.Parse(ddlMedicationTime.SelectedValue);
        tempMedicineTimenDate.MedicineDate     = txtMedicineDate.Text;
        bool result = MedicineTimenDateManager.UpdateMedicineTimenDate(tempMedicineTimenDate);

        Response.Redirect("AdminMedicineTimenDateDisplay.aspx");
    }
Exemplo n.º 7
0
    public bool UpdateMedicineTimenDate(MedicineTimenDate medicineTimenDate)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_UpdateMedicineTimenDate", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MedicineTimenDateID", SqlDbType.Int).Value = medicineTimenDate.MedicineTimenDateID;
            cmd.Parameters.Add("@MedicationTimeID", SqlDbType.Int).Value    = medicineTimenDate.MedicationTimeID;
            cmd.Parameters.Add("@MedicineDate", SqlDbType.DateTime).Value   = medicineTimenDate.MedicineDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
Exemplo n.º 8
0
    public int InsertMedicineTimenDate(MedicineTimenDate medicineTimenDate)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_InsertMedicineTimenDate", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MedicineTimenDateID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@MedicationTimeID", SqlDbType.Int).Value        = medicineTimenDate.MedicationTimeID;
            cmd.Parameters.Add("@MedicineDate", SqlDbType.DateTime).Value       = medicineTimenDate.MedicineDate;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value        = medicineTimenDate.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value        = medicineTimenDate.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value        = medicineTimenDate.ExtraField3;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return((int)cmd.Parameters["@MedicineTimenDateID"].Value);
        }
    }
Exemplo n.º 9
0
    public MedicineTimenDate GetMedicineTimenDateFromReader(IDataReader reader)
    {
        try
        {
            MedicineTimenDate medicineTimenDate = new MedicineTimenDate
                                                  (
                (int)reader["MedicineTimenDateID"],
                (int)reader["MedicationTimeID"],
                (DateTime)reader["MedicineDate"]
                                                  );
            try { medicineTimenDate.ExtraField1 = reader["ExtraField1"].ToString(); }
            catch (Exception ex) { }
            try { medicineTimenDate.ExtraField2 = reader["ExtraField2"].ToString(); }
            catch (Exception ex) { }
            try { medicineTimenDate.ExtraField3 = reader["ExtraField3"].ToString(); }
            catch (Exception ex) { }

            return(medicineTimenDate);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
Exemplo n.º 10
0
 public static bool UpdateMedicineTimenDate(MedicineTimenDate medicineTimenDate)
 {
     SqlMedicineTimenDateProvider sqlMedicineTimenDateProvider = new SqlMedicineTimenDateProvider();
     return sqlMedicineTimenDateProvider.UpdateMedicineTimenDate(medicineTimenDate);
 }
Exemplo n.º 11
0
 public static int InsertMedicineTimenDate(MedicineTimenDate medicineTimenDate)
 {
     SqlMedicineTimenDateProvider sqlMedicineTimenDateProvider = new SqlMedicineTimenDateProvider();
     return sqlMedicineTimenDateProvider.InsertMedicineTimenDate(medicineTimenDate);
 }
Exemplo n.º 12
0
    public static bool UpdateMedicineTimenDate(MedicineTimenDate medicineTimenDate)
    {
        SqlMedicineTimenDateProvider sqlMedicineTimenDateProvider = new SqlMedicineTimenDateProvider();

        return(sqlMedicineTimenDateProvider.UpdateMedicineTimenDate(medicineTimenDate));
    }
Exemplo n.º 13
0
    public static int InsertMedicineTimenDate(MedicineTimenDate medicineTimenDate)
    {
        SqlMedicineTimenDateProvider sqlMedicineTimenDateProvider = new SqlMedicineTimenDateProvider();

        return(sqlMedicineTimenDateProvider.InsertMedicineTimenDate(medicineTimenDate));
    }
Exemplo n.º 14
0
    public bool UpdateMedicineTimenDate(MedicineTimenDate medicineTimenDate)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_UpdateMedicineTimenDate", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MedicineTimenDateID", SqlDbType.Int).Value = medicineTimenDate.MedicineTimenDateID;
            cmd.Parameters.Add("@MedicationTimeID", SqlDbType.Int).Value = medicineTimenDate.MedicationTimeID;
            cmd.Parameters.Add("@MedicineDate", SqlDbType.DateTime).Value = medicineTimenDate.MedicineDate;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Exemplo n.º 15
0
    public int InsertMedicineTimenDate(MedicineTimenDate medicineTimenDate)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_InsertMedicineTimenDate", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MedicineTimenDateID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@MedicationTimeID", SqlDbType.Int).Value = medicineTimenDate.MedicationTimeID;
            cmd.Parameters.Add("@MedicineDate", SqlDbType.DateTime).Value = medicineTimenDate.MedicineDate;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = medicineTimenDate.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = medicineTimenDate.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = medicineTimenDate.ExtraField3;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return (int)cmd.Parameters["@MedicineTimenDateID"].Value;
        }
    }
Exemplo n.º 16
0
    public MedicineTimenDate GetMedicineTimenDateFromReader(IDataReader reader)
    {
        try
        {
            MedicineTimenDate medicineTimenDate = new MedicineTimenDate
                (
                    (int)reader["MedicineTimenDateID"],
                    (int)reader["MedicationTimeID"],
                    (DateTime)reader["MedicineDate"]
                );
            try { medicineTimenDate.ExtraField1 = reader["ExtraField1"].ToString(); }
            catch (Exception ex) { }
            try { medicineTimenDate.ExtraField2 = reader["ExtraField2"].ToString(); }
            catch (Exception ex) { }
            try { medicineTimenDate.ExtraField3 = reader["ExtraField3"].ToString(); }
            catch (Exception ex) { }

             return medicineTimenDate;
        }
        catch(Exception ex)
        {
            return null;
        }
    }