//protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    //{
    //    if (e.Row.RowType == DataControlRowType.DataRow)
    //    {
    //        // Click to highlight row
    //        Button lnkSelect = (Button)e.Row.FindControl("lnkSelect");
    //        if (lnkSelect != null)
    //        {
    //            lnkSelect.Attributes.Add("onclick", "javascript:return deleteConfirm('" + Session["selectedRow_HospitalName"].ToString() + "')");
    //        }
    //    }
    //}
    //protected void lnkSelect_Click(object sender, EventArgs e)
    //{

    //}
    protected void btnOk_Click(object sender, EventArgs e)
    {
        try
        {
            int              hospitalId;
            HospitalClass    hc  = new HospitalClass();
            LogHospitalClass lhc = new LogHospitalClass();

            /*Delete Hospital's record
             * Insert values on Log_HospitalWholeFieldWithName table*/
            /*Getting HospitalId from HospitalName table*/
            DataTable dt = hc.SelectAllHospitalFromHospitalFullName(Session["selectedRow_HospitalName"].ToString());
            if (dt.Rows.Count > 0)
            {
                Session["hospitalId"] = dt.Rows[0]["hospitalId"].ToString();
                hospitalId            = Convert.ToInt32(Session["hospitalId"]);

                lhc.insertOn_Log_HospitalWholeFieldWithName_WithDeleteOperation(Session["selectedRow_HospitalName"].ToString());
                hc.delete_hospitalFrom_hospitalId(hospitalId);
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
        finally
        {
            //Session["selectedRow_HospitalName"] = txtboxName.Text;
            ltrDelMsg.Visible = false;
            btnOk.Visible     = false;
            loadData();
        }
    }
Exemplo n.º 2
0
    protected void btnOk_Address_Click(object sender, EventArgs e)
    {
        if (txtboxHouseAdd.Text != lblHouseAdd.Text ||
            txtboxDistrict.Text != lblDistrict.Text ||
            txtboxCity.Text != lblCity.Text)
        {
            try
            {
                int              hospitalId;
                HospitalClass    hc  = new HospitalClass();
                LogHospitalClass lhc = new LogHospitalClass();

                String hospitalIndivFieldLog_Operation = "Update";
                String hospitalIndivFieldLog_Field     = "hospitalAddress";
                String hospitalIndivFieldLog_DataLater = txtboxHouseAdd.Text
                                                         + "; " + txtboxDistrict.Text
                                                         + "; " + txtboxCity.Text;
                String hospitalIndivFieldLog_DataBefore = lblHouseAdd.Text
                                                          + "; " + lblDistrict.Text
                                                          + "; " + lblCity.Text;;

                /*Update Hospital's Address on Hospital table
                 * Insert values on Log_HospitalIndivField table*/
                /*Getting HospitalId from HospitalName table*/
                DataTable dt = hc.SelectAllHospitalFromHospitalFullName(Session["selectedRow_HospitalName"].ToString());
                if (dt.Rows.Count > 0)
                {
                    Session["hospitalId"] = dt.Rows[0]["hospitalId"].ToString();
                    hospitalId            = Convert.ToInt32(Session["hospitalId"]);

                    hc.update_hospitalAddressFrom_hospitalId(hospitalId, txtboxHouseAdd.Text,
                                                             txtboxDistrict.Text, txtboxCity.Text);
                    lhc.insertOn_Log_HospitalIndivField_WithUpdateOperation(hospitalIndivFieldLog_Operation,
                                                                            hospitalId, hospitalIndivFieldLog_Field, hospitalIndivFieldLog_DataBefore,
                                                                            hospitalIndivFieldLog_DataLater);
                }
            }
            catch (Exception ex)
            {
                ltrMessage.Text = ex.Message;
            }
            finally
            {
                Session["selectedRow_HospitalHouseAddress"] = txtboxHouseAdd.Text;
                Session["selectedRow_HospitalDistrict"]     = txtboxDistrict.Text;
                Session["selectedRow_HospitalCity"]         = txtboxCity.Text;
                lblHouseAdd.Text       = txtboxHouseAdd.Text;
                lblDistrict.Text       = txtboxDistrict.Text;
                lblCity.Text           = txtboxCity.Text;
                txtboxHouseAdd.Visible = false;
                txtboxDistrict.Visible = false;
                txtboxCity.Visible     = false;
                btnOk_Address.Visible  = false;
            }
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            ltrMessage.Text = "";
            //ltrMessageGreen.Text = "";

            HospitalClass    hc  = new HospitalClass();
            LogHospitalClass lhc = new LogHospitalClass();

            /*Current date and time calculated*/
            String   currentDateNTimeString;
            DateTime currentDateNTime = DateTime.Now;
            currentDateNTimeString = currentDateNTime.ToString("dd/MM/yyyy hh:mm:ss tt");

            String hospitalFullName, hospitalType, hospitalHouseAdd, hospitalDistrict, hospitalCity, hospitalDescrip;
            int    hospitalRegdBy;

            hospitalFullName = txtboxName.Text;
            hospitalType     = dropdownlistType.SelectedValue;
            hospitalHouseAdd = txtboxHouseAdd.Text;
            hospitalDistrict = txtboxDistrict.Text;
            hospitalCity     = txtboxCity.Text;
            hospitalDescrip  = txtboxDescrip.Text;

            /*Getting userId from Session*/
            String userIdString = Session["userId"].ToString();
            int    userId       = Convert.ToInt32(userIdString);

            hospitalRegdBy = userId;

            /*Inserting and putting the values in Log*/
            hc.InsertHospital(hospitalFullName, hospitalType, hospitalHouseAdd, hospitalDistrict,
                              hospitalCity, hospitalDescrip, hospitalRegdBy);
            lhc.insertOn_Log_HospitalWholeField_WithInsertOperation(hospitalFullName);

            Response.Redirect("Hospital_OtherUserMaster.aspx");
            txtboxName.Text = "";
            dropdownlistType.SelectedValue = "";
            txtboxHouseAdd.Text            = "";
            txtboxDistrict.Text            = "";
            txtboxCity.Text    = "";
            txtboxDescrip.Text = "";

            //ltrMessageGreen.Text = "Record added!";
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }
Exemplo n.º 4
0
    protected void btnOk_Type_Click(object sender, EventArgs e)
    {
        if (dropdownlistType.SelectedValue != lblType.Text)
        {
            try
            {
                int              hospitalId;
                HospitalClass    hc  = new HospitalClass();
                LogHospitalClass lhc = new LogHospitalClass();

                String hospitalIndivFieldLog_Operation  = "Update";
                String hospitalIndivFieldLog_Field      = "hospitalType";
                String hospitalIndivFieldLog_DataLater  = dropdownlistType.SelectedValue;
                String hospitalIndivFieldLog_DataBefore = lblType.Text;

                /*Update Hospital's Type on Hospital table
                 * Insert values on Log_HospitalIndivField table*/
                /*Getting HospitalId from HospitalName table*/
                DataTable dt = hc.SelectAllHospitalFromHospitalFullName(Session["selectedRow_HospitalName"].ToString());
                if (dt.Rows.Count > 0)
                {
                    Session["hospitalId"] = dt.Rows[0]["hospitalId"].ToString();
                    hospitalId            = Convert.ToInt32(Session["hospitalId"]);

                    hc.update_hospitalTypeFrom_hospitalId(hospitalId, dropdownlistType.Text);
                    lhc.insertOn_Log_HospitalIndivField_WithUpdateOperation(hospitalIndivFieldLog_Operation,
                                                                            hospitalId, hospitalIndivFieldLog_Field, hospitalIndivFieldLog_DataBefore,
                                                                            hospitalIndivFieldLog_DataLater);
                }
            }
            catch (Exception ex)
            {
                ltrMessage.Text = ex.Message;
            }
            finally
            {
                Session["selectedRow_HospitalType"] = dropdownlistType.SelectedValue;
                lblType.Text             = dropdownlistType.SelectedValue;
                dropdownlistType.Visible = false;
                btnOk_Type.Visible       = false;
            }
        }
    }