protected void btnInsert_Click(object sender, EventArgs e)
        {
            if (stateInsertbtn == true)
            {
                ltlAnnouncement.Text = "";
                option = 1;                                         // TRANG THAI INSERT;
                PositionId = 0;
                countPosRoles = 0;
                dtPosRoles = null;

                btnDelete.Enabled = false;
                btnUpdate.Enabled = false;
                btnInsert.Text = "Ghi";
                btnInsert1.Text = "Ghi";
                btnUpdate.Text = "Sửa";
                btnUpdate1.Text = "Sửa";
                stateInsertbtn = false;
                stateUpdatebtn = true;

                bindData(-1);
            }
            else
            {
                try
                {
                    cls_Catalog_Position cPosition = new cls_Catalog_Position();
                    cPosition.Informatic_Level = txtITLevel.Text;
                    cPosition.Management_Level = txtMLevel.Text;
                    cPosition.Other_Requires = txtOther.Text;
                    cPosition.Politics_Level = txtPLevel.Text;
                    cPosition.PositionName = txtPositionName.Text;
                    cPosition.Salary_Level = (float)Convert.ToDouble(txtSalaryLevel.Text);
                    cPosition.Skills = txtSkills.Text;
                    cPosition.Describle = txtDescrible.Text;
                    cPosition.English_LevelId = Convert.ToInt32(dlEngLevel.SelectedValue);
                    cPosition.Education_LevelId = Convert.ToInt16(dlEduLevel.SelectedValue);
                    cPosition.Education_MajorId = Convert.ToInt16(dlEduMajor.SelectedValue);
                    cPosition.Belong_PositionId = Convert.ToInt32(dlBelongName.SelectedValue);
                    cPosition.CreatedTime = DateTime.Now;

                    int posId = cPosition.Insert();

                    if (posId > 0)
                    {
                        ltlAnnouncement.Text = "Cập nhật thông tin VTCV " + txtPositionName.Text + " thành công.";

                        //THEM THONG TIN VE CAC VAI TRO CUA VTCV
                        if (dtPosRoles.Rows.Count > 0)
                        {
                            int index = 0;
                            cls_Catalog_PositionRoles cPosRoles;
                            while (index < dtPosRoles.Rows.Count)
                            {
                                DataRow row = dtPosRoles.Rows[index];
                                cPosRoles = new cls_Catalog_PositionRoles();
                                cPosRoles.Positionid = posId;
                                cPosRoles.Prior_Level = Convert.ToInt16(row["Prior_Level"]);
                                cPosRoles.WorkName = row["WorkName"].ToString();
                                cPosRoles.CreatedTime = DateTime.Now;

                                int result = cPosRoles.Insert();
                                if (result > 0)
                                {
                                    bindRadList();
                                    ltlAnnouncement.Text += "<br/> Thêm thông tin Vai trò: " + cPosRoles.WorkName + " thành công.";
                                }
                                else
                                    ltlAnnouncement.Text += "<br/>Không thêm được thông tin vai trò: " + cPosRoles.WorkName + ".";

                                index++;
                            }
                        }
                    }
                    else if (posId == 0)
                        ltlAnnouncement.Text = "Không cập nhật được thông tin VTCV " + txtPositionName.Text + ".";
                    else
                        ltlAnnouncement.Text = "Trùng tên VTCV " + txtPositionName.Text + ", không thể cập nhật.";
                }
                catch (Exception ex)
                {
                }
            }
        }
        protected void m_grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                string commandName = e.CommandName;
                GridViewRow row = m_grid.FooterRow;
                if (commandName == "Insert")
                {
                    string wName = ((TextBox)row.FindControl("txtIWorkName")).Text;
                    string prior = ((TextBox)row.FindControl("txtIPrior_Level")).Text;

                    if (option != 1)
                    {
                        cls_Catalog_PositionRoles cPRoles = new cls_Catalog_PositionRoles();
                        cPRoles.Positionid = PositionId;
                        cPRoles.WorkName = wName;
                        cPRoles.Prior_Level = Convert.ToInt16(prior);
                        cPRoles.CreatedTime = DateTime.Now;

                        int _result = cPRoles.Insert();
                        if (_result >= 1)
                        {
                            ltlAnnouncement.Text = "Thêm mới nhiệm vụ CV '" + wName + "' thành công!";
                        }
                        if (_result == -1)
                        {
                            ltlAnnouncement.Text = "Nhiệm vụ CV '" + wName + "' đã tồn tại, bạn nên kiểm tra lại!";
                        }
                        if (_result == 0)
                        {
                            ltlAnnouncement.Text = "Có lỗi trong quá trình thêm mới!";
                        }
                    }
                    else
                    {
                        countPosRoles++;
                        if (countPosRoles == 1)
                            dtPosRoles.Rows[0].Delete();
                        DataRow rowDT = dtPosRoles.NewRow();
                        rowDT["Id"] = countPosRoles;
                        rowDT["WorkName"] = wName;
                        rowDT["Prior_Level"] = prior;

                        dtPosRoles.Rows.Add(rowDT);
                    }
                    bindData(-1);
                }
            }
            catch (Exception ex)
            {
                if(option != 1)
                    ltlAnnouncement.Text = "Khong them moi duoc du lieu. Vui long lien he voi quan tri<br>" + ex.Message;
            }
        }