Пример #1
0
        public async Task <IHttpActionResult> PostLichLamViec(LichLamViec LichLamViec)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LichLamViecs.Add(LichLamViec);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LichLamViecExists(LichLamViec.IDLich))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Ok());
        }
        public int Insert(LichLamViec LichLamViec)
        {
            string sql = string.Format("Insert into LichLamViec(MaNhanVien, Ngay, Ca)  Values('{0}','{1}','{2}')",
                                       LichLamViec.MaNhanVien, LichLamViec.Ngay, LichLamViec.Ca);
            var rs = ProcessData.ExecuteNonQuery(sql);

            return(rs);
        }
Пример #3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            LichLamViec lichlamviec = GetInfo();

            onAdd?.Invoke(lichlamviec);
            onEdit?.Invoke(lichlamviec);
            this.Close();
        }
        public int Update(LichLamViec LichLamViec)
        {
            string sql = string.Format("Update LichLamViec Set  Ngay='{1}', Ca='{2}'  Where MaNhanVien='{0}'",
                                       LichLamViec.MaNhanVien, LichLamViec.Ngay, LichLamViec.Ca);
            var rs = ProcessData.ExecuteNonQuery(sql);

            return(rs);
        }
Пример #5
0
        private LichLamViec GetLichLamViec()
        {
            LichLamViec k = new LichLamViec();

            k.NhanVien.TenNV = cbxTenNV.Text;
            k.Ca             = cbxCa.Text;
            k.Ngay           = dtpNgayLamViec.Value.ToString("dd/MM/yyyy");
            return(k);
        }
Пример #6
0
        private LichLamViec GetInfo()
        {
            LichLamViec lichlamviec = new LichLamViec();

            lichlamviec.MaNhanVien = cmbID.SelectedItem.ToString();
            lichlamviec.Ngay       = dpkDate.Value.ToShortDateString();
            lichlamviec.Ca         = int.Parse(cmbShift.SelectedItem.ToString());

            return(lichlamviec);
        }
Пример #7
0
        public Add_EditEmployeeSchedule(LichLamViec lichlamviec)
        {
            InitializeComponent();
            FillID();

            cmbID.SelectedIndex    = cmbID.Items.IndexOf(lichlamviec.MaNhanVien);
            lblName.Text           = thongtin.GetManagerName(lichlamviec.MaNhanVien);
            dpkDate.Text           = lichlamviec.Ngay;
            cmbShift.SelectedIndex = cmbShift.Items.IndexOf(lichlamviec.Ca.ToString());
        }
 private void frmQuanLyNhanVien_Load(object sender, EventArgs e)
 {
     try
     {
         SetGridViewStyle(dgvLichLamViec);
         BindGrid(LichLamViec.GetAll());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #9
0
 private void btnXoaLichLamViec_Click(object sender, EventArgs e)
 {
     try
     {
         int rowIndex = (int)dgvCapNhatLichLamViec.CurrentRow.Cells[4].Value;
         LichLamViec.Delete(rowIndex);
         BindGrid(LichLamViec.GetAll());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #10
0
        private void ucEmployeeSchedule_EditClick(object sender, EventArgs e)
        {
            LichLamViec lichlamviec = new LichLamViec();

            lichlamviec.MaNhanVien = ucEmployeeSchedule.GridView.CurrentRow.Cells[0].Value.ToString();
            lichlamviec.Ngay       = ucEmployeeSchedule.GridView.CurrentRow.Cells[2].Value.ToString();
            lichlamviec.Ca         = (int)ucEmployeeSchedule.GridView.CurrentRow.Cells[3].Value;

            Add_EditEmployeeSchedule frm = new Add_EditEmployeeSchedule(lichlamviec);

            frm.onEdit += Frm_onEdit3;
            frm.ShowDialog();;
        }
Пример #11
0
 private void frmCapNhatLichLamViec_Load(object sender, EventArgs e)
 {
     try
     {
         SetGridViewStyle(dgvCapNhatLichLamViec);
         FillTenNhanVienCombobox(NhanVien.GetAll());
         FillCaCombobox(LichLamViec.GetAll());;
         BindGrid(LichLamViec.GetAll());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #12
0
        public async Task <IHttpActionResult> DeleteLichLamViec(int id)
        {
            LichLamViec LichLamViec = await db.LichLamViecs.FindAsync(id);

            if (LichLamViec == null)
            {
                return(NotFound());
            }

            db.LichLamViecs.Remove(LichLamViec);
            await db.SaveChangesAsync();

            return(Ok("SUCCESS"));
        }
Пример #13
0
        private void btnSuaLichLamViec_Click(object sender, EventArgs e)
        {
            LichLamViec s = GetLichLamViec();

            s.LichLamViecID = (int)dgvCapNhatLichLamViec.CurrentRow.Cells[4].Value;
            LichLamViec db = LichLamViec.GetLichLamViec(s.LichLamViecID);

            if (db != null)
            {
                db = s;
                db.InsertUpdate();
                MessageBox.Show("Sửa thành công!");
            }
            BindGrid(LichLamViec.GetAll());
        }
Пример #14
0
 public static LichLamViecDTO ConvertToLichLamViecDTO(LichLamViec item)
 {
     return(new LichLamViecDTO
     {
         CreaterDate = item.CreaterDate,
         Creater_Id = item.Creater_Id,
         Date = item.Date,
         IDLich = item.IDLich,
         IDTimeSlot = item.IDTimeSlot,
         IDPhongKham = item.IDPhongKham,
         NhanVien_Id = item.NhanVien_Id,
         Status = item.Status,
         TimeSlot = TimeSlotsController.ConvertToTimeSlotDTO(item.TimeSlot),
         Registers = item.Registers.Select(q => RegistersController.ConvertToRegisterDTO(q)).ToList(),
     });
 }
Пример #15
0
 public IHttpActionResult GetListLichLamViec(LichLamViec lichLamViec)
 {
     try
     {
         var data = _commentServices.GetLichLamViec(lichLamViec);
         if (data == null)
         {
             return(Ok(GlobalsEnum.GlobalStatus.NOT_FOUND.ToString()));
         }
         return(Ok(data));
     }
     catch (Exception ex)
     {
         NLog.LogManager.GetCurrentClassLogger().Debug("GetListCommentVtaSite(): {0} - {1}" + ex.Message, ex.StackTrace);
         return(NoOK(GlobalsEnum.GlobalStatus.INVALID_DATA));
     }
 }
Пример #16
0
 private void btnThemLichLamViec_Click(object sender, EventArgs e)
 {
     try
     {
         LichLamViec s  = GetLichLamViec();
         LichLamViec db = LichLamViec.GetLichLamViec(s.LichLamViecID);
         if (db == null)
         {
             s.InsertUpdate();
             MessageBox.Show("Thêm Lịch Làm Việc thành công!");
         }
         BindGrid(LichLamViec.GetAll());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #17
0
 private void Frm_onEdit3(LichLamViec lichlamviec)
 {
     lichlamviecbus.Update(lichlamviec);
     ReloadData();
 }
Пример #18
0
 private void Frm_onAdd3(LichLamViec lichlamviec)
 {
     lichlamviecbus.Insert(lichlamviec);
     ReloadData();
 }
 public int Update(LichLamViec dt)
 {
     return(lichlamviecDAO.Update(dt));
 }
 public int Insert(LichLamViec dt)
 {
     return(lichlamviecDAO.Insert(dt));
 }