Ejemplo n.º 1
0
 protected void btnEditQT_Click(object sender, DirectEventArgs e)
 {
     try
     {
         if (hdfIDQuyTac.Text == "")
         {
             X.Msg.Alert("Thông báo", "Không tìm thấy quy tắc làm thêm giờ").Show();
             return;
         }
         DAL.QuyTacLamThemGio quyTac = new QuyTacLamThemGioController().GetByID(int.Parse("0" + hdfIDQuyTac.Text));
         if (quyTac == null)
         {
             X.Msg.Alert("Thông báo", "Không tìm thấy quy tắc làm thêm giờ").Show();
             return;
         }
         //cbxQuyTacChonCaLamViec.SetValue(quyTac.FrMaCa);
         tfTuGio.SetValue(quyTac.TuGio);
         tfDenGio.SetValue(quyTac.DenGio);
         cbxLoaiNgay.SetValue(quyTac.LoaiNgay);
         txtHeSoLuong.SetValue(quyTac.NhanHeSo);
         txtOrder.SetValue(quyTac.Order);
         wdQuyTacLamThemGio.Title = "Sửa thông tin quy tắc làm thêm giờ";
         wdQuyTacLamThemGio.Icon  = Icon.ClockEdit;
         wdQuyTacLamThemGio.Show();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message).Show();
     }
 }
Ejemplo n.º 2
0
 protected void btnCapNhatQuyTac_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DAL.QuyTacLamThemGio quyTac = new DAL.QuyTacLamThemGio();
         if (e.ExtraParams["Command"] == "Edit")
         {
             quyTac = new QuyTacLamThemGioController().GetByID(int.Parse("0" + hdfIDQuyTac.Text));
         }
         quyTac.TuGio  = GetTime(tfTuGio.Text);
         quyTac.DenGio = GetTime(tfDenGio.Text);
         if (cbxLoaiNgay.SelectedItem.Value != null)
         {
             quyTac.LoaiNgay = cbxLoaiNgay.SelectedItem.Value;
         }
         if (txtHeSoLuong.Text != "")
         {
             quyTac.NhanHeSo = decimal.Parse("0" + txtHeSoLuong.Text.Replace('.', ','));
         }
         //if (hdfQuyTacFrMaCa.Text != "")
         //    quyTac.FrMaCa = int.Parse(hdfQuyTacFrMaCa.Text);
         //else
         //    quyTac.FrMaCa = int.Parse(cbxQuyTacChonCaLamViec.SelectedItem.Value);
         quyTac.MaCa        = e.ExtraParams["MaCa"].ToString();
         quyTac.CreatedBy   = CurrentUser.ID;
         quyTac.CreatedDate = DateTime.Now;
         quyTac.Order       = int.Parse("0" + txtOrder.Text);
         if (e.ExtraParams["Command"] == "Edit")
         {
             new QuyTacLamThemGioController().Update(quyTac);
             Dialog.ShowNotification("Cập nhật dữ liệu thành công");
             ResourceManager1.RegisterClientScriptBlock("rlst1", "#{wdQuyTacLamThemGio}.hide(); #{grp_QuyTacLamThemGio}.reload();");
         }
         else
         {
             new QuyTacLamThemGioController().Insert(quyTac);
             Dialog.ShowNotification("Thêm mới dữ liệu thành công");
             ResourceManager1.RegisterClientScriptBlock("rlst2", "#{grp_QuyTacLamThemGio}.reload();");
         }
         if (e.ExtraParams["Closed"] == "True")
         {
             wdQuyTacLamThemGio.Hide();
         }
         else
         {
             ResourceManager1.RegisterClientScriptBlock("rlst4", "ResetQuyTacLamThemGio();");
         }
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message).Show();
     }
 }
Ejemplo n.º 3
0
 protected void grp_QuyTacLamThemGio_Store_OnRefreshData(object sender, StoreRefreshDataEventArgs e)
 {
     try
     {
         if (hdfRecordID.Text == "")
         {
             return;
         }
         List <QuyTacLamThemGioInfo> list = new QuyTacLamThemGioController().GetByFrkeyMaCa(int.Parse(hdfRecordID.Text));
         //foreach (var item in list)
         //{
         //    item.TenCa = GetNgayApDung(item.NgayApDung) + " (" + item.GioVao + " - " + item.GioRa + ")";
         //}
         grp_QuyTacLamThemGio_Store.DataSource = list;
         grp_QuyTacLamThemGio_Store.DataBind();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Thông báo", "Lỗi xảy ra khi tải các quy tắc làm thêm giờ: " + ex.Message).Show();
     }
 }