protected void btCreateNewHCP_Click(object sender, EventArgs e)
        {
            if (ModelState.IsValid)
            {
                HealthCareProviderBO         HealthCareProviderBO  = new HealthCareProviderBO();
                DataLayer.HealthCareProvider newHealthCareProvider = new DataLayer.HealthCareProvider();
                string hcpFirstName = txtHCPFirstName.Text.Trim();
                if (!string.IsNullOrEmpty(hcpFirstName))
                {
                    newHealthCareProvider.FirstName          = hcpFirstName;
                    newHealthCareProvider.LastName           = txtHCPLastName.Text.Trim();
                    newHealthCareProvider.Speciality         = txtHCPSpeciality.Text.Trim();
                    newHealthCareProvider.RegistrationNumber = txtHCPRegistrationNumber.Text.Trim();
                    newHealthCareProvider.Active             = cbHCPActive.Checked;
                    newHealthCareProvider.DateEntered        = DateTime.Now;
                    newHealthCareProvider.UserIdEntered      = 0;
                    newHealthCareProvider.Username           = txtHCPUserName.Text.Trim();
                    newHealthCareProvider.Password           = txtHCPPassword.Text.Trim();

                    HealthCareProviderBO.Add(newHealthCareProvider);
                    HealthCareProviderBO.Save();
                    txtHCPFirstName.Text = "";
                    cbHCPActive.Checked  = false;
                    string msg = string.Format("HealthCareProvider {0} created.", hcpFirstName);

                    Response.Redirect("~/HealthCareProvider/HealthCareProviderList.aspx?msg=" + msg);
                }
                else
                {
                    string str = string.Format("Description field Can't be empty.");
                    lblMsg.Text = str;
                    return;;
                }
            }
        }
Beispiel #2
0
        protected void btUpdateHCP_Click(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                HealthCareProviderBO         HealthCareProviderBO   = new HealthCareProviderBO();
                DataLayer.HealthCareProvider editHealthCareProvider = new DataLayer.HealthCareProvider();

                int HealthCareProviderId = Convert.ToInt32(Session["PrimaryKeyHealthCareProvider"]);

                editHealthCareProvider = HealthCareProviderBO.Get(HealthCareProviderId);
                if (editHealthCareProvider == null)
                {
                    string str = string.Format("Note Type with Id {0} not found for Update.", HealthCareProviderId);
                    lblMsg.Text = str;
                    return;
                }

                string hcpFirstName = txtHCPFirstName.Text.Trim();
                if (!string.IsNullOrEmpty(hcpFirstName))
                {
                    editHealthCareProvider.FirstName     = hcpFirstName;
                    editHealthCareProvider.Active        = cbHCPActive.Checked;
                    editHealthCareProvider.DateEntered   = DateTime.Now;
                    editHealthCareProvider.UserIdEntered = 0;

                    HealthCareProviderBO.Edit(editHealthCareProvider);
                    HealthCareProviderBO.Save();
                    txtHCPFirstName.Text = "";
                    cbHCPActive.Checked  = false;


                    string msg = string.Format("HealthCareProvider {0} Updated.", hcpFirstName);

                    Response.Redirect("~/HealthCareProviderPages/HealthCareProviderList.aspx?msg=" + msg);
                }
                else
                {
                    string str = string.Format("First Name field Can't be empty.");
                    lblMsg.Text = str;
                    return;
                }
            }
        }