コード例 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        MedicationTime medicationTime = new MedicationTime();

        medicationTime.TakingTime  = txtTakingTime.Text;
        medicationTime.MedicineID  = Int32.Parse(ddlMedicine.SelectedValue);
        medicationTime.ResidentID  = Int32.Parse(ddlResident.SelectedValue);
        medicationTime.Quantity    = txtQuantity.Text;
        medicationTime.Quality     = txtQuality.Text;
        medicationTime.Frequency   = txtFrequency.Text;
        medicationTime.ExtraField1 = txtExtraField1.Text;
        medicationTime.ExtraField2 = txtExtraField2.Text;
        medicationTime.AddedBy     = Int32.Parse(txtAddedBy.Text);
        medicationTime.AddedDate   = DateTime.Now;
        medicationTime.UpdateBy    = Int32.Parse(txtUpdateBy.Text);
        medicationTime.UpdateDate  = txtUpdateDate.Text;
        int resutl = MedicationTimeManager.InsertMedicationTime(medicationTime);

        Response.Redirect("AdminMedicationTimeDisplay.aspx");
    }
コード例 #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (txtNewMedicine.Text != "")
        {
            Medicine medicine = new Medicine();

            medicine.MedicineName = txtNewMedicine.Text;
            medicine.MedicineID   = MedicineManager.InsertMedicine(medicine);
            loadMedicine();
            ddlMedicine.SelectedValue = medicine.MedicineID.ToString();
        }
        if (hfMedicationTimeID.Value == "0")
        {
            //if (!txtTakingTime.Text.Contains(","))
            //{
            //    txtTakingTime.Text = txtTakingTime.Text + ",";
            //}

            //foreach (string item in txtTakingTime.Text.Split(','))
            //{
            //    if (item != "")
            //    {
            MedicationTime medicationTime = new MedicationTime();

            medicationTime.TakingTime   = chkPRN.Checked ? "PRN" : txtTakingTime.Text;
            medicationTime.MedicineID   = Int32.Parse(ddlMedicine.SelectedValue);
            medicationTime.ResidentID   = Int32.Parse(Request.QueryString["ResidentID"]);
            medicationTime.Quantity     = txtQuantity.Text;
            medicationTime.Quality      = txtQuality.Text;
            medicationTime.Frequency    = txtFrequency.Text;
            medicationTime.ExtraField1  = txtEXNo.Text;
            medicationTime.ExtraField2  = ddlRouteOfAdmin.SelectedValue;
            medicationTime.ExtraField3  = txtAmount.Text;
            medicationTime.ExtraField4  = txtpharmacyName.Text;
            medicationTime.ExtraField5  = chkAddDischargeRecord.Checked.ToString();
            medicationTime.ExtraField6  = ddlStatus.SelectedValue;
            medicationTime.ExtraField7  = "";
            medicationTime.ExtraField8  = "";
            medicationTime.ExtraField9  = "";
            medicationTime.ExtraField10 = "";
            medicationTime.AddedBy      = getLogin().LoginID;
            medicationTime.AddedDate    = DateTime.Now;
            medicationTime.UpdateBy     = getLogin().LoginID;
            medicationTime.UpdateDate   = DateTime.Now;
            int resutl = MedicationTimeManager.InsertMedicationTime(medicationTime);
            lblNewMedicationAddedSuccessfully.Text = "Added Successfully";

            //    }
            //}
        }
        else
        {
            MedicationTime medicationTime = new MedicationTime();
            medicationTime.MedicationTimeID = int.Parse(hfMedicationTimeID.Value);
            medicationTime.TakingTime       = chkPRN.Checked ? "PRN" : txtTakingTime.Text;
            medicationTime.MedicineID       = Int32.Parse(ddlMedicine.SelectedValue);
            medicationTime.ResidentID       = Int32.Parse(Request.QueryString["ResidentID"]);
            medicationTime.Quantity         = txtQuantity.Text;
            medicationTime.Quality          = txtQuality.Text;
            medicationTime.Frequency        = txtFrequency.Text;
            medicationTime.ExtraField1      = txtEXNo.Text;
            medicationTime.ExtraField2      = ddlRouteOfAdmin.SelectedValue;
            medicationTime.ExtraField3      = txtAmount.Text;
            medicationTime.ExtraField4      = txtpharmacyName.Text;
            medicationTime.ExtraField5      = chkAddDischargeRecord.Checked.ToString();
            medicationTime.ExtraField6      = ddlStatus.SelectedValue;
            medicationTime.ExtraField7      = "";
            medicationTime.ExtraField8      = "";
            medicationTime.ExtraField9      = "";
            medicationTime.ExtraField10     = "";
            medicationTime.AddedBy          = getLogin().LoginID;
            medicationTime.AddedDate        = DateTime.Now;
            medicationTime.UpdateBy         = getLogin().LoginID;
            medicationTime.UpdateDate       = DateTime.Now;

            MedicationTimeManager.UpdateMedicationTime(medicationTime);
            hfMedicationTimeID.Value = "0";
            lblNewMedicationAddedSuccessfully.Text = "Update Successfully";
        }

        lblMsg.Visible = false;
        lblNewMedicationAddedSuccessfully.Visible = true;
        //ddlMedicine.SelectedValue = "0";
        //txtTakingTime.Text = "";
        //txtQuality.Text = "";
        //txtQuantity.Text = "";
        //txtFrequency.Text = "";

        loadGrid();
    }