コード例 #1
0
        public void GetSchoolList()
        {
            int i = 0;
            int record = 0;
            string pageHtml = string.Empty;

            IntegrateWebService.SSM_WebService.MTOMSoapClient obj = new MTOMSoapClient();
            DataTable dtSchool = new DataTable();
            DataRow row = null;
            dtSchool = obj.DNN_GetAllSchools();

            var dt = ViewState["schoolList"] as DataTable;

            if (dt.Rows.Count > 0)
            {
                dt.Clear();
            }

            if (dt != null)
            {
                //----prepare recommneded school and nearest school table to show in grid----//
                if (dtSchool.Rows.Count > 0)
                {
                    record = dt.Rows.Count;

                    //-----read each data form list object----//
                    foreach (DataRow r in dtSchool.Rows)
                    {
                        i = i + 1;
                        //Prepare new row add data to it
                        var dr = dt.NewRow();
                        dr["ID"] = r["SchoolId"];
                        dr["Name"] = "<td><input id='chkSchool_" + i + "' type='checkbox' value='" + r["Name"].ToString() + "'/></td><td  id='schoolName_" + i + "'>" + r["Name"].ToString() + "</td>";
                        dt.Rows.Add(dr);
                    }

                    //---store the check box count to hidden field----//
                    hdnChkCount.Value = Convert.ToString(i);
                }

                //Add all details of datatable to viewstate
                ViewState.Add("schoolList", dt);
                dlSchools.DataSource = dt;
                dlSchools.DataBind();
            }
        }
コード例 #2
0
        public void bindGrid()
        {
            MTOMSoapClient obj = new MTOMSoapClient();
            DataTable dt = new DataTable();
            DataTable dt_1 = new DataTable();

            dt_1 = obj.getSchool();

            dt.Columns.Add("SchoolId");
            dt.Columns.Add("Name");
            dt.Columns.Add("Mascot");
            dt.Columns.Add("State");
            dt.Columns.Add("ZIP");
            dt.Columns.Add("StudentAttendance");
            int i = 0;
            DataRow row = null;
            foreach (DataRow r in dt_1.Rows)
            {
                row = dt.NewRow();
                row["SchoolId"] = dt_1.Rows[i][0];
                row["Name"] = dt_1.Rows[i][1];
                row["Mascot"] = dt_1.Rows[i][2];
                row["State"] = dt_1.Rows[i][6];
                row["ZIP"] = dt_1.Rows[i][7];
                row["StudentAttendance"] = dt_1.Rows[i][8];
                //row["Field2"] = ds.Tables[0].Rows[i][2];
                dt.Rows.Add(row);
                i = i + 1;
            }

            grdSchool.DataSource = dt;
            grdSchool.DataBind();
        }
コード例 #3
0
        //to bind grid with all name of state form database.
        public void CreateStateList()
        {
            DataTable dt=new DataTable();

            //create webservice object
            IntegrateWebService.SSM_WebService.MTOMSoap obj=new MTOMSoapClient();

            //call method form webservice
            dt=obj.DNN_GetAllState();

            if (dt.Rows.Count > 0)
            {
                //bind state data to dropdownlist.
                ddlState0.DataSource = dt;
                ddlState0.DataTextField = "StateShortName";
                ddlState0.DataValueField = "StateID";
                ddlState0.DataBind();

            }
        }
コード例 #4
0
        public void bindGrid()
        {
            //-----------Create WebServide--------------//
            MTOMSoapClient obj = new MTOMSoapClient();

            //-----------Used To Store WebServide Date--------------//
            DataTable dt_1 = new DataTable();

            //-----------Used To Store Limited Information from dt Object-------------//
            DataTable dt = new DataTable();

            dt_1 = obj.getSchool();

            //---------Create Custom Structure for dt------------//
            dt.Columns.Add("SchoolId");
            dt.Columns.Add("Name");
            dt.Columns.Add("Mascot");
            dt.Columns.Add("State");
            dt.Columns.Add("ZIP");
            dt.Columns.Add("StudentAttendance");
            int i = 0;
            DataRow row = null;

            //----------Process Each Row Of dt_1 And Stored It Into dt----------//
            foreach (DataRow r in dt_1.Rows)
            {
                row = dt.NewRow();
                row["SchoolId"] = dt_1.Rows[i][0];
                row["Name"] = dt_1.Rows[i][1];
                row["Mascot"] = dt_1.Rows[i][2];
                row["State"] = dt_1.Rows[i][6];
                row["ZIP"] = dt_1.Rows[i][7];
                row["StudentAttendance"] = dt_1.Rows[i][8];
                dt.Rows.Add(row);
                i = i + 1;
            }

            //---------Bind Grid To Its DataTable-----------//

            if (dt != null)
            {
                grdSchool.DataSource = dt;
                grdSchool.DataBind();
            }
        }
コード例 #5
0
        //----------Add Location form visitor And Select Location----------------//
        public void AddInvestorLoc(object s, DataGridCommandEventArgs e)
        {
            try
            {
                //System.Diagnostics.Debugger.Break();

                lblmessage.Text += "itemcommnadn";
                int i = 0;
                string nearestSchoolHTML = string.Empty;
                string recommndedSchoolHTML = string.Empty;

                //----Execute when add investor location button click on grid "dgMyLocation"----//
                if (e.CommandName == "addLocation")
                {
                    //Find contorl in grid and create that object.
                    var txtName = (TextBox)e.Item.FindControl("txtName");
                    var txtAddress = (TextBox)e.Item.FindControl("txtAddress");
                    var txtCity = (TextBox)e.Item.FindControl("txtCity");
                    var txtState = (TextBox)e.Item.FindControl("txtState");
                    var txtZip = (TextBox)e.Item.FindControl("txtZip");

                    IntegrateWebService.SSM_WebService.MTOMSoapClient obj = new MTOMSoapClient();
                    DataTable dtSchool = new DataTable();
                    DataRow row = null;

                    dtSchool=obj.DNN_GetNearestSchool(txtZip.Text.ToString(),10);

                    int record = 0;
                    string strContent = "";

                    //----Read viewstate data----//
                    var dt = ViewState["dtInvestorLoc"] as DataTable;
                    if (dt != null)
                    {
                        //----Prepare new row add data to it----//
                        var dr = dt.NewRow();
                        int new_UniqueNo;
                        if (dt.Rows.Count >= 1)
                        {
                            new_UniqueNo = IncrementID(dt);
                        }
                        else
                        {
                            new_UniqueNo = 1;
                        }

                        //----prepare recommneded school and nearest school table to show in grid----//
                        if (dtSchool.Rows.Count > 0)
                        {

                            //empty/reset hidden field
                            //hdnCurrenAddSchName.Value = "";

                            record = dtSchool.Rows.Count;
                            recommndedSchoolHTML = "<table id='id_tabel_" + new_UniqueNo + "' class='abcdefg' align='center' width='99%'><tr Style='display: none'><th></th><th>schoolId</th><th>school name</th><th>distance</th><th>lat</th><th>longitude</th></tr>";

                            //-----read each data form list object----//
                            foreach (DataRow r in dtSchool.Rows)
                            {
                                if (Convert.ToInt32(r["Distance"].ToString()) <= 5)
                                {
                                    recommndedSchoolHTML += "<tr><td><input id='chkChoice_" + new_UniqueNo + i + "' onclick='javascript:SchholInMyQuote(this);javascript:MarkAllSameSchool(this.id);' type='checkbox'  checked='checked'/></td><td Style='display: none' id='schoolId_" + new_UniqueNo + i + "'>" + r["SchoolId"].ToString() + "</td><td  id='schoolName_" + new_UniqueNo + i + "'>" + r["Name"].ToString() + "</td><td>(" + r["Distance"].ToString() + " Mi)</td><td  id='lat_" + new_UniqueNo + i + "'  Style='display: none'>" + r["lat"].ToString() + "</td><td id='long_" + new_UniqueNo + i + "' Style='display: none'>" + r["longi"].ToString() + "</td></tr>";
                                }
                                else
                                {
                                    recommndedSchoolHTML += "<tr><td><input id='chkChoice_" + new_UniqueNo + i + "' onclick='javascript:SchholInMyQuote(this);javascript:MarkAllSameSchool(this.id);' type='checkbox'/></td><td Style='display: none' id='schoolId_" + new_UniqueNo + i + "'>" + r["SchoolId"].ToString() + "</td><td  id='schoolName_" + new_UniqueNo + i + "'>" + r["Name"].ToString() + "</td><td>(" + r["Distance"].ToString() + " Mi)</td><td  id='lat_" + new_UniqueNo + i + "'  Style='display: none'>" + r["lat"].ToString() + "</td><td id='long_" + new_UniqueNo + i + "' Style='display: none'>" + r["longi"].ToString() + "</td></tr>";
                                }

                                //----do only for first record of list this has closes school----///
                                if (i == 0)
                                {
                                    nearestSchoolHTML = r["Name"].ToString() + "<br/>" + "(" + r["Distance"].ToString() + " " + "Miles)";
                                }
                                i = i + 1;
                            }
                            recommndedSchoolHTML += "</table>";
                            //-----set each cell value of datarow object-----//
                            dr["id"] = new_UniqueNo;
                            dr["Name"] = txtName.Text.Trim();
                            dr["Address"] = txtAddress.Text.ToString();
                            dr["City"] = txtCity.Text.ToString();
                            dr["State"] = txtState.Text.Trim();
                            dr["Zip"] = txtZip.Text.Trim();
                            dr["NearestSchoolList"] = "<div id='NearestSchoolResult_" + new_UniqueNo + "'>" + nearestSchoolHTML + "</div>";
                            dr["RecommendedSchoolList"] = "<div id='RecommendedSchoolList_" + new_UniqueNo + "'>" + recommndedSchoolHTML + "</div>";

                            //----Add new row to datatable.----//
                            dt.Rows.Add(dr);

                            //----Add all details of datatable to viewstate----//
                            ViewState.Add("dtInvestorLoc", dt);
                            dgMyLocation.DataSource = dt;
                            dgMyLocation.DataBind();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }