Пример #1
0
        protected void AjaxManager_Request(object sender, AjaxRequestEventArgs e)
        {
            RadTreeNodeEventArgs tne;// = new RadTreeNodeEventArgs(RadTreeView1.SelectedNode);

            switch (e.Argument)
            {
            case "XoaHD":
                Int32 idHD = (Int32)Session["idHD"];
                _entities.DeleteHopDongByID(idHD);
                RadGrid1.Rebind();
                tne = new RadTreeNodeEventArgs(RadTreeView1.SelectedNode);
                RadTreeView1_Nodeclick(sender, tne);
                break;

            case "RebindGrid":
                tne = new RadTreeNodeEventArgs(RadTreeView1.SelectedNode);
                RadTreeView1_Nodeclick(sender, tne);
                break;
            }
        }
Пример #2
0
        protected void grvHopDong_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            int id       = Convert.ToInt32((e.Item as GridDataItem).GetDataKeyValue("IDHopDongLD"));
            var phuluchd = _entities.PhuLucHDs.Where(p => p.IDHopDongLD == id);

            foreach (PhuLucHD pl in phuluchd)
            {
                if (System.IO.File.Exists(pl.TepDinhKem))
                {
                    File.Delete(System.IO.Path.GetFullPath(pl.TepDinhKem));
                }
                _entities.PhuLucHDs.DeleteObject(pl);
            }
            var hopdongld = _entities.HopDongLDs.Where(h => h.IDHopDongLD == id).FirstOrDefault();

            if (System.IO.File.Exists(hopdongld.TepDinhKem))
            {
                File.Delete(System.IO.Path.GetFullPath(hopdongld.TepDinhKem));
            }
            _entities.DeleteHopDongByID(id);
            _entities.SaveChanges();
            LoadGrid();
        }
Пример #3
0
        protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            RadWindowManager radwinmanager = new RadWindowManager();

            switch (e.Item.Value)
            {
            case "Save":
                cboNguoiLD.ShowDropDownOnTextboxClick = false;
                cboNguoiLD.ShowToggleImage            = false;
                HopDongLD hopDongLD = _entities.HopDongLDs.Where(h => h.IDHopDongLD == idHopDong).FirstOrDefault();
                hopDongLD.SoHD               = txtSoHD.Text;
                hopDongLD.NgayKyHD           = txtNgayKyHD.SelectedDate;
                hopDongLD.IDLoaiHD           = Convert.ToInt32(cboLoaiHD.SelectedValue);
                hopDongLD.TuNgay             = txtTuNgayKyHD.SelectedDate;
                hopDongLD.DenNgay            = txtDenNgayKyHD.SelectedDate;
                hopDongLD.IDNguoiDaiDien     = Convert.ToInt32(cboNguoiDaiDien.SelectedValue);
                hopDongLD.IDCoCauToChuc      = Convert.ToInt32(cboDonViLamViec.SelectedValue);
                hopDongLD.DiaDiemLamViec     = txtDiaDiemLamViec.Text;
                hopDongLD.TrinhDoChuyenMon   = txtTrinhDoChuyenMon.Text;
                hopDongLD.IDChucDanhNghiepVu = Convert.ToInt32(cboChucDanhNghiepVu.SelectedValue);
                hopDongLD.IDChucDanhCongViec = Convert.ToInt32(cboChucDanhCongViec.SelectedValue);
                hopDongLD.MucHuong           = Convert.ToInt32(txtMucHuong.Text);
                hopDongLD.IDBacNgach         = Convert.ToInt32(cboBac.SelectedValue);
                if (txtPhuCapCV.Text != "")
                {
                    hopDongLD.PhuCapCV = Convert.ToDecimal(txtPhuCapCV.Text);
                }
                else
                {
                    hopDongLD.PhuCapCV = 0;
                }
                if (txtMucLuongToiThieu.Text != "")
                {
                    hopDongLD.MucLuongToiThieu = Convert.ToDecimal(txtMucLuongToiThieu.Text);
                }
                else
                {
                    hopDongLD.MucLuongToiThieu = 0;
                }
                hopDongLD.GhiChu = txtGhiChu.Text;
                if (txtTepDinhKem.UploadedFiles.Count > 0)
                {
                    string targetFolder = txtTepDinhKem.TargetFolder;
                    hopDongLD.TepDinhKem = Path.Combine(Server.MapPath(targetFolder), txtSoHD.Text.Replace("/", "_") + "_" + txtTepDinhKem.UploadedFiles[0].FileName.Replace(" ", "_"));
                }
                hopDongLD.NgayCapNhat  = DateTime.Now;
                hopDongLD.NguoiCapNhat = idUser;
                try
                {
                    _entities.SaveChanges();
                    FillData();
                    Singleton.RadAlert("Sửa thông tin thành công", 285, 100, "Thành công", "");
                }
                catch (Exception ex)
                {
                    Singleton.RadAlert("Sửa thông tin thất bại", 285, 100, "Lỗi", "");
                    throw ex;
                }
                break;

            case "Report":
                Session["PrintType"] = "HopDong";
                Response.Redirect("InHD.aspx");
                break;

            case "Reset":
//                     txtSoHD.Text = "/" + DateTime.Now.Year.ToString() + "/HĐLĐ/AITS.";
//                     txtNgayKyHD.Clear();
//                     cboLoaiHD.SelectedIndex = -1;
//                     txtTuNgayKyHD.Clear();
//                     txtDenNgayKyHD.Clear();
//                     cboNguoiLD.SelectedIndex = -1;
//                     cboChucDanhNghiepVu.SelectedIndex = -1;
//                     cboChucDanhCongViec.SelectedIndex = -1;
//                     cboNgach.SelectedIndex = -1;
//                     LoadBacNgach(Convert.ToInt32(cboNgach.SelectedValue));
//                     LoadHeSoBacNgach();
//                     txtTrinhDoChuyenMon.Text = "";
//                     cboDonViLamViec.SelectedIndex = -1;
//                     txtMucLuongBHXH.Text = "";
//                     txtMucHuong.Text = "100";
//                     txtPhuCapCV.Text = "";
//                     txtMucLuongToiThieu.Text = "";
//                     cboNguoiDaiDien.SelectedIndex = -1;
//                     txtGhiChu.Text = "";
//                     txtTepDinhKem.UploadedFiles.Clear();
                FillData();
                break;

            case "Remove":
                var phuluchd = _entities.PhuLucHDs.Where(p => p.IDHopDongLD == idHopDong);
                foreach (PhuLucHD pl in phuluchd)
                {
                    if (System.IO.File.Exists(pl.TepDinhKem))
                    {
                        File.Delete(System.IO.Path.GetFullPath(pl.TepDinhKem));
                    }
                    _entities.PhuLucHDs.DeleteObject(pl);
                }
                var hopdongld = _entities.HopDongLDs.Where(h => h.IDHopDongLD == idHopDong).FirstOrDefault();
                if (System.IO.File.Exists(hopdongld.TepDinhKem))
                {
                    File.Delete(System.IO.Path.GetFullPath(hopdongld.TepDinhKem));
                }
                _entities.DeleteHopDongByID(idHopDong);
                _entities.SaveChanges();
                break;

            case "PhuLuc":
                Response.Redirect("ThemPhuLucHD.aspx");
                break;
            }
        }