public Object EditDeviceDetails([FromBody] MobileDeviceInput DeviceInput)
        {
            string    sJSONResponse  = "";
            DataTable dt_AppType     = new DataTable();
            string    ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            int       a             = 0;
            string    AppType_Query = "";

            MobileDeviceplanOutput mdpop = new MobileDeviceplanOutput();

            try
            {
                cnn.Open();
                AppType_Query = "update MobileDeviceDetails set Status=" + DeviceInput.status + " where MobileDeviceId='" + DeviceInput.mobileDeviceId + "' ";
                SqlCommand tm_cmd = new SqlCommand(AppType_Query, cnn);
                a            = Convert.ToInt32(tm_cmd.ExecuteScalar());
                mdpop.status = "success";
            }
            catch (Exception ex)
            {
                mdpop.status = "Fail";
            }
            finally
            {
                cnn.Close();
            }

            sJSONResponse = JsonConvert.SerializeObject(mdpop);

            return(sJSONResponse);
        }
        public string GetDeviceDetails([FromBody] MobileDeviceInput Input)
        {
            MobileDeviceOutput         mdo = new MobileDeviceOutput();
            List <MobileDeviceDetails> MobileDeviceclass = new List <MobileDeviceDetails>();
            DataTable dt_DeviceToken = new DataTable();

            dt_DeviceToken = getdata(string.Format("select RegisteredToken,MobileDeviceId,Status from MobileDeviceDetails where MobileDeviceId='{0}' and Status={1} ", Input.mobileDeviceId, Input.status));
            string sJSONResponse = "";

            try
            {
                MobileDeviceDetails MobileDevice = new MobileDeviceDetails {
                    registeredToken = dt_DeviceToken.Rows[0]["RegisteredToken"].ToString()
                };
                MobileDeviceclass.Add(MobileDevice);

                mdo.status    = "success";
                mdo.value     = MobileDeviceclass;
                sJSONResponse = JsonConvert.SerializeObject(mdo);
            }
            catch (Exception ec)
            {
                mdo.status = "fail";

                sJSONResponse = JsonConvert.SerializeObject(mdo);
            }

            return(sJSONResponse);
        }
        public Object DeviceDetails([FromBody] MobileDeviceInput DeviceInput)
        {
            ArrayList arl_MobileExist = new ArrayList();
            string    sJSONResponse   = "";
            DataTable dt_AppType      = new DataTable();
            string    ServerDateTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            int       a             = 0;
            string    AppType_Query = "";

            MobileDeviceplanOutput mdpop = new MobileDeviceplanOutput();

            try
            {
                cnn.Open();

                if (arl_MobileExist[0].ToString() == "0")
                {
                    AppType_Query = "insert into MobileDeviceDetails(RegisteredToken,MobileDeviceId,Status,IsDeleted,IsActive) values('" + DeviceInput.registeredToken + "','" + DeviceInput.mobileDeviceId + "','" + DeviceInput.status + "',0,1) ";
                }
                else if (arl_MobileExist[0].ToString() == "1" && arl_MobileExist[0].ToString() == "0")
                {
                    AppType_Query = "update Users set MobileDeviceId='" + DeviceInput.mobileDeviceId + "' where MobileNo='" + DeviceInput.mobileNo + "'";
                }


                SqlCommand tm_cmd = new SqlCommand(AppType_Query, cnn);
                a            = Convert.ToInt32(tm_cmd.ExecuteScalar());
                mdpop.status = "success";
            }
            catch (Exception ex)
            {
                mdpop.status = "Fail";
            }
            finally
            {
                cnn.Close();
            }

            sJSONResponse = JsonConvert.SerializeObject(mdpop);

            return(sJSONResponse);
        }