protected void btnImport_Click(object sender, EventArgs e)
        {
            if (fileImport.HasFile)
            {
                if (!Directory.Exists(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/")))
                {
                    Directory.CreateDirectory(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/"));
                }

                string ext = ".xls";

                if (fileImport.FileName.IndexOf(".xlsx") > 0)
                {
                    ext = ".xlsx";
                }
                fileImport.PostedFile.SaveAs(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/") + fileImport.FileName.Replace(ext, "") + "_Temp" + ext);

                string path = Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/") + fileImport.FileName.Replace(ext, "") + "_Temp" + ext;

                if (File.Exists(path))
                {
                    DataTable returnTable = ImportExcelToDataTable.ImportExcel(path);

                    if (returnTable != null && returnTable.Rows.Count > 0)
                    {
                        if (chkDeleteAll.Checked)
                        {
                            QuanLyCongViecKTXVaPSController.DeleteAll(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));
                        }

                        for (int i = 0; i < returnTable.Rows.Count; i++)
                        {
                            try
                            {
                                DataRow row = returnTable.Rows[i];

                                #region Import

                                QuanLyCongViecKTXVaPSInfo info = new QuanLyCongViecKTXVaPSInfo();
                                info.Ten            = row[0].ToString();
                                info.ParentID       = 0;
                                info.TyTrong        = 0;
                                info.KeHoach        = "";
                                info.IDTrungTam     = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
                                info.DonViDo        = "";
                                info.IDPhongBan     = 0;//ConvertUtility.ToInt32(dropPhong.SelectedValue);
                                info.Loai           = 1;
                                info.IDDotDanhGia   = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
                                info.SoGio          = 0;
                                info.IsKPI          = 1;
                                info.NgayBatDau     = DateTime.Now;
                                info.NgayKetThuc    = DateTime.Now;
                                info.IDNhomCongViec = 1;
                                info.TrangThaiCV    = 2;
                                info.TuanLamViec    = "1,2,3,4,5";

                                QuanLyCongViecKTXVaPSController.Insert(info);

                                info     = new QuanLyCongViecKTXVaPSInfo();
                                info.Ten = row[1].ToString();
                                int parentID = GetParentID(row[0].ToString(), ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                                info.ParentID       = parentID;
                                info.TyTrong        = 0;
                                info.KeHoach        = ConvertUtility.ToString(row[3].ToString());
                                info.IDTrungTam     = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
                                info.DonViDo        = "";
                                info.IDPhongBan     = 0;//ConvertUtility.ToInt32(dropPhong.SelectedValue);
                                info.Loai           = 1;
                                info.IDDotDanhGia   = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
                                info.SoGio          = ConvertUtility.ToDouble(row[2].ToString());
                                info.IsKPI          = 1;
                                info.NgayBatDau     = DateTime.Now;
                                info.NgayKetThuc    = DateTime.Now;
                                info.IDNhomCongViec = 1;
                                info.TrangThaiCV    = 2;
                                info.TuanLamViec    = ConvertUtility.ToString(row[4].ToString());

                                QuanLyCongViecKTXVaPSController.Insert(info);

                                if (info.ParentID > 0)
                                {
                                    UpdateCapDoCongViec();
                                }

                                #endregion
                            }
                            catch
                            {
                                continue;
                            }
                        }
                    }
                }
                else
                {
                    lblStatusUpdate.Text = GetLocalResourceObject("lblUpdateStatusResource4.Text").ToString();
                }
            }
            Session["Nav"] = "1";
        }
        protected void cmdAdd_Click(object sender, EventArgs e)
        {
            QuanLyCongViecKTXVaPSInfo info = new QuanLyCongViecKTXVaPSInfo();

            info.Ten            = txtName.Text;
            info.ParentID       = ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue);
            info.TyTrong        = ConvertUtility.ToDouble(txtTyTrong.Text);
            info.KeHoach        = txtKeHoach.Text;
            info.IDTrungTam     = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
            info.DonViDo        = txtDonViDo.Text;
            info.IDPhongBan     = 0;// ConvertUtility.ToInt32(dropPhong.SelectedValue);
            info.Loai           = 1;
            info.IDDotDanhGia   = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
            info.SoGio          = ConvertUtility.ToDouble(txtSoGio.Text);
            info.IsKPI          = ConvertUtility.ToInt32(dropKPIBoPhan.SelectedValue);
            info.NgayBatDau     = ConvertUtility.ToDateTime(dtFrom.Text);
            info.NgayKetThuc    = ConvertUtility.ToDateTime(dtTo.Text);
            info.IDNhomCongViec = ConvertUtility.ToInt32(dropMaNhom.SelectedValue);
            info.TrangThaiCV    = ConvertUtility.ToInt32(dropTrangThai.SelectedValue);

            DateConverter objDate = new DateConverter();

            int tuanBD = objDate.GetWeekOfMonth(info.NgayBatDau);
            int tuanKT = objDate.GetWeekOfMonth(info.NgayKetThuc);

            string tuanLV = "";

            for (int i = tuanBD; i <= tuanKT; i++)
            {
                tuanLV += i + ",";
            }
            info.TuanLamViec = tuanLV.Substring(0, tuanLV.Length - 1);

            try
            {
                QuanLyCongViecKTXVaPSController.Insert(info);

                #region Log Action

                LogFileInfo logFileInfo = new LogFileInfo();
                logFileInfo.Log_Action         = "Add";
                logFileInfo.Log_Type_Object    = "QuanLyCongViecKPI";
                logFileInfo.Item_CatID         = "Cong Viec Thuong Xuyen";
                logFileInfo.Item_ID            = info.ID.ToString();
                logFileInfo.Item_Name          = info.Ten;
                logFileInfo.Description_Before = "Old Data: ";
                logFileInfo.Description_After  = "Add KPI with info: <br />" + GetObjectInfo(info);
                logFileInfo.UserName           = CurrentUser.Username;
                logFileInfo.UserID             = CurrentUser.UserID;
                CreateLogFile.LogAction(logFileInfo);

                #endregion

                lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;

                UpdateCapDoCongViec();

                cmdEmpty_Click(null, null);
            }
            catch (Exception ex)
            {
                lblStatusUpdate.Text = ex.Message;
            }
            Session["Nav"] = "1";
        }