Ejemplo n.º 1
0
        protected void dgrNhom_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "edit")
            {
                string   id  = ConvertUtility.ToString(e.CommandArgument);
                string[] arr = id.Split('_');

                int idnhom     = ConvertUtility.ToInt32(arr[0]);
                int idTrungTam = ConvertUtility.ToInt32(arr[1]);
                Response.Redirect(AppEnv.AdminUrlParams("nhomcongviec") + "&idTrungTam=" + idTrungTam + "&idnhom=" + idnhom);
            }

            if (e.CommandName == "delete")
            {
                string   id  = ConvertUtility.ToString(e.CommandArgument);
                string[] arr = id.Split('_');

                int idNhom     = ConvertUtility.ToInt32(arr[0]);
                int idTrungTam = ConvertUtility.ToInt32(arr[1]);
                try
                {
                    PhongBanController.DeleteNhomCongViec(idNhom);

                    lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;
                }
                catch (Exception ex)
                {
                    lblStatusUpdate.Text = ex.Message;
                }
            }
        }
Ejemplo n.º 2
0
        public void init()
        {
            List <TblBoPhan> bophan = new BoPhanController().getAllBoPhan();

            comboBox1.DataSource = bophan;
            if (data != null)
            {
                TblPhongBan temp = new PhongBanController().getOnePhongBan(data.MaPhong);
                mode         = EDIT;
                maBPTB.Text  = temp.MaPhong;
                tenBPTB.Text = temp.TenPhong;
                ghiChu.Text  = temp.GhiChu;
                if (data.NgayTLap != null)
                {
                    dateTimePicker1.Value = (DateTime)temp.NgayTLap;
                }
                comboBox1.SelectedValue = temp.MaBoPhan;
            }
            else
            {
                mode = ADD;
                DateTime date = DateTime.Now;
                dateTimePicker1.Value = date;
                btnSave.Enabled       = false;
            }
        }
Ejemplo n.º 3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            DataTable dt = PhongBanController.GetAllNhomCongViec(ConvertUtility.ToInt32(dropTrungTamSearch.SelectedValue));

            dgrNhom.DataSource = dt;
            dgrNhom.DataBind();

            int id = ConvertUtility.ToInt32(Request.QueryString["idnhom"]);

            if (id > 0)
            {
                NhomCongViecInfo info = PhongBanController.GetInfoNhom(id);

                if (info != null)
                {
                    dropTrungTam.SelectedValue = info.IDBoPhan.ToString();
                    txtTen.Text  = info.TenNhomViec;
                    txtMoTa.Text = info.MoTa;
                    txtMa.Text   = info.Ma.ToString();
                }
            }
            else
            {
                btnUpdate.Visible = false;
            }
        }
Ejemplo n.º 4
0
 private void LoadForm()
 {
     //goi hàm tu controller
     if (controller_PhongBan == null)
     {
         controller_PhongBan = new PhongBanController();
     }
     grdViewPhongBan.DataSource = controller_PhongBan.HienThiDanhSachPhongBan();
     grdViewPhongBan.DataBind();
 }
Ejemplo n.º 5
0
        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            int id = ConvertUtility.ToInt32(Request.QueryString["idnhom"]);

            NhomCongViecInfo info = new NhomCongViecInfo();

            info.IDBoPhan    = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
            info.TenNhomViec = txtTen.Text.Trim();
            info.MoTa        = txtMoTa.Text;
            info.Ma          = txtMa.Text;

            PhongBanController.InsertNhomCongViec(info);
        }
Ejemplo n.º 6
0
        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            PhongBanInfo info = new PhongBanInfo();

            info.IDTrungTam            = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
            info.Ten                   = txtTen.Text.Trim();
            info.MoTa                  = txtMoTa.Text;
            info.TyTrong               = ConvertUtility.ToDouble(txtTyTrong.Text);
            info.IDNhanVienTruongPhong = ConvertUtility.ToInt32(dropTruongPhongBan.SelectedValue);
            info.SoNguoi               = 0;
            info.IDParent              = ConvertUtility.ToInt32(dropParent.SelectedValue);
            PhongBanController.Insert(info);
        }
Ejemplo n.º 7
0
        private void BindForm(string mangach)
        {
            if (controller_PhongBan == null)
            {
                controller_PhongBan = new PhongBanController();
            }
            PhongBanInfo recordPhongBan = controller_PhongBan.HienThiRecordPhongBan(mangach);

            //bind text to form
            txtMaPhongBan.Text  = recordPhongBan.MaPhong;
            txtTenPhongBan.Text = recordPhongBan.TenPhong;
            TxtSoNhanVien.Text  = recordPhongBan.SoNhanVien.ToString();
            TxtGhiChu.Text      = recordPhongBan.GhiChu;
        }
Ejemplo n.º 8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Result <TblPhongBan> result = new PhongBanController().deletePhongBan(bophan.MaPhong);

            if (result.Success)
            {
                this.Hide();
                dsbp.getData();
                MessageBox.Show(result.Message.ToString());
            }
            else
            {
                MessageBox.Show(result.Message.ToString());
            }
        }
Ejemplo n.º 9
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = ConvertUtility.ToInt32(Request.QueryString["idphong"]);

            PhongBanInfo info = new PhongBanInfo();

            info.ID                    = id;
            info.IDTrungTam            = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
            info.Ten                   = txtTen.Text.Trim();
            info.MoTa                  = txtMoTa.Text;
            info.TyTrong               = ConvertUtility.ToDouble(txtTyTrong.Text);
            info.IDNhanVienTruongPhong = ConvertUtility.ToInt32(dropTruongPhongBan.SelectedValue);
            info.SoNguoi               = 0;//ConvertUtility.ToInt32(txtSoNguoi.Text);
            info.IDParent              = ConvertUtility.ToInt32(dropParent.SelectedValue);

            PhongBanController.Update(info);
        }
Ejemplo n.º 10
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            DataTable dt = PhongBanController.GetAll(ConvertUtility.ToInt32(dropTrungTamSearch.SelectedValue));

            PhongBanController.LoadPhongBan(dropParent.Items, ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
            dropParent.Items.Insert(0, new ListItem("Root", "0"));

            int id = ConvertUtility.ToInt32(Request.QueryString["idPhong"]);

            if (id > 0)
            {
                PhongBanInfo info = PhongBanController.GetInfo(id);

                if (info != null)
                {
                    dropTrungTam.SelectedValue = info.IDTrungTam.ToString();
                    txtTen.Text     = info.Ten;
                    txtMoTa.Text    = info.MoTa;
                    txtTyTrong.Text = info.TyTrong.ToString();
                    dropTruongPhongBan.SelectedValue = info.IDNhanVienTruongPhong.ToString();
                    try
                    {
                        dropParent.SelectedValue = info.IDParent.ToString();
                    }
                    catch
                    {
                        dropParent.SelectedIndex = -1;
                    }
                }
            }
            else
            {
                btnUpdate.Visible = false;
            }

            dgrPhongBan.DataSource = dt;
            dgrPhongBan.DataBind();
        }
Ejemplo n.º 11
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            TblPhongBan data = new TblPhongBan();

            data.MaPhong  = maBPTB.Text.ToString().Trim();
            data.TenPhong = tenBPTB.Text.ToString().Trim();
            data.GhiChu   = ghiChu.Text.ToString().Trim();
            data.MaBoPhan = comboBox1.SelectedValue.ToString();
            data.NgayTLap = dateTimePicker1.Value;
            if (mode == ADD)
            {
                Result <TblPhongBan> result = new PhongBanController().addPhongBan(data);
                if (result.Success)
                {
                    this.Hide();
                    dsbp.getData();
                    MessageBox.Show(result.Message.ToString());
                }
                else
                {
                    MessageBox.Show(result.Message.ToString());
                }
            }
            else if (mode == EDIT)
            {
                Result <TblPhongBan> result = new PhongBanController().updatePhongBan(data);
                if (result.Success)
                {
                    this.Hide();
                    dsbp.getData();
                    MessageBox.Show(result.Message.ToString());
                }
                else
                {
                    MessageBox.Show(result.Message.ToString());
                }
            }
        }
Ejemplo n.º 12
0
        public void getData()
        {
            List <TblPhongBan> data = new PhongBanController().getAllPhongBan();

            dataGridView1.DataSource = data;
        }