Exemplo n.º 1
0
    /*
     * void BindDepartment()
     * {
     *  Doctors o = new Doctors();
     *  DepartmentList.DataSource = o.getDepartment();
     *  DepartmentList.DataTextField = "ShortName";
     *  DepartmentList.DataValueField = "Id";
     *  DepartmentList.DataBind();
     *  DepartmentList.Items.Insert(0, "Select");
     * }
     *
     * void BindCity()
     * {
     *  Doctors o = new Doctors();
     *  CityList.DataSource = o.getDepartment();
     *  CityList.DataTextField = "ShortName";
     *  CityList.DataValueField = "Id";
     *  CityList.DataBind();
     *  CityList.Items.Insert(0, "Select");
     * }
     *
     * void BindArea()
     * {
     *  Doctors o = new Doctors();
     *  AreaList.DataSource = o.getDepartment();
     *  AreaList.DataTextField = "ShortName";
     *  AreaList.DataValueField = "Id";
     *  AreaList.DataBind();
     *  AreaList.Items.Insert(0, "Select");
     * }
     */

    protected void LoginButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            AMADBasePage bp = new AMADBasePage();
            DataSet      ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    LoginNameLabel.Text           = ds.Tables[0].Rows[0]["FirstName"].ToString();
                    LastLoginTimeLabel.Text       = ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                    postLoginDiv.Style["display"] = "block";
                    Session["UserData"]           = ds.Tables[0];
                    if (ds.Tables[0].Rows[0]["UserType"].ToString() == "DOCTOR")
                    {
                        Doctors doc   = new Doctors();
                        DataSet dsDoc = doc.GetDoctorsDetailsByEmail(ds.Tables[0].Rows[0]["EmailAddress"].ToString());
                        if (dsDoc == null)
                        {
                            Response.Redirect("UnAuthorizedAccess.aspx");
                        }
                        else
                        {
                            Session["DoctorData"] = dsDoc.Tables[0];
                            Response.Redirect("ManageSchedule.aspx");
                        }
                    }
                    else if (ds.Tables[0].Rows[0]["UserType"].ToString() == "USER")
                    {
                        Response.Redirect("BookAppointment.aspx");
                    }
                    else
                    {
                        Response.Redirect("BookAppointment.aspx");
                    }
                }
                else
                {
                    Session["UserData"]           = null;
                    LoginNameLabel.Text           = "";
                    LastLoginTimeLabel.Text       = "";
                    postLoginDiv.Style["display"] = "none";
                    Response.Redirect(ConfigurationManager.AppSettings["ROOTURL"].ToString() + "/Login.aspx");
                }
            }
            else
            {
                LoginNameLabel.Text           = "";
                LastLoginTimeLabel.Text       = "";
                postLoginDiv.Style["display"] = "none";
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "enable2", "openLoginModal();", true);
        }
    }
Exemplo n.º 2
0
 protected void LoginButton_Click(object sender, ImageClickEventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             AMADBasePage bp = new AMADBasePage();
             DataSet      ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
             if (ds.Tables.Count > 0)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     Session["LoginName"]     = ds.Tables[0].Rows[0]["FirstName"].ToString();
                     Session["LastLoginTime"] = ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                     Session["UserData"]      = ds.Tables[0];
                     if (ds.Tables[0].Rows[0]["UserType"].ToString() == "DOCTOR")
                     {
                         Doctors doc   = new Doctors();
                         DataSet dsDoc = doc.GetDoctorsDetailsByEmail(ds.Tables[0].Rows[0]["EmailAddress"].ToString());
                         if (dsDoc == null)
                         {
                             Response.Redirect("UnAuthorizedAccess.aspx");
                         }
                         else
                         {
                             Session["DoctorData"] = dsDoc.Tables[0];
                             Response.Redirect("ManageSchedule.aspx");
                         }
                     }
                     else if (ds.Tables[0].Rows[0]["UserType"].ToString() == "USER")
                     {
                         Response.Redirect("BookAppointment.aspx");
                     }
                 }
                 else
                 {
                     Session["LoginName"]     = null;
                     Session["LastLoginTime"] = null;
                     Session["UserData"]      = null;
                     RegisterLabel.Text       = "Username and/or password is invalid.";
                     //Response.Redirect(ConfigurationManager.AppSettings["ROOTURL"].ToString() + "/Login.aspx");
                 }
             }
             else
             {
                 Session["LoginName"]     = null;
                 Session["LastLoginTime"] = null;
                 Session["UserData"]      = null;
                 RegisterLabel.Text       = "Username and/or password is invalid.";
             }
         }
         catch (Exception ex)
         {
         }
     }
 }
Exemplo n.º 3
0
    public static DataSet GetUserDetailsForActivation(string email)
    {
        DataSet      ds  = new DataSet();
        AMADBasePage obj = new AMADBasePage();
        Database     db  = new Database(ConnectionManager.GetDatabaseConnectionString());
        SqlParameter p1  = new SqlParameter("EmailAddress", email);

        ds = db.ExecuteDataSet("fb_amad_GetUserDetailsForActivation", p1);

        return(ds);
    }
Exemplo n.º 4
0
    /*
    void BindDepartment()
    {
        Doctors o = new Doctors();
        DepartmentList.DataSource = o.getDepartment();
        DepartmentList.DataTextField = "ShortName";
        DepartmentList.DataValueField = "Id";
        DepartmentList.DataBind();
        DepartmentList.Items.Insert(0, "Select");
    }

    void BindCity()
    {
        Doctors o = new Doctors();
        CityList.DataSource = o.getDepartment();
        CityList.DataTextField = "ShortName";
        CityList.DataValueField = "Id";
        CityList.DataBind();
        CityList.Items.Insert(0, "Select");
    }

    void BindArea()
    {
        Doctors o = new Doctors();
        AreaList.DataSource = o.getDepartment();
        AreaList.DataTextField = "ShortName";
        AreaList.DataValueField = "Id";
        AreaList.DataBind();
        AreaList.Items.Insert(0, "Select");
    }
    */
    protected void LoginButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            AMADBasePage bp = new AMADBasePage();
            DataSet ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    LoginNameLabel.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
                    LastLoginTimeLabel.Text = ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                    postLoginDiv.Style["display"] = "block";
                    Session["UserData"] = ds.Tables[0];
                    if (ds.Tables[0].Rows[0]["UserType"].ToString() == "DOCTOR")
                    {
                        Doctors doc = new Doctors();
                        DataSet dsDoc = doc.GetDoctorsDetailsByEmail(ds.Tables[0].Rows[0]["EmailAddress"].ToString());
                        if (dsDoc == null)
                            Response.Redirect("UnAuthorizedAccess.aspx");
                        else
                        {
                            Session["DoctorData"] = dsDoc.Tables[0];
                            Response.Redirect("ManageSchedule.aspx");
                        }
                    }
                    else if (ds.Tables[0].Rows[0]["UserType"].ToString() == "USER")
                        Response.Redirect("BookAppointment.aspx");
                    else
                        Response.Redirect("BookAppointment.aspx");
                }
                else
                {
                    Session["UserData"] = null;
                    LoginNameLabel.Text = "";
                    LastLoginTimeLabel.Text = "";
                    postLoginDiv.Style["display"] = "none";
                    Response.Redirect(ConfigurationManager.AppSettings["ROOTURL"].ToString() + "/Login.aspx");
                }
            }
            else
            {
                LoginNameLabel.Text = "";
                LastLoginTimeLabel.Text = "";
                postLoginDiv.Style["display"] = "none";
            }

        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "enable2", "openLoginModal();", true);
        }
    }
Exemplo n.º 5
0
 protected void LoginButton_Click(object sender, ImageClickEventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             AMADBasePage bp = new AMADBasePage();
             DataSet ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
             if (ds.Tables.Count > 0)
             {
                 if (ds.Tables[0].Rows.Count > 0)
                 {
                     Session["LoginName"] = ds.Tables[0].Rows[0]["FirstName"].ToString();
                     Session["LastLoginTime"] = ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                     Session["UserData"] = ds.Tables[0];
                     if (ds.Tables[0].Rows[0]["UserType"].ToString() == "DOCTOR")
                     {
                         Doctors doc = new Doctors();
                         DataSet dsDoc = doc.GetDoctorsDetailsByEmail(ds.Tables[0].Rows[0]["EmailAddress"].ToString());
                         if (dsDoc == null)
                             Response.Redirect("UnAuthorizedAccess.aspx");
                         else
                         {
                             Session["DoctorData"] = dsDoc.Tables[0];
                             Response.Redirect("ManageSchedule.aspx");
                         }
                     }
                     else if (ds.Tables[0].Rows[0]["UserType"].ToString() == "USER")
                         Response.Redirect("BookAppointment.aspx");
                 }
                 else
                 {
                     Session["LoginName"] = null;
                     Session["LastLoginTime"] = null;
                     Session["UserData"] = null;
                     RegisterLabel.Text = "Username and/or password is invalid.";
                     //Response.Redirect(ConfigurationManager.AppSettings["ROOTURL"].ToString() + "/Login.aspx");
                 }
             }
             else
             {
                 Session["LoginName"] = null;
                 Session["LastLoginTime"] = null;
                 Session["UserData"] = null;
                 RegisterLabel.Text = "Username and/or password is invalid.";
             }
         }
         catch(Exception ex)
         {
         }
     }
 }
Exemplo n.º 6
0
    protected void LoginButton_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {
            AMADBasePage bp = new AMADBasePage();
            DataSet ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (Convert.ToString(ds.Tables[0].Rows[0]["LastLoggedIn"]) == "")
                    {
                        LastLoginTimeLabel.Text = "This is your first login<br/>";
                        LoginNameLabel.Text = "Welcome " + ds.Tables[0].Rows[0]["FirstName"].ToString();
                    }
                    else
                    {
                        LastLoginTimeLabel.Text = "You last logged-in on:<br/>" + ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                        LoginNameLabel.Text = "Welcome back " + ds.Tables[0].Rows[0]["FirstName"].ToString();
                    }
                    postLoginDiv.Style["display"] = "block";
                    Session["UserData"] = ds.Tables[0];
                    RegisterHyperLink.Visible = false;
                    SignInHyperlink.Visible = false;
                    LogOutHyperLink.Visible = true;
                }
                else
                {
                    LoginNameLabel.Text = "";
                    LastLoginTimeLabel.Text = "";
                    postLoginDiv.Style["display"] = "none";
                    RegisterHyperLink.Visible = true;
                    SignInHyperlink.Visible = true;
                    LogOutHyperLink.Visible = false;
                }
            }
            else
            {
                LoginNameLabel.Text = "";
                LastLoginTimeLabel.Text = "";
                postLoginDiv.Style["display"] = "none";
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "login", "openLoginModal();", true);

        }
    }
Exemplo n.º 7
0
 protected void LoginButton_Click(object sender, ImageClickEventArgs e)
 {
     if (Page.IsValid)
     {
         AMADBasePage bp = new AMADBasePage();
         DataSet      ds = Users.ValidateLogin(UserNameTextBox.Text, PasswordTextBox.Text);
         if (ds.Tables.Count > 0)
         {
             if (ds.Tables[0].Rows.Count > 0)
             {
                 if (Convert.ToString(ds.Tables[0].Rows[0]["LastLoggedIn"]) == "")
                 {
                     LastLoginTimeLabel.Text = "This is your first login<br/>";
                     LoginNameLabel.Text     = "Welcome " + ds.Tables[0].Rows[0]["FirstName"].ToString();
                 }
                 else
                 {
                     LastLoginTimeLabel.Text = "You last logged-in on:<br/>" + ds.Tables[0].Rows[0]["LastLoggedIn"].ToString();
                     LoginNameLabel.Text     = "Welcome back " + ds.Tables[0].Rows[0]["FirstName"].ToString();
                 }
                 postLoginDiv.Style["display"] = "block";
                 Session["UserData"]           = ds.Tables[0];
                 RegisterHyperLink.Visible     = false;
                 SignInHyperlink.Visible       = false;
                 LogOutHyperLink.Visible       = true;
             }
             else
             {
                 LoginNameLabel.Text           = "";
                 LastLoginTimeLabel.Text       = "";
                 postLoginDiv.Style["display"] = "none";
                 RegisterHyperLink.Visible     = true;
                 SignInHyperlink.Visible       = true;
                 LogOutHyperLink.Visible       = false;
             }
         }
         else
         {
             LoginNameLabel.Text           = "";
             LastLoginTimeLabel.Text       = "";
             postLoginDiv.Style["display"] = "none";
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "login", "openLoginModal();", true);
     }
 }
Exemplo n.º 8
0
    public static string RegisterUser()
    {
        AMADBasePage obj = new AMADBasePage();
        Database     db  = new Database(ConnectionManager.GetDatabaseConnectionString());
        SqlParameter p1  = new SqlParameter("FirstName", FirstName);
        SqlParameter p2  = new SqlParameter("LastName", LastName);
        SqlParameter p3  = new SqlParameter("EmailAddress", EmailAddress);
        SqlParameter p4  = new SqlParameter("MobileNumber", MobileNumber);
        SqlParameter p5  = new SqlParameter("Token", ActivationToken);
        SqlParameter p6  = new SqlParameter("Password", obj.Encrypt(obj.GeneratePassword(), ConfigurationManager.AppSettings["ENCKI"].ToString()));
        SqlParameter p7  = new SqlParameter("IsPatient", IsPatient);
        SqlParameter p8  = new SqlParameter("Key", ConfigurationManager.AppSettings["ENCKI"].ToString());
        object       o   = db.ExecuteScalar("fb_amad_RegisterUser", p1, p2, p3, p4, p5, p6, p7, p8);

        return(string.Format(o != null ? Convert.ToString(o) : "0"));
    }
Exemplo n.º 9
0
    public DataSet GetDoctorsDetailsByEmail(string email)
    {
        DataSet      ds  = new DataSet();
        AMADBasePage obj = new AMADBasePage();
        Database     db  = new Database(ConnectionManager.GetDatabaseConnectionString());
        SqlParameter p1  = new SqlParameter("EmailAddress", email);
        SqlParameter p2  = new SqlParameter("RecordStatus", 0);

        p2.Direction = ParameterDirection.Output;
        ds           = db.ExecuteDataSet("fb_amad_GetDoctorsDetailsByEmail", p1, p2);
        if (Convert.ToInt32(p2.Value) > 0)
        {
            return(ds);
        }
        else
        {
            return(null);
        }
    }
Exemplo n.º 10
0
    public static DataSet ValidateLogin(string username, string password)
    {
        int     retval = 0;
        DataSet ds     = new DataSet();

        if (username.Contains("@") && username.Contains("."))
        {
            AMADBasePage obj = new AMADBasePage();
            Database     db  = new Database(ConnectionManager.GetDatabaseConnectionString());
            SqlParameter p1  = new SqlParameter("LoginName", username);
            SqlParameter p2  = new SqlParameter("Password", obj.Encrypt(password, ConfigurationManager.AppSettings["ENCKI"].ToString()));
            SqlParameter p3  = new SqlParameter("ApplicationName", "AMAD");
            SqlParameter p4  = new SqlParameter("UserNameType", "EMAIL");
            SqlParameter p5  = new SqlParameter("AccountStatus", 0);
            SqlParameter p6  = new SqlParameter("LoginType", "");
            p5.Direction = ParameterDirection.Output;
            p6.Direction = ParameterDirection.Output;
            ds           = db.ExecuteDataSet("fb_ValidateLogin", p1, p2, p3, p4, p5, p6);
            UserType     = Convert.ToString(p6.Value);
            retval       = Convert.ToInt32(Convert.ToString(p5.Value));
        }
        else
        {
            AMADBasePage obj = new AMADBasePage();
            Database     db  = new Database(ConnectionManager.GetDatabaseConnectionString());
            SqlParameter p1  = new SqlParameter("LoginName", username);
            SqlParameter p2  = new SqlParameter("Password", obj.Encrypt(password, ConfigurationManager.AppSettings["ENCKI"].ToString()));
            SqlParameter p3  = new SqlParameter("ApplicationName", "AMAD");
            SqlParameter p4  = new SqlParameter("UserNameType", "USERNAME");
            SqlParameter p5  = new SqlParameter("AccountStatus", "0");
            SqlParameter p6  = new SqlParameter("LoginType", "");
            p5.Direction = ParameterDirection.Output;
            p6.Direction = ParameterDirection.Output;
            ds           = db.ExecuteDataSet("fb_ValidateLogin", p1, p2, p3, p4, p5, p6);
            UserType     = Convert.ToString(p6.Value);
            retval       = Convert.ToInt32(Convert.ToString(p5.Value));
        }
        return(ds);
    }
Exemplo n.º 11
0
    public DataSet GetDoctorsListForAppointment(string dept, string city, string area)
    {
        DataSet      ds  = new DataSet();
        AMADBasePage obj = new AMADBasePage();
        Database     db  = new Database(ConnectionManager.GetDatabaseConnectionString());
        SqlParameter p1  = new SqlParameter("Department", dept);
        SqlParameter p2  = new SqlParameter("City", city);
        SqlParameter p3  = new SqlParameter("Area", area);
        SqlParameter p4  = new SqlParameter("StatusDesc", 0);
        SqlParameter p5  = new SqlParameter("AccountStatus", "");

        p4.Direction = ParameterDirection.Output;
        p5.Direction = ParameterDirection.Output;
        ds           = db.ExecuteDataSet("fb_amad_GetDoctorsForAppointments", p1, p2, p3, p4, p5);
        if (Convert.ToInt32(p4.Value) > 0)
        {
            return(ds);
        }
        else
        {
            return(null);
        }
    }
Exemplo n.º 12
0
 public static DataSet ValidateLogin(string username, string password)
 {
     int retval = 0;
     DataSet ds = new DataSet();
     if (username.Contains("@") && username.Contains("."))
     {
         AMADBasePage obj = new AMADBasePage();
         Database db = new Database(ConnectionManager.GetDatabaseConnectionString());
         SqlParameter p1 = new SqlParameter("LoginName", username);
         SqlParameter p2 = new SqlParameter("Password", obj.Encrypt(password, ConfigurationManager.AppSettings["ENCKI"].ToString()));
         SqlParameter p3 = new SqlParameter("ApplicationName", "AMAD");
         SqlParameter p4 = new SqlParameter("UserNameType", "EMAIL");
         SqlParameter p5 = new SqlParameter("AccountStatus", 0);
         SqlParameter p6 = new SqlParameter("LoginType", "");
         p5.Direction = ParameterDirection.Output;
         p6.Direction = ParameterDirection.Output;
         ds = db.ExecuteDataSet("fb_ValidateLogin", p1, p2, p3, p4, p5, p6);
         UserType = Convert.ToString(p6.Value);
         retval = Convert.ToInt32(Convert.ToString(p5.Value));
     }
     else
     {
         AMADBasePage obj = new AMADBasePage();
         Database db = new Database(ConnectionManager.GetDatabaseConnectionString());
         SqlParameter p1 = new SqlParameter("LoginName", username);
         SqlParameter p2 = new SqlParameter("Password", obj.Encrypt(password, ConfigurationManager.AppSettings["ENCKI"].ToString()));
         SqlParameter p3 = new SqlParameter("ApplicationName", "AMAD");
         SqlParameter p4 = new SqlParameter("UserNameType", "USERNAME");
         SqlParameter p5 = new SqlParameter("AccountStatus", "0");
         SqlParameter p6 = new SqlParameter("LoginType", "");
         p5.Direction = ParameterDirection.Output;
         p6.Direction = ParameterDirection.Output;
         ds = db.ExecuteDataSet("fb_ValidateLogin", p1, p2, p3, p4, p5, p6);
         UserType = Convert.ToString(p6.Value);
         retval = Convert.ToInt32(Convert.ToString(p5.Value));
     }
     return ds;
 }
Exemplo n.º 13
0
 public static string RegisterUser()
 {
     AMADBasePage obj = new AMADBasePage();
     Database db = new Database(ConnectionManager.GetDatabaseConnectionString());
     SqlParameter p1 = new SqlParameter("FirstName", FirstName);
     SqlParameter p2 = new SqlParameter("LastName", LastName);
     SqlParameter p3 = new SqlParameter("EmailAddress", EmailAddress);
     SqlParameter p4 = new SqlParameter("MobileNumber", MobileNumber);
     SqlParameter p5 = new SqlParameter("Token", ActivationToken);
     SqlParameter p6 = new SqlParameter("Password", obj.Encrypt(obj.GeneratePassword(), ConfigurationManager.AppSettings["ENCKI"].ToString()));
     SqlParameter p7 = new SqlParameter("IsPatient", IsPatient);
     SqlParameter p8 = new SqlParameter("Key", ConfigurationManager.AppSettings["ENCKI"].ToString());
     object o = db.ExecuteScalar("fb_amad_RegisterUser", p1, p2, p3, p4, p5, p6, p7, p8);
     return string.Format(o != null ? Convert.ToString(o) : "0");
 }
Exemplo n.º 14
0
    public static DataSet GetUserDetailsForActivation(string email)
    {
        DataSet ds = new DataSet();
        AMADBasePage obj = new AMADBasePage();
        Database db = new Database(ConnectionManager.GetDatabaseConnectionString());
        SqlParameter p1 = new SqlParameter("EmailAddress", email);
        ds = db.ExecuteDataSet("fb_amad_GetUserDetailsForActivation", p1);

        return ds;
    }
Exemplo n.º 15
0
 public DataSet GetDoctorsListForAppointment(string dept, string city, string area)
 {
     DataSet ds = new DataSet();
     AMADBasePage obj = new AMADBasePage();
     Database db = new Database(ConnectionManager.GetDatabaseConnectionString());
     SqlParameter p1 = new SqlParameter("Department", dept);
     SqlParameter p2 = new SqlParameter("City", city);
     SqlParameter p3 = new SqlParameter("Area", area);
     SqlParameter p4 = new SqlParameter("StatusDesc", 0);
     SqlParameter p5 = new SqlParameter("AccountStatus", "");
     p4.Direction = ParameterDirection.Output;
     p5.Direction = ParameterDirection.Output;
     ds = db.ExecuteDataSet("fb_amad_GetDoctorsForAppointments", p1, p2, p3, p4, p5);
     if (Convert.ToInt32(p4.Value) > 0)
         return ds;
     else
         return null;
 }
Exemplo n.º 16
0
 public DataSet GetDoctorsDetailsByEmail(string email)
 {
     DataSet ds = new DataSet();
     AMADBasePage obj = new AMADBasePage();
     Database db = new Database(ConnectionManager.GetDatabaseConnectionString());
     SqlParameter p1 = new SqlParameter("EmailAddress", email);
     SqlParameter p2 = new SqlParameter("RecordStatus", 0);
     p2.Direction = ParameterDirection.Output;
     ds = db.ExecuteDataSet("fb_amad_GetDoctorsDetailsByEmail", p1, p2);
     if (Convert.ToInt32(p2.Value) > 0)
         return ds;
     else
         return null;
 }