コード例 #1
0
    public void FetchDoctorList()
    {
        DataSet dsDoctor;

        System.Data.SqlClient.SqlCommand cmdSelect = new System.Data.SqlClient.SqlCommand();

        gClass.MakeStoreProcedureName(ref cmdSelect, "sp_Doctors_LoadData", false);
        cmdSelect.Parameters.Add("@OrganizationCode", System.Data.SqlDbType.Int).Value = Convert.ToInt32(gClass.OrganizationCode);
        if (this.blnIsSurgeon.HasValue)
        {
            cmdSelect.Parameters.Add("@vblnIsSurgeon", System.Data.SqlDbType.Bit).Value = this.blnIsSurgeon.Value;
        }

        if (this.blnIsHide.HasValue)
        {
            cmdSelect.Parameters.Add("@vblnIsHide", System.Data.SqlDbType.Bit).Value = this.blnIsHide.Value;
        }
        dsDoctor = gClass.FetchData(cmdSelect, "tblSurgon");

        for (int Xh = 0; Xh < dsDoctor.Tables["tblSurgon"].Rows.Count; Xh++)
        {
            dsDoctor.Tables["tblSurgon"].Rows[Xh]["Doctor_Name"] = dsDoctor.Tables["tblSurgon"].Rows[Xh]["Doctor_Name"].ToString().Replace("`", "'");
        }
        dsDoctor.AcceptChanges();

        DoctorsList.DataSource     = dsDoctor;
        DoctorsList.DataMember     = "tblSurgon";
        DoctorsList.DataValueField = "DoctorID";
        DoctorsList.DataTextField  = "Doctor_Name";
        try { DoctorsList.DataBind(); }catch { }
        DoctorsList.Items.Insert(0, new ListItem("Select ...", "0"));
        return;
    }
コード例 #2
0
        //Submit Add Form
        protected void AddDoctorButton_Click(object sender, EventArgs e)
        {
            Button btn   = (Button)sender;
            String btnId = btn.ID;

            if (btnId.Equals("AddDoctorButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var name     = NameTextBox.Text;
                    var gender   = GenderRadioButtonList1.SelectedItem.Value;
                    var genderId = long.Parse(gender);
                    var dob      = Convert.ToDateTime(DOBTextBox.Text);
                    var address  = AddressTextBox.Text;
                    var license  = LicenseTextBox.Text;

                    var doctor = new Doctor()
                    {
                        doctorName = name, genderId = genderId, dob = dob, address = address, license = license
                    };
                    _dataContext.Doctors.InsertOnSubmit(doctor);
                    _dataContext.SubmitChanges();
                    DoctorsList.DataBind();

                    ResetInputField();

                    //Use For checking Data
                    //Debug.WriteLine("name: " + name);
                    //Debug.WriteLine("gender: " + gender);
                    //Debug.WriteLine("dob: " + dob);
                    //Debug.WriteLine("address: " + address);
                    //Debug.WriteLine("license: " + license);
                }
                else if (btnId.Equals("ResetDoctorButton"))
                {
                    ResetInputField();
                }
            }
        }