예제 #1
0
    protected void deletegeofence(int geoid)
    {
        try
        {
            cls_GeoFencing obj_geo = new cls_GeoFencing();
            obj_geo.task       = 3;
            obj_geo.GeofenceId = geoid;

            //send other field empty
            obj_geo.AreaName      = "";
            obj_geo.IsCircularGF  = 1;
            obj_geo.GeoLatitude1  = float.Parse("0.0");
            obj_geo.GeoLongitude1 = float.Parse("0.0");
            obj_geo.Redius        = float.Parse("0.0");
            obj_geo.CarrierID     = 0;

            obj_geo.alertst_time  = "";
            obj_geo.alertend_time = "";

            obj_geo.fn_relCarrierGeofence_manage(obj_geo);

            GeoareaList();
        }
        catch (Exception ex)
        {
        }
    }
예제 #2
0
 //function for fetching geo area data & assign it to gv_groareaList
 protected void GeoareaList()
 {
     try
     {
         cls_GeoFencing obj_geo = new cls_GeoFencing();
         ds_geoareaList            = obj_geo.fn_FetchCiruclarGEo(Convert.ToInt32(ddlcarrier.SelectedItem.Value), 1); // task 1 for circular geofence
         gv_geoareaList.DataSource = ds_geoareaList;
         gv_geoareaList.DataBind();
         ViewState["ds_geo"] = ds_geoareaList;
     }
     catch (Exception ex)
     {
     }
 }
예제 #3
0
    protected void gv_geoareaList_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            lblerrormsg.Text = "";
            DataSet        ds      = new DataSet();
            cls_GeoFencing obj_geo = new cls_GeoFencing();

            Control     ctl        = e.CommandSource as Control;
            GridViewRow CurrentRow = ctl.NamingContainer as GridViewRow;
            int         row        = CurrentRow.RowIndex;
            object      objTemp    = gv_geoareaList.DataKeys[CurrentRow.RowIndex].Value as object;
            ds = obj_geo.fn_FetchCiruclarGEopoint(Convert.ToInt32(ddlcarrier.SelectedItem.Value), 1, Convert.ToInt32(objTemp));
            if (objTemp != null)
            {
                string geofId  = objTemp.ToString();
                int    fenceid = Convert.ToInt32(geofId);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "MyKey", "initialize('" + ds.Tables[0].Rows[0]["centerLat"] + "', '" + ds.Tables[0].Rows[0]["centerLong"] + "', '" + ds.Tables[0].Rows[0]["fenceRadius"] + "','" + ViewState["cu_lat"].ToString() + "','" + ViewState["cu_long"].ToString() + "','" + ViewState["cu_speed"] + "','" + ddlcarrier.SelectedItem.Text + "');", true);
            }
            txtgeoname.Text = ds.Tables[0].Rows[0]["fenceName"].ToString();

            if (e.CommandName == "editgeo")
            {
                btnsavegeo.Text  = "Update Geofence Area";
                ViewState["fid"] = (e.CommandArgument);
                this.ClientScript.RegisterStartupScript(this.GetType(), "Some Title", "<script language=\"javaScript\">" + "alert('Please do necessary changes and click on update button ');" + "<" + "/script>");
            }
            else if (e.CommandName == "deleteGeo")
            {
                deletegeofence(Convert.ToInt32(e.CommandArgument));
                getcurrentlocload();
                getMapLoad(1);
            }
        }
        catch (Exception ex)
        {
        }
    }
예제 #4
0
    protected void btnsavegeo_Click(object sender, EventArgs e)
    {
        if (txtgeoname.Text == "")
        {
            rfvgeoname.Visible = true;
            return;
        }
        rfvgeoname.Visible = false;
        try
        {
            lblerrormsg.Text = "";
            bool value = datevalidate();
            if (value == true)
            {
                int      i              = 0;
                string   newcenter      = txtcenter.Text;
                string[] newcenterarray = newcenter.Split(',', '(', ')');

                foreach (string word1 in newcenterarray)
                {
                    newcenterarray[i] = word1.ToString();
                    i++;
                }
                string newcenterlat  = newcenterarray[1].ToString();
                string newcenterlong = newcenterarray[2].ToString();

                cls_GeoFencing obj_geo = new cls_GeoFencing();



                obj_geo.AreaName      = txtgeoname.Text;
                obj_geo.IsCircularGF  = 1;
                obj_geo.GeoLatitude1  = float.Parse(newcenterlat);
                obj_geo.GeoLongitude1 = float.Parse(newcenterlong);
                obj_geo.Redius        = float.Parse(txtredius.Text);
                obj_geo.CarrierID     = Convert.ToInt32(ddlcarrier.SelectedItem.Value);

                if (btnsavegeo.Text == "Save Geofence Area")
                {
                    obj_geo.GeofenceId = 0;
                    obj_geo.task       = 1;
                }
                else
                {
                    obj_geo.GeofenceId = Convert.ToInt32(ViewState["fid"].ToString());
                    obj_geo.task       = 2;
                }

                obj_geo.alertst_time  = txtstdt.Text + " " + ddl_HH_geo.SelectedItem.Text + ":" + ddl_MM_geo.SelectedItem.Text + ":" + "00";  // txtTimeStart.Text;;
                obj_geo.alertend_time = txtenddt.Text + " " + ddl_HH_end.SelectedItem.Text + ":" + ddl_MM_end.SelectedItem.Text + ":" + "00"; // txtTimeEnd.Text;;


                int geo_id = obj_geo.fn_relCarrierGeofence_manage(obj_geo);

                if (btnsavegeo.Text == "Save Geofence Area")
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "Some Title", "<script language=\"javaScript\">" + "alert('GeoFence Saved successfully ');" + "<" + "/script>");
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "Some Title", "<script language=\"javaScript\">" + "alert('GeoFence Updated successfully ');" + "<" + "/script>");
                    btnsavegeo.Text = "Save Geofence Area";
                }
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "MyKey", "initialize('" + newcenterlat + "', '" + newcenterlong + "', '" + txtredius.Text + "','" + ViewState["cu_lat"].ToString() + "','" + ViewState["cu_long"].ToString() + "','" + ViewState["cu_speed"] + "','" + ddlcarrier.SelectedItem.Text + "');", true);
                GeoareaList();
            }
        }
        catch (Exception ex)
        {
        }
    }