Example #1
0
    private void GetReportData()
    {
        //First step, initialize some local vars... (WQM) 01/30/2008
        //SurveyID = 4;
        //SchoolID = 16319;

        SqlCommand cmd = new SqlCommand("GetReportDetails", objConn);

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@SurveyID", SurveyID);
        cmd.Parameters.AddWithValue("@SchoolID", SchoolID);
        cmd.Parameters.AddWithValue("@DistrictID", DistrictID);
        if (StateID == "''")
        {
            StateID = "";
        }
        cmd.Parameters.AddWithValue("@StateID", StateID);
        cmd.CommandTimeout = 900;
        SqlDataAdapter objAdapt = new SqlDataAdapter();

        //lblError.Text += "suid=" + SurveyID + "*schid=" + SchoolID + "*distid=" + DistrictID + "*stid=" + StateID + "*";
        //return;
        objAdapt.SelectCommand = cmd;
        objConn.Open();
        try
        {
            objAdapt.Fill(reportData);
            reportHeaders      = reportData.Tables[0];
            reportQuestions    = reportData.Tables[1];
            reportAnswers      = reportData.Tables[2];
            reportSurveysTaken = reportData.Tables[3];
            reportEntity       = reportData.Tables[4];

            /*lblError.Text += "<br>Tables=" + reportData.Tables.Count.ToString();
             * foreach (DataTable dt in reportData.Tables)
             * {
             *  lblError.Text += "<br>" + dt.TableName + "=" + dt.Rows.Count.ToString();
             * }
             * return;*/
        }
        catch (SqlException err)
        {
            Log("GetReportData", "ERROR", "", "", "Error Retrieving Report Data", "suid=" + SurveyID.ToString() + "*schid=" + SchoolID.ToString() + "*distid=" + DistrictID.ToString() + "*stid=" + StateID + "*");
        }
        finally
        {
            objConn.Close();
        }
    }
Example #2
0
        protected void lvMDDistrict_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 DistrictID;

            Int64.TryParse(e.CommandArgument.ToString(), out DistrictID);

            if (DistrictID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _DistrictID = DistrictID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(MDDistrictEntity.FLD_NAME_DistrictID, DistrictID.ToString(), SQLMatchType.Equal);

                        MDDistrictEntity mDDistrictEntity = new MDDistrictEntity();


                        result = FCCMDDistrict.GetFacadeCreate().Delete(mDDistrictEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _DistrictID       = 0;
                            _MDDistrictEntity = new MDDistrictEntity();
                            PrepareInitialView();
                            BindMDDistrictList();

                            MiscUtil.ShowMessage(lblMessage, "District has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete District.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }