Пример #1
0
    protected void rptMedicine_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "IsDeleted")
        {
            int inlProdId = Convert.ToInt32(e.CommandArgument);
            lblId.Text        = Convert.ToString(inlProdId);
            mNewsEventContext = new HMSDataContext();

            tblPatientMedicineMapping loDelete = mNewsEventContext.tblPatientMedicineMappings.Where(c => c.inPatientMedicineMappingId == inlProdId).FirstOrDefault();
            mNewsEventContext.tblPatientMedicineMappings.DeleteOnSubmit(loDelete);
            mNewsEventContext.SubmitChanges();
            Common.CommonFunction.showMsg("Patient medicine has been deleted successfully.", this.Page);
            bindPatientMedicine(Convert.ToInt32(ddlPatients.SelectedValue));
        }
    }
Пример #2
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         mNewsEventContext = new HMSDataContext();
         tblPatientMedicineMapping loMedicine = new tblPatientMedicineMapping();
         loMedicine.inPatientId  = Convert.ToInt32(ddlPatients.SelectedValue);
         loMedicine.inMedicineId = Convert.ToInt32(ddlMedicine.SelectedValue);
         loMedicine.dtGivenDate  = DateTime.Now;
         mNewsEventContext.tblPatientMedicineMappings.InsertOnSubmit(loMedicine);
         mNewsEventContext.SubmitChanges();
         ClearControl();
         bindPatientMedicine(Convert.ToInt32(ddlPatients.SelectedValue));
         //mvProduct.ActiveViewIndex = 1;
         Common.CommonFunction.showMsg("Medicine has been added to the patient.", this.Page);
     }
 }