Ejemplo n.º 1
0
        public HttpResponseMessage CreateSalaryDetail(SalaryDetailInsertDTO objSalary)
        {
            HttpResponseMessage message;

            try
            {
                SalaryDetailDataAccessLayer dal = new SalaryDetailDataAccessLayer();
                var dynObj = new { result = dal.InsertSalaryDetail(objSalary) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" });

                ErrorLog.CreateErrorMessage(ex, "SalaryDetail", "CreateSalaryDetail");
            }
            return(message);
        }
        public bool InsertSalaryDetail(SalaryDetailInsertDTO objSalary)
        {
            bool       res    = false;
            SqlCommand SqlCmd = new SqlCommand("spInsertSalaryDetail");

            SqlCmd.CommandType = CommandType.StoredProcedure;
            SqlCmd.Parameters.AddWithValue("@EmployeeId", objSalary.EmployeeId);
            SqlCmd.Parameters.AddWithValue("@SalaryCompensate", objSalary.SalaryCompensate);
            SqlCmd.Parameters.AddWithValue("@Amount", objSalary.Amount);
            SqlCmd.Parameters.AddWithValue("@CreatedBy", objSalary.CreatedBy);
            int result = new DataBaseLayer().ExecuteNonQuery(SqlCmd);

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