예제 #1
0
        public GetAllBranchManpowerList GetAllBranchManpower(GetAllBranch objBranch)
        {
            GetAllBranchManpowerList getAllDetails = new GetAllBranchManpowerList();
            List <GetBranchList>     branch        = new List <GetBranchList>();
            List <GetManpowerList>   manpower      = new List <GetManpowerList>();

            using (DbLayer dbLayer = new DbLayer())
            {
                SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByCustomer");
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@CustomerId", objBranch.CustomerId);
                SqlCmd.Parameters.AddWithValue("@ActionBy", objBranch.ActionBy);
                branch = dbLayer.GetEntityList <GetBranchList>(SqlCmd);
                getAllDetails.BranchList = branch;
            }
            using (DbLayer dbLayer = new DbLayer())
            {
                SqlCommand SqlCmd = new SqlCommand("spSelectManpowerAttendanceByManpower");
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@CustomerId", objBranch.CustomerId);
                SqlCmd.Parameters.AddWithValue("@ActionBy", objBranch.ActionBy);
                manpower = dbLayer.GetEntityList <GetManpowerList>(SqlCmd);
                getAllDetails.ManpowerList = manpower;
            }
            return(getAllDetails);
        }
        public HttpResponseMessage getAllBranchManpower(GetAllBranch branch)
        {
            HttpResponseMessage message;

            try
            {
                //  OverAllAttendanceDataAccessLayer dal = new OverAllAttendanceDataAccessLayer();
                var dynObj = new { result = _Attentance.GetAllBranchManpower(branch) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Something wrong. Try Again!" });

                ErrorLog.CreateErrorMessage(ex, "OverAllAttendance", "getAllBranchManpower");
            }
            return(message);
        }