public HttpResponseMessage InsertShiftMapping(ShiftMappingInsertDTO shiftmapping)
        {
            HttpResponseMessage message;

            try
            {
                //  ShiftMappingDataAccessLayer dal = new ShiftMappingDataAccessLayer();
                var dynObj = new { result = _Shift.InsertShiftMapping(shiftmapping) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" });

                ErrorLog.CreateErrorMessage(ex, "ShiftMapping", "InsertShiftMapping");
            }
            return(message);
        }
Example #2
0
        public bool InsertShiftMapping(ShiftMappingInsertDTO shiftMapping)
        {
            bool       res    = false;
            SqlCommand SqlCmd = new SqlCommand("spInsertShiftMapping");

            SqlCmd.CommandType = CommandType.StoredProcedure;
            SqlCmd.Parameters.AddWithValue("@ContractId", shiftMapping.ContractId);
            SqlCmd.Parameters.AddWithValue("@ShiftId", shiftMapping.ShiftId);
            SqlCmd.Parameters.AddWithValue("@StartTime", shiftMapping.StartTime);
            SqlCmd.Parameters.AddWithValue("@EndTime", shiftMapping.EndTime);
            SqlCmd.Parameters.AddWithValue("@CreatedBy", shiftMapping.CreatedBy);
            int result = new DbLayer().ExecuteNonQuery(SqlCmd);

            if (result != Int32.MaxValue)
            {
                res = true;
            }
            return(res);
        }