Exemple #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)
        {
        }
    }
Exemple #2
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)
        {
        }
    }