public HttpResponseMessage AddPhanCong([FromBody] PhanCongRequest request)
        {
            var response = new PhanCongResponse();

            if (BusinessHandler.TokenBUS.tokenCheck(request, response, 2))
            {
                PhanCongBUS.AddPhanCong(request, ref response);
                if (response.IsError)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, response));
                }
                else
                {
                    if (PhanCongRepository.Insert(request.Data) < 0)
                    {
                        response.Errors.Add("Lỗi hệ thống");
                        response.IsError = true;
                    }
                    else
                    {
                        response.Data = "Thêm thành công!";
                    }
                }
            }

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Exemple #2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            string idNV       = Session["MaNV"].ToString();
            string idCongViec = idCVNV.Value;
            string startDate  = dateStart.Value;
            string endDate    = dateEnd.Value;

            if (service.ThemCongViecNV(idCongViec, startDate, endDate))
            {
                if (servicePC.AddPhanCong(idNV, idCongViec))
                {
                    Response.Redirect("./DanhSachCongViecNv");
                }
            }
        }