Exemple #1
0
    protected void btnOk_CurrentHospital_Click(object sender, EventArgs e)
    {
        int                selectedRow_UserId;
        UserClass          uc   = new UserClass();
        UserEntryUserClass uouc = new UserEntryUserClass();
        EntryUserClass     euc  = new EntryUserClass();
        LogEntryUserClass  leuc = new LogEntryUserClass();

        String entryUserIndivFieldLog_Operation  = "Update";
        String entryUserIndivFieldLog_Field      = "entryUserContact";
        String entryUserIndivFieldLog_DataLater  = dropdownlist_Hospital.SelectedValue;
        String entryUserIndivFieldLog_DataBefore = Session["selectedRow_EntryUserHospital"].ToString();;

        /*Update Record of EntryUser's Current Hospital
         * Insert values on Log_UsersIndivField table*/
        try
        {
            selectedRow_UserId = Convert.ToInt32(Session["selectedRow_UserId"]);
            DataTable dtEntryUser = euc.SelectAllEntryUserFromUserId(selectedRow_UserId);
            if (dtEntryUser.Rows.Count > 0)
            {
                uouc.updateProfile_EntryUser_entryUserHospital(selectedRow_UserId, dropdownlist_Hospital.SelectedValue);

                int userId = Convert.ToInt32(Session["userId"]);
                leuc.insertOn_Log_EntryUserIndivField_WithUpdateOperation(entryUserIndivFieldLog_Operation,
                                                                          selectedRow_UserId, entryUserIndivFieldLog_Field, entryUserIndivFieldLog_DataBefore,
                                                                          entryUserIndivFieldLog_DataLater, userId);
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
        finally
        {
            Session["selectedRow_EntryUserHospital"] = dropdownlist_Hospital.SelectedValue;
            lblHospital.Text = dropdownlist_Hospital.SelectedValue;
            dropdownlist_Hospital.Visible = false;
            btnOk_Hospital.Visible        = false;
        }
    }