예제 #1
0
        internal async Task <ResponseModel> SaveMyPunchDetails(PunchInOut source, int loginUserId)
        {
            ResponseModel response = new ResponseModel();

            using (IDbConnection conn = _dbConnection.Connection)
            {
                DynamicParameters param = new DynamicParameters();

                ////if (source.customervendorid > 0)
                ////    param.Add("@Id", source.customervendorid, DbType.Int32);

                ////param.Add("@Name", source.name.Trim(), DbType.String);
                ////param.Add("@Type", source.type.Trim(), DbType.String);
                param.Add("@LoginUserId", loginUserId, DbType.Int32);

                var data = await conn.QueryAsync <int>(Constants.StoredProcedure.SAVEMYPUNCHDETAILS, param, null, null, CommandType.StoredProcedure);

                int result = 0;

                if (data.ToList().Count > 0)
                {
                    result = data.ToList()[0];
                }

                response.ResultStatus   = result;
                response.RequestType    = Constants.RequestType.POST;
                response.SuccessMessage = result == 0 ? string.Empty : "Punch In/Out saved successfully.";
                response.ErrorMessage   = result == 0 ? "Error occurred while saving.  Please try again." : string.Empty;
            }

            return(response);
        }
        public async Task <HttpResponseMessage> SaveMyPunchDetails(PunchInOut source)
        {
            ResponseModel result  = null;
            int?          loginId = Common.GetLoginId(Request.Headers);

            result = await AttendanceDal.Instance.SaveMyPunchDetails(source, Convert.ToInt32(loginId));

            return(SendResult(result));
        }