public void Add(DanhMucGoiDichVuChung goiDVChung)
        {
            int    maxRow = goiDichVuChungoRepository.GetMaxRow();
            string lastID = goiDichVuChungoRepository.GetMulti(p => p.RowIDGoiDichVuChung == maxRow).FirstOrDefault().IDGoiDichVuChung;
            int    numID  = Convert.ToInt32(lastID.Substring(5)) + 1;
            string idDV   = string.Empty;

            if (numID <= 9)
            {
                idDV = "DVGXN000" + numID;
            }
            else if (numID > 9 && numID <= 99)
            {
                idDV = "DVGXN00" + numID;
            }
            else if (numID > 99 && numID <= 999)
            {
                idDV = "DVGXN0" + numID;
            }
            else
            {
                idDV = "DVGXN" + numID;
            }
            goiDVChung.IDGoiDichVuChung = idDV;
            goiDichVuChungoRepository.Add(goiDVChung);
        }
Esempio n. 2
0
 public static void UpdateGoiDichVu(this DanhMucGoiDichVuChung goidvchung, DanhMucGoiDichVuChungViewModel goidvchungVM)
 {
     goidvchung.RowIDGoiDichVuChung = goidvchungVM.RowIDGoiDichVuChung;
     goidvchung.IDGoiDichVuChung    = goidvchungVM.IDGoiDichVuChung;
     goidvchung.TenGoiDichVuChung   = goidvchungVM.TenGoiDichVuChung;
     goidvchung.ChietKhau           = goidvchungVM.ChietKhau;
     goidvchung.DonGia = goidvchungVM.DonGia;
 }
Esempio n. 3
0
        public HttpResponseMessage Create(HttpRequestMessage request, DanhMucGoiDichVuChungViewModel dichvuVm)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest, ModelState);
                }
                else
                {
                    DanhMucGoiDichVuChung gdv = Mapper.Map <DanhMucGoiDichVuChungViewModel, DanhMucGoiDichVuChung>(dichvuVm);
                    this.goiDichVuChungService.Add(gdv);
                    goiDichVuChungService.Save();
                    response = request.CreateResponse(HttpStatusCode.Created, dichvuVm);
                }

                return response;
            }));
        }
 public void Update(DanhMucGoiDichVuChung goiDVChung)
 {
     this.goiDichVuChungoRepository.Update(goiDVChung);
 }