Esempio n. 1
0
    protected void btnGetUser0_Click(object sender, EventArgs e)
    {
        try
        {
            string[] strParas = new string[1];
            strParas[0] = ddlUserName0.SelectedItem.Value;
            clsStoreProcedureAccess clsSearchByUserName = new clsStoreProcedureAccess("GetUserByUserName", strSQLConn);
            DataTable dtSearch = clsSearchByUserName.fnExecuteSP2DataTable(strParas);

            if (dtSearch.Rows.Count < 1)
            {
                lblMsg.Text = "No record found!";
            }
            if (dtSearch.Rows.Count == 1)
            {
                txtUserName0.Text                = dtSearch.Rows[0][0].ToString();
                txtFirstName0.Text               = dtSearch.Rows[0][1].ToString();
                txtLastName0.Text                = dtSearch.Rows[0][2].ToString();
                txtOrganization0.Text            = dtSearch.Rows[0][3].ToString();
                txtEmail0.Text                   = dtSearch.Rows[0][4].ToString();
                txtPhoneNum0.Text                = dtSearch.Rows[0][5].ToString();
                ddlAccessLevel0.SelectedValue    = dtSearch.Rows[0][6].ToString();
                ddlApprovalStatus0.SelectedValue = dtSearch.Rows[0][7].ToString();
                ddlExportData0.SelectedValue     = dtSearch.Rows[0][8].ToString();
                txtSignUpDate0.Text              = dtSearch.Rows[0][9].ToString();
            }

            lblMsg.Text = "";
        }
        catch (Exception ex)
        {
            lblMsg.Text = "" + ex.Message;
        }
    }
Esempio n. 2
0
    //===========================================================================================================================Manage==============
    private void fnLoadUserNames()
    {
        clsStoreProcedureAccess clsUserNames = new clsStoreProcedureAccess("GetUserNames", strSQLConn);
        DataTable dtAllUserNames             = clsUserNames.fnExecuteSP2DataTable();

        ddlUserName0.Items.Clear();
        for (int i = 0; i < dtAllUserNames.Rows.Count; i++)
        {
            ListItem li = new ListItem();
            li.Value = dtAllUserNames.Rows[i][0].ToString();
            li.Text  = dtAllUserNames.Rows[i][0].ToString();
            ddlUserName0.Items.Add(li);
        }
    }
Esempio n. 3
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        if (rblSearchBy.SelectedIndex == 0)//search all
        {
            clsStoreProcedureAccess clsSearchAll = new clsStoreProcedureAccess("GetAllUser", strSQLConn);
            DataTable dtAllUser = clsSearchAll.fnExecuteSP2DataTable();
            gvSearchResult.DataSource = dtAllUser;
            gvSearchResult.DataBind();
            lblMsg.Text = dtAllUser.Rows.Count + " records found!";
        }
        else//search by criteria
        {
            string[] strParas = new string[6];
            strParas[0] = txtFirstName.Visible ? txtFirstName.Text.Trim() : ddlFirstName.SelectedItem.Value;          //first
            //if (strParas[0].Length < 1) strParas[0] = " ";
            strParas[1] = txtLastName.Visible ? txtLastName.Text.Trim() : ddlLastName.SelectedItem.Value;             //lastname
            //if (strParas[1].Length < 1) strParas[1] = " ";
            strParas[2] = txtUserName.Visible ? txtUserName.Text.Trim() : ddlUserName.SelectedItem.Value;             //username
            //if (strParas[2].Length < 1) strParas[2] = " ";
            strParas[3] = txtOrganization.Visible ? txtOrganization.Text.Trim() : ddlOrganization.SelectedItem.Value; //organization
            //if (strParas[3].Length < 1) strParas[3] = " ";
            strParas[4] = ddlAccessLevel2.SelectedIndex > 0 ? ddlAccessLevel2.SelectedItem.Value : "";                //accesslevel
            //if (strParas[4].Length < 1) strParas[4] = " ";

            if (rblApprovalStatus.SelectedIndex == 0)
            {
                strParas[5] = "";
            }
            else if (rblApprovalStatus.SelectedIndex == 1)
            {
                strParas[5] = "Yes";
            }
            else
            {
                strParas[5] = "No";//approvalstatus;
            }
            clsStoreProcedureAccess clsSearchByCriteria = new clsStoreProcedureAccess("GetUserByCriteria", strSQLConn);
            DataTable dtSearch = clsSearchByCriteria.fnExecuteSP2DataTable(strParas);

            gvSearchResult.DataSource = dtSearch;
            gvSearchResult.DataBind();
            lblMsg.Text = dtSearch.Rows.Count + " records found!";
        }
    }
Esempio n. 4
0
    protected void btnGenerateReport_Click(object sender, EventArgs e)
    {
        DataTable dtReport = new DataTable();

        if (rblReportBy.SelectedIndex == 0)//report by individual
        {
            //single day
            if (rblReportWhen.SelectedIndex == 0)
            {
                string[] strParas = new string[2];
                strParas[0] = txtUserName1.Visible ? txtUserName1.Text.Trim() : ddlUserName1.SelectedItem.Value;
                strParas[1] = Convert.ToDateTime(txtSingleDay.Text.Trim()).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByUserNameDay", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //date range
            else if (rblReportWhen.SelectedIndex == 1)
            {
                string[] strParas = new string[3];
                strParas[0] = txtUserName1.Visible ? txtUserName1.Text.Trim() : ddlUserName1.SelectedItem.Value;
                strParas[1] = Convert.ToDateTime(txtDayFrom.Text.Trim()).ToString("yyyy-MM-dd");
                strParas[2] = Convert.ToDateTime(txtDayTo.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByUserNameRange", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //all
            else
            {
                string[] strParas = new string[1];
                strParas[0] = txtUserName1.Visible ? txtUserName1.Text.Trim() : ddlUserName1.SelectedItem.Value;

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByUserName", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
        }
        else if (rblReportBy.SelectedIndex == 1)//report by organization
        {
            //single day
            if (rblReportWhen.SelectedIndex == 0)
            {
                string[] strParas = new string[2];
                strParas[0] = txtOrganization1.Visible ? txtOrganization1.Text.Trim() : ddlOrganization1.SelectedItem.Value;
                strParas[1] = Convert.ToDateTime(txtSingleDay.Text.Trim()).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByOrganizationDay", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //date range
            else if (rblReportWhen.SelectedIndex == 1)
            {
                string[] strParas = new string[3];
                strParas[0] = txtOrganization1.Visible ? txtOrganization1.Text.Trim() : ddlOrganization1.SelectedItem.Value;
                strParas[1] = Convert.ToDateTime(txtDayFrom.Text.Trim()).ToString("yyyy-MM-dd");
                strParas[2] = Convert.ToDateTime(txtDayTo.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByOrganizationRange", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //all
            else
            {
                string[] strParas = new string[1];
                strParas[0] = txtOrganization1.Visible ? txtOrganization1.Text.Trim() : ddlOrganization1.SelectedItem.Value;

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByOrganization", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
        }
        else if (rblReportBy.SelectedIndex == 2)//report by access level
        {
            //single day
            if (rblReportWhen.SelectedIndex == 0)
            {
                string[] strParas = new string[2];
                strParas[0] = ddlAccessLevel2.SelectedItem.Value;
                strParas[1] = Convert.ToDateTime(txtSingleDay.Text.Trim()).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByAccessLevelDay", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //date range
            else if (rblReportWhen.SelectedIndex == 1)
            {
                string[] strParas = new string[3];
                strParas[0] = ddlAccessLevel2.SelectedItem.Value;
                strParas[1] = Convert.ToDateTime(txtDayFrom.Text.Trim()).ToString("yyyy-MM-dd");
                strParas[2] = Convert.ToDateTime(txtDayTo.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByAccessLevelRange", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //all
            else
            {
                string[] strParas = new string[1];
                strParas[0] = ddlAccessLevel2.SelectedItem.Value;

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoByAccessLevel", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
        }
        else//report all
        {
            //single day
            if (rblReportWhen.SelectedIndex == 0)
            {
                string[] strParas = new string[1];
                strParas[0] = Convert.ToDateTime(txtSingleDay.Text.Trim()).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoAllDay", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //date range
            else if (rblReportWhen.SelectedIndex == 1)
            {
                string[] strParas = new string[2];
                strParas[0] = Convert.ToDateTime(txtDayFrom.Text.Trim()).ToString("yyyy-MM-dd");
                strParas[1] = Convert.ToDateTime(txtDayTo.Text.Trim()).AddDays(1).ToString("yyyy-MM-dd");

                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoAllRange", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable(strParas);
            }
            //all
            else
            {
                clsStoreProcedureAccess clsIndividualSingleDay = new clsStoreProcedureAccess("GetLogInfoAll", strSQLConn);
                dtReport = clsIndividualSingleDay.fnExecuteSP2DataTable();
            }
        }
        gvReport.DataSource = dtReport;
        gvReport.DataBind();

        lblMsg1.Text = dtReport.Rows.Count + " records found!";
    }