예제 #1
0
 public HttpResponseMessage SaveDeviceID(ENT.Device obj)
 {
     DAL.Device objDAL = new DAL.Device();
     try
     {
         if (!string.IsNullOrWhiteSpace(obj.DeviceId) && !string.IsNullOrWhiteSpace(obj.DeviceCode))
         {
             if (objDAL.InsertUpdateDeleteDeviceID(obj))
             {
                 return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Data save successfully." }));
             }
             else
             {
                 throw new Exception("Internal Server Error.");
             }
         }
         else
         {
             return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Device ID and Device Token should not be empty or null or white space." }));
         }
     }
     catch (Exception ex)
     {
         ERRORREPORTING.Report(ex, Request.RequestUri.AbsoluteUri, new Guid("00000000-0000-0000-0000-000000000000"), "Gujarat_Intrux", "Function Name : SaveDeviceID()");
         return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { ex.Message }));
     }
 }
        public bool InsertUpdateDeleteDeviceID(ENT.Device objENT)
        {
            bool row = false;

            try
            {
                sqlCMD             = new SqlCommand();
                sqlCMD.CommandText = "InsertUpdateDeleteDeviceID";
                sqlCMD.Parameters.AddWithValue("@DeviceId", objENT.DeviceId);
                sqlCMD.Parameters.AddWithValue("@DeviceCode", objENT.DeviceCode);
                row = objCRUD.InsertUpdateDelete(sqlCMD);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(row);
        }