Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (hdnMSISDN_SIM_ID.Value == "")
                {
                    ShowPopUpMsg("Please Varify Sim Number Or Mobile Number First");
                    return;
                }

                SPOS sp = new SPOS();

                sp.MSISDN_SIM_ID = Convert.ToInt64(hdnMSISDN_SIM_ID.Value);
                sp.CoustomerName = txtCustomerName.Text.Trim();
                sp.Email         = txtEmail.Text.Trim();
                sp.Address       = txtAddress.Text.Trim();
                sp.MobileNumber  = txtAlternateNumber.Text.Trim();
                int distr   = Convert.ToInt32(Session["DistributorID"]);
                int LoginID = Convert.ToInt32(Session["LoginID"]);

                int a = ssc.SavePOSService(distr, LoginID, sp);
                if (a > 0)
                {
                    ShowPopUpMsg("POS Save Successfully");
                    ResetControl(1);
                }
                else
                {
                    ShowPopUpMsg("POS Save UnSuccessfully \n Please Try Again");
                }
            }
            catch (Exception ex)
            {
                ShowPopUpMsg("POS Save UnSuccessfully \n Please Try Again");
            }
        }
Example #2
0
            /// <summary>
            /// Decode the SPOS command.
            /// 
            /// Ex:
            /// Lat =     2.00000000000000, Lon =     2.00000000000000, Depth =   200.000, P height =     0.000
            /// </summary>
            /// <param name="buffer">Buffer to decode.</param>
            /// <returns>Results of the buffer decoding.</returns>
            public static SPOS DecodeSPOS(string buffer)
            {
                SPOS spos = new SPOS();

                // Seperate each value
                string[] values = buffer.Split(',');

                // Go through each value
                foreach (var val in values)
                {
                    // Find all the values
                    string[] sposVal = val.Split('=');
                    if (sposVal.Length >= 2)
                    {
                        // Latitude
                        if (sposVal[0].Contains("Lat"))
                        {
                            double lat = 0.0;
                            if(double.TryParse(sposVal[1], out lat))
                            {
                                spos.SPOS_Latitude = new Latitude(lat);
                            }
                        }

                        // Longitude
                        if (sposVal[0].Contains("Lon"))
                        {
                            double lon = 0.0;
                            if (double.TryParse(sposVal[1], out lon))
                            {
                                spos.SPOS_Longitude = new Longitude(lon);
                            }
                        }

                        // Water Depth
                        if (sposVal[0].Contains("Depth"))
                        {
                            float depth = 0.0f;
                            if (float.TryParse(sposVal[1], out depth))
                            {
                                spos.SPOS_WaterDepth = depth;
                            }
                        }

                        // Pressure Sensor Height
                        if (sposVal[0].Contains("height"))
                        {
                            float height = 0.0f;
                            if (float.TryParse(sposVal[1], out height))
                            {
                                spos.SPOS_PsensHeight = height;
                            }
                        }

                    }

                }

                return spos;
            }