protected void btn_AppointmentSaveAppoint_Click(object sender, EventArgs e)
    {
        try
        {
            DataSet ds_AppoInfo;
            objPatient          = new Base_BLL_Patient();
            objPatient.FullName = txtPatient_Name.Text;

            if (rdo_new.Checked)
            {
                objPatient.IsNew = 1;
            }
            else
            {
                objPatient.IsNew = 0;
            }

            if (rdo_local.Checked)
            {
                objPatient.IsLocalite = 1;
            }
            else
            {
                objPatient.IsLocalite = 0;
            }



            DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
            dtfi.ShortDatePattern = "dd-MM-yyyy";
            dtfi.DateSeparator    = "-";
            DateTime objDate = Convert.ToDateTime(txt_appointmentDate.Text, dtfi);


            objPatient.AppointmentDate = objDate.ToString("MM-dd-yyyy");
            ds_AppoInfo = objPatient.InsertAndAppoint();
            if (ds_AppoInfo != null && ds_AppoInfo.Tables[0].Rows.Count > 0)
            {
                lbl_INFO_PatientId.Text   = ds_AppoInfo.Tables[0].Rows[0]["Patient_ID"].ToString();
                lbl_INFO_Patientname.Text = ds_AppoInfo.Tables[0].Rows[0]["FullName"].ToString();
                lbl_INFO_TockenNo.Text    = ds_AppoInfo.Tables[0].Rows[0]["Tocken_No"].ToString();
                lbl_INFO_appoDate.Text    = txt_appointmentDate.Text;
                lbl_INFO_appTime.Text     = ds_AppoInfo.Tables[0].Rows[0]["ApproxTime"].ToString();
                lbl_INFO_fees.Text        = ds_AppoInfo.Tables[0].Rows[0]["Fees"].ToString();

                uc_error.ErrorMessage = "Appointment Saved Succesffully";
                uc_error.IsError      = false;
            }
            ClearControl();

            ScriptManager.RegisterStartupScript(this, this.GetType(), "Close", "ClearValues();", true);
        }
        catch (Exception ex)
        {
            uc_error.ErrorMessage = "Error: " + ex.Message + " Please Contact System Administrator!";
            uc_error.IsError      = true;
        }
    }
示例#2
0
    protected void btn_AppointmentSaveAppoint_Click(object sender, EventArgs e)
    {
        try
        {
            //========================================================================================
            //    ADD MODE
            //========================================================================================
            DataSet            ds_AppoInfo = new DataSet();
            DateTimeFormatInfo dtfi;

            objPatient = new Base_BLL_Patient();

            objPatient.PK_PatientID = txtPatient_ID.Text != "" ? Convert.ToInt32(txtPatient_ID.Text) : 0;
            objPatient.FullName     = txtPatient_Name.Text;

            if (rdo_new.Checked)
            {
                objPatient.IsNew = 1;
            }
            else
            {
                objPatient.IsNew = 0;
            }

            if (rdo_local.Checked)
            {
                objPatient.IsLocalite = 1;
            }
            else
            {
                objPatient.IsLocalite = 0;
            }


            dtfi = new DateTimeFormatInfo();
            dtfi.ShortDatePattern = "dd-MM-yyyy";
            dtfi.DateSeparator    = "-";
            DateTime objDate = Convert.ToDateTime(txt_appointmentDate.Text, dtfi);


            objPatient.AppointmentDate = objDate.ToString("MM-dd-yyyy");



            if (chk_demandTime.Checked)
            {
                objPatient.IsDemandTimeAppointment = 1;
                objPatient.AppointmentTime         = txt_appointmentTime.Text;
                String s = objPatient.Appointment_Validate();
                ds_AppoInfo = objPatient.InsertAndAppoint_DimandTimeAppo();
            }
            else if (!chk_demandTime.Checked)
            {
                objPatient.IsDemandTimeAppointment = 0;
                objPatient.AppointmentTime         = "";
                ds_AppoInfo = objPatient.InsertAndAppoint();
            }


            if (ds_AppoInfo != null && ds_AppoInfo.Tables[0].Rows.Count > 0)
            {
                lbl_INFO_PatientId.Text   = ds_AppoInfo.Tables[0].Rows[0]["Patient_ID"].ToString();
                lbl_INFO_Patientname.Text = ds_AppoInfo.Tables[0].Rows[0]["FullName"].ToString();
                lbl_INFO_TockenNo.Text    = ds_AppoInfo.Tables[0].Rows[0]["Tocken_No"].ToString();
                lbl_INFO_appoDate.Text    = txt_appointmentDate.Text;
                lbl_INFO_appTime.Text     = ds_AppoInfo.Tables[0].Rows[0]["ApproxTime"].ToString();
                lbl_INFO_fees.Text        = ds_AppoInfo.Tables[0].Rows[0]["Fees"].ToString();

                // .Text = ds_AppoInfo.Tables[0].Rows[0]["Fees"].ToString();

                uc_error.ErrorMessage = "Appointment Saved Succesffully";
                uc_error.IsError      = false;
            }

            ClearControl();

            ScriptManager.RegisterStartupScript(this, this.GetType(), "Close", "ClearValues();", true);
            //}
            //else
            //{
            //    //========================================================================================
            //    //    EDIT MODE
            //    //========================================================================================

            //    objPatient = new Base_BLL_Patient();
            //    objPatient.PK_PatientID = Convert.ToInt32(txtPatient_ID.Text);

            //    objPatient.FullName = txtPatient_Name.Text;

            //    if (rdo_new.Checked)
            //        objPatient.IsNew = 1;
            //    else
            //        objPatient.IsNew = 0;

            //    if (rdo_local.Checked)
            //        objPatient.IsLocalite = 1;
            //    else
            //        objPatient.IsLocalite = 0;
            //    FillAppointmentQueue();
            //    objPatient.Update();
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "CloseAA", "Fn_CLosePopUp();", true);

            //}
        }
        catch (Exception ex)
        {
            uc_error.ErrorMessage = "Error: " + ex.Message + " Please Contact System Administrator!";
            uc_error.IsError      = true;
        }
    }