コード例 #1
0
 public HttpResponseMessage InsertMeterSlaveMasterAPI(ENT.MeterSlaveMasterParam obj)
 {
     try
     {
         if (obj != null)
         {
             if (new DAL.MeterSlaveMaster().InsertUpdateDeleteMeterSlaveMasterAPI(obj))
             {
                 return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Data save successfully." }));
             }
             else
             {
                 return(ControllerContext.Request.CreateResponse(HttpStatusCode.InternalServerError, new { response = "Internal Server Error." }));
             }
         }
         else
         {
             return(ControllerContext.Request.CreateResponse(HttpStatusCode.OK, new { response = "Data should not be empty or null." }));
         }
     }
     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 { response = ex.Message }));
     }
 }
コード例 #2
0
        public bool InsertUpdateDeleteMeterSlaveMasterAPI(ENT.MeterSlaveMasterParam objENT)
        {
            bool row = false;

            try
            {
                sqlCMD             = new SqlCommand();
                sqlCMD.CommandText = "InsertUpdateDeleteMeterSlaveMaster";
                sqlCMD.Parameters.AddWithValue("@ID", objENT.ID);
                sqlCMD.Parameters.AddWithValue("@DataDate", objENT.DataDate);
                sqlCMD.Parameters.AddWithValue("@DataTime", objENT.DataTime);
                sqlCMD.Parameters.AddWithValue("@MeterID", objENT.MeterID);
                sqlCMD.Parameters.AddWithValue("@SlaveID", objENT.SlaveID);
                sqlCMD.Parameters.AddWithValue("@Address", objENT.Address);
                sqlCMD.Parameters.AddWithValue("@Quantity", objENT.Quantity);
                sqlCMD.Parameters.AddWithValue("@DataValue", objENT.DataValue);
                sqlCMD.Parameters.AddWithValue("@DataValue2", objENT.DataValue2);
                sqlCMD.Parameters.AddWithValue("@Difference", objENT.Difference);
                sqlCMD.Parameters.AddWithValue("@Value1", objENT.Value1);
                sqlCMD.Parameters.AddWithValue("@Value2", objENT.Value2);
                sqlCMD.Parameters.AddWithValue("@LineCount", objENT.LineCount);
                sqlCMD.Parameters.AddWithValue("@FinalUnit", objENT.FinalUnit);
                sqlCMD.Parameters.AddWithValue("@FileName", objENT.FileName);
                sqlCMD.Parameters.AddWithValue("@EntryDate", objENT.EntryDate);
                row = objCRUD.InsertUpdateDelete(sqlCMD);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(row);
        }