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;
        }
    }
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        try
        {
            /*Check normal conditions*/
            /*Passwords matching checking*/
            if (txtboxPassword.Text != txtboxConfirmPassword.Text)
            {
                ltrMessage.Text = "The Passwords did not match!";
            }

            /*2 emails matching checking*/
            else if (txtboxEmail.Text == txtboxSecEmail.Text)
            {
                ltrMessage.Text = "The 2 Email addresses you provided should not be same!";
            }

            /*2 contacts matching checking*/
            else if (txtboxContact.Text == txtboxSecContact.Text)
            {
                ltrMessage.Text = "The 2 Contact Numbers you provided should not be same!";
            }

            else
            {
                ltrMessage.Text = "";

                /*Putting Country as Nepal by default*/
                String country;
                if (txtboxCountry.Text == "")
                {
                    country = "Nepal";
                    //Console.WriteLine("Went to this condition!");
                }
                else
                {
                    country = txtboxCountry.Text;
                }

                UserEntryUserClass ueuc = new UserEntryUserClass();
                LogUserClass       luc  = new LogUserClass();
                LogEntryUserClass  leuc = new LogEntryUserClass();

                String entryUserDesignation = txtboxDesignation.Text;

                String entryUserHospital = dropdownlist_Hospital.SelectedValue;
                dropdownlist_Hospital.Items.Insert(0, entryUserHospital);

                int    entryUserRegisteredby     = Convert.ToInt32(Session["userId"]);;
                String entryUserInactiveOrActive = "Active";

                ueuc.RegisterEntryUser_Users(txtboxUsername.Text, txtboxPassword.Text, txtboxEmail.Text, txtboxSecEmail.Text);
                ueuc.RegisterEntryUser_EntryUser(entryUserDesignation,
                                                 entryUserHospital, entryUserRegisteredby, entryUserInactiveOrActive, txtboxUsername.Text, txtboxFirstName.Text, txtboxMiddleName.Text, txtboxLastName.Text, txtboxDob.Text, dropdownlistGender.Text, txtboxContact.Text, txtboxSecContact.Text, txtboxHouseAdd.Text, txtboxDistrict.Text, txtboxCity.Text, country);

                String username = txtboxUsername.Text;

                luc.insertOn_Log_UsersWholeField_WithInsertOperation(username);
                leuc.insertOn_Log_EntryUserWholeField_WithInsertOperation(username);

                Response.Redirect("EntryUserForm_OtherUserMaster.aspx");
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }