Esempio n. 1
0
        private void LoadcmbNhanVien()
        {
            var cmb = cmbNhanVien;

            cmb.Tag = 0;
            var cls = new clsNhanSu();
            var dt  = cls.GetNhanSu(GlobalVariables.uID_DonVi, 0);

            dt.DefaultView.RowFilter = "TrangThai_DiLam = 'Đang đi làm'";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Properties.SeparatorChar = ',';
            var editValues = new List <string>();

            foreach (DataRow dr in dt.Rows)
            {
                editValues.Add(dr["ID_NhanSu"].ToString());
            }
            var s = string.Join(",", editValues.ToArray());

            cmbNhanVien.SetEditValue(s);

            cmb.Tag = 1;
        }
Esempio n. 2
0
        private void LoadcmbNguoiNhan(int iID_DonVi)
        {
            var cmb = cmbNguoiNhan;

            cmb.Tag = 0;
            clsNhanSu cls = new clsNhanSu();
            DataTable dt  = cls.GetNhanSu(iID_DonVi, 0);

            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Tag = 1;
        }
Esempio n. 3
0
        private void LoadcmbNguoiQuanLy()
        {
            var cmb = cmbNguoiQuanLy;

            cmb.Tag = 0;
            var cls = new clsNhanSu();
            var dt  = cls.GetNhanSu(GlobalVariables.uID_DonVi, 0);

            dt.DefaultView.RowFilter = "TrangThai_DiLam = 'Đang đi làm'";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Tag = 1;
        }
Esempio n. 4
0
        private void LoadcmbNguoiGiaoViec()
        {
            var cmb = cmbNguoiGiaoViec;

            cmb.Tag = 0;
            clsNhanSu cls = new clsNhanSu();
            DataTable dt  = cls.GetNhanSu(17, 0);

            //dt.DefaultView.RowFilter = "Ten_BoPhan = 'Bộ phận Quản lý' AND TrangThai_DiLam = 'Đang đi làm'";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Tag = 1;
        }
Esempio n. 5
0
        private void SendMaill(string ds_IDnhanvien, string noiDung)
        {
            var clsNs     = new clsNhanSu();
            var dt        = clsNs.GetNhanSu(SystemModule.HeThong.GlobalVariables.uID_DonVi, 0);
            var EmailName = "";
            //
            var          mailFrom = "*****@*****.**";
            var          password = "******";
            const string subject  = "Nhắc nhở công việc của phòng tài chính kế toán";
            var          body     = noiDung;

            //
            foreach (DataRow dr in dt.Rows)
            {
                EmailName = dr["Email_CongTy"].ToString();
                if (TrongDS(ds_IDnhanvien, dr["ID_NhanSu"].ToString()))
                {
                    MessageBox.Show("susscess");
                    var fromAddress = new MailAddress(mailFrom, "Phòng tài chính kế toán");
                    var toAddress   = new MailAddress(EmailName, "To Name");
                    var smtp        = new SmtpClient
                    {
                        Host           = "smtp.gmail.com",
                        Port           = 587,
                        EnableSsl      = true,
                        DeliveryMethod = SmtpDeliveryMethod.Network,
                        Credentials    = new NetworkCredential(fromAddress.Address, password),
                        Timeout        = 20000
                    };
                    using (var message = new MailMessage(fromAddress, toAddress)
                    {
                        Subject = subject,
                        Body = body
                    })
                    {
                        smtp.Send(message);
                    }
                }
            }
        }
Esempio n. 6
0
        private void LoadcmbNhanVien()
        {
            if ((cmbNguoiQuanLy.EditValue ?? "").ToString() == "")
            {
                cmbNhanVien.Properties.DataSource = null;
                cmbNhanVien.EditValue             = null;
                return;
            }
            var cmb = cmbNhanVien;

            cmb.Tag = 0;
            var cls = new clsNhanSu();
            var dt  = cls.GetNhanSu(GlobalVariables.uID_DonVi, 0);

            dt.DefaultView.RowFilter = "ID_NhanSu <>" + cmbNguoiQuanLy.EditValue +
                                       " AND TrangThai_DiLam = 'Đang đi làm'";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Tag = 1;
        }
Esempio n. 7
0
        private void LoadcmbCungThucHienCu()
        {
            if ((cmbNhanVienCu.EditValue ?? "").ToString() == "")
            {
                cmbNguoiTHCu.Properties.DataSource = null;
                cmbNguoiTHCu.EditValue             = null;
                return;
            }
            var cmb = cmbNguoiTHCu;

            cmb.Tag = 0;
            clsNhanSu cls = new clsNhanSu();
            DataTable dt  = cls.GetNhanSu(17, 0);

            //dt.DefaultView.RowFilter = "ID_NhanSu <>" + cmbNhanVienCu.EditValue + " AND Ten_BoPhan = 'Bộ phận TCKT' AND TrangThai_DiLam = 'Đang đi làm'";
            dt.DefaultView.RowFilter = "ID_NhanSu <>" + cmbNhanVienCu.EditValue;
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Properties.SeparatorChar = ',';
            cmb.Tag = 1;
        }
Esempio n. 8
0
        private void LoadcmbNhanVien()
        {
            var cmb = cmbNhanVien;

            cmb.Tag = 0;
            clsNhanSu cls = new clsNhanSu();
            DataTable dt  = cls.GetNhanSu(17, 0);

            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "HoTen";
            cmb.Properties.ValueMember   = "ID_NhanSu";
            cmb.Properties.SeparatorChar = ',';
            List <String> editValues = new List <String>();

            foreach (DataRow dr in dt.Rows)
            {
                editValues.Add(dr["ID_NhanSu"].ToString());
            }
            string s = String.Join(",", editValues.ToArray());

            cmbNhanVien.SetEditValue(s);

            cmb.Tag = 1;
        }
Esempio n. 9
0
        public void LoadData()
        {
            fg.Tag = 0;
            //m_iSelectedRow = fg.Row;
            //for (int i = 2; i < cmbTuyChonHienThi.Properties.Items.Count; i++)
            //{
            //    if (cmbTuyChonHienThi.Properties.Items[i].CheckState == CheckState.Checked)
            //    {
            //        string nameCol = cmbTuyChonHienThi.Properties.Items[i].Value.ToString();
            //        fg.Cols[nameCol].Visible = true;
            //    }
            //    else
            //    {
            //        string nameCol = cmbTuyChonHienThi.Properties.Items[i].Value.ToString();
            //        fg.Cols[nameCol].Visible = false;
            //    }
            //}
            m_irowDateOfTimeline = 30;
            fg.Cols.RemoveRange(m_irowDateOfTimeline, (fg.Cols.Count - m_irowDateOfTimeline));
            m_dtD1 = (DateTime)dteNgayBatDau.Value;
            m_dtD2 = (DateTime)dteNgayKetThuc.Value;
            if (m_dtD1.Date > m_dtD2.Date)
            {
                BaseMessages.ShowWarningMessage("Ngày bắt đầu phải nhỏ hơn ngày kết thúc");
                return;
            }
            if ((int)(m_dtD2.Date - m_dtD1.Date).TotalDays > 365)
            {
                BaseMessages.ShowWarningMessage("Khoảng thời gian quá dài");
                return;
            }
            //
            clsCongViec cls = new clsCongViec();

            dt = new DataTable();
            dt = cls.CongViec_SelecAll_List_IDNhanVien_IDTrangThai(m_dtD1, m_dtD2, m_sds_NhanVien, m_sds_TrangThai,
                                                                   m_sds_LoaiCV, m_sds_MucDoUuTien, m_sds_NguoiYeuCau);

            //
            fg.BeginUpdate();
            fg.ClearRows();
            clsDM_LoaiCV cls_LoaiCV = new clsDM_LoaiCV();
            //DataTable dt_LoaiCV = cls_LoaiCV.SelectAll(); // Lay tat ca loai cong viec
            DataTable dt_LoaiCV = new DataTable();

            cls_LoaiCV.ID_DonVi = GlobalVariables.uID_DonVi;        // lay don vi cua nguoi dang nhap
            dt_LoaiCV           = cls_LoaiCV.SelectAll_TheoDonVi(); // Lay tat ca loai cong viec theo don vi
            foreach (DataRow dr in dt_LoaiCV.Rows)
            {
                Row fgRow = fg.Rows.Add();

                fgRow["ID_CongViec"] = "-" + dr["ID_LoaiCV"];
                fgRow["TieuDe"]      = dr["Ten_LoaiCV"];
                fgRow["ID_LoaiCV"]   = dr["ID_LoaiCV"];
                if (dr["ID_LoaiCV_Cha"].ToString() == "")
                {
                }
                else
                {
                    fgRow["ID_CongViec_Goc"] = "-" + dr["ID_LoaiCV_Cha"];
                }
            }
            decimal giaTri = 0;

            foreach (DataRow dr in dt.Rows)
            {
                DateTime d = m_dtD1;
                if (fg.Rows.Count > 1)
                {
                    if (fg.GetDataDisplay(fg.Rows.Count - 1, "Ma_CongViec").ToString() ==
                        dr["Ma_CongViec"].ToString() &&
                        fg.GetDataDisplay(fg.Rows.Count - 1, "Ma_CongViec").ToString() != "")
                    {
                        decimal giaTri_Sau = 0;
                        decimal.TryParse(dr["GiaTri"].ToString(), out giaTri_Sau);
                        giaTri = giaTri + giaTri_Sau;
                        fg.Rows[fg.Rows.Count - 1]["GiaTri"] = giaTri;
                        continue;
                    }
                    decimal.TryParse(dr["GiaTri"].ToString(), out giaTri);
                }

                Row fgRow = fg.Rows.Add();
                //


                fgRow["ID_CongViec"] = dr["ID_CongViec"];
                fgRow["Ma_CongViec"] = dr["Ma_CongViec"];
                fgRow["GiaTri"]      = giaTri;

                fgRow["DS_ID_NhanVien"]  = dr["DS_ID_NhanVien"];
                fgRow["ID_MucDoUuTien"]  = dr["ID_MucDoUuTien"];
                fgRow["TieuDe"]          = dr["TieuDe"];
                fgRow["MoTa"]            = dr["MoTa"];
                fgRow["Ngay_YeuCau"]     = dr["Ngay_YeuCau"];
                fgRow["Ngay_DenHan"]     = dr["Ngay_DenHan"];
                fgRow["ThoiGian_DuKien"] = dr["ThoiGian_DuKien"];
                fgRow["ID_ThoiGian"]     = dr["ID_ThoiGian"];
                if (dr["PhanTramHoanThanh"].ToString() == "")
                {
                    dr["PhanTramHoanThanh"] = 0;
                }
                fgRow["PhanTramHoanThanh"] = dr["PhanTramHoanThanh"] + " %";
                fgRow["Ngay_BatDau"]       = dr["Ngay_BatDau"];
                fgRow["ID_TrangThai"]      = dr["ID_TrangThai"];
                fgRow["ID_LoaiCV"]         = dr["ID_LoaiCV"];
                fgRow["ID_CongViec_Goc"]   = dr["ID_CongViec_Goc"];
                fgRow["Ngay_HoanThanh"]    = dr["Ngay_HoanThanh"];
                fgRow["Ngay_Lap"]          = dr["Ngay_Lap"];
                fgRow["ID_NguoiLap"]       = dr["ID_NguoiLap"];
                fgRow["Ngay_SuaCuoi"]      = dr["Ngay_SuaCuoi"];
                fgRow["ID_NguoiSuaCuoi"]   = dr["ID_NguoiSuaCuoi"];
                fgRow["ID_NguoiYeuCau"]    = dr["ID_NguoiYeuCau"];
                fgRow["Ten_TrangThai"]     = dr["Ten_TrangThai"];
                fgRow["Ten_MucDo"]         = dr["Ten_MucDo"];
                fgRow["ID_NGuoiYeuCau"]    = dr["ID_NGuoiYeuCau"];

                fgRow["Ten_KetQua_DonVi"] = dr["Ten_KetQua_DonVi"];
                fgRow["SoLuong_KeHoach"]  = dr["SoLuong_KeHoach"];
                clsNhanSu clsNS = new clsNhanSu();
                //dt_NhanSu = cls.GetNhanSu(SystemModule.HeThong.GlobalVariables.uID_DonVi, 0);
                dt_NhanSu = clsNS.SelectW_ID_NguoiQuanLy(DataAccess.QLCV.Global.GlobalVariables.GetID_NhanSu(), GlobalVariables.uID_DonVi);
                for (int j = 0; j < dt_NhanSu.Rows.Count; ++j)
                {
                    if (dr["ID_NGuoiYeuCau"].ToString() == dt_NhanSu.Rows[j]["ID_NhanSu"].ToString().Trim())
                    {
                        fgRow["NGuoi_YeuCau"] = dt_NhanSu.Rows[j]["HoTen"].ToString().Trim();
                    }
                }
                //Lấy tên nhân viên
                string   ds_Ten_NhanVien = "";
                string[] ds_ID_NhanVien  = dr["DS_ID_NhanVien"].ToString().Split(',');
                if (ds_ID_NhanVien.Length > 1)
                {
                    for (int i = 0; i < ds_ID_NhanVien.Length; ++i)
                    {
                        foreach (DataRow drNV in dt_NhanSu.Select("ID_NhanSu = " + ds_ID_NhanVien[i].Trim()))
                        {
                            ds_Ten_NhanVien += drNV["HoTen"].ToString().Trim() + ", ";
                            break;
                        }
                    }
                }


                if (ds_Ten_NhanVien.Length > 2)
                {
                    fgRow["ds_NhanVien"] = ds_Ten_NhanVien.Remove(ds_Ten_NhanVien.Length - 2, 1); // Xoa  2 ky tu o cuoi
                }
            }
            //insert loaiCV

            //Add ID_COngViec_Goc bằng ID_LoaiCV
            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; ++r)
            {
                if (fg.GetDataDisplay(r, "ID_CongViec_Goc").ToString() == "" &&
                    int.Parse(fg.GetDataDisplay(r, "ID_CongViec").ToString()) > 0)
                {
                    if (fg.GetDataDisplay(r, "ID_LoaiCV").ToString() == "")
                    {
                    }
                    else
                    {
                        fg.Rows[r]["ID_CongViec_Goc"] = "-" + fg.Rows[r]["ID_LoaiCV"];
                    }
                }
            }
            //Add Node công việc con
            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; ++r)
            {
                fg.Rows[r].Visible = false;
                fg.Rows.InsertNode(r + 1, 0);
                GetDataTwoRow(r + 1, r);
                ++r;
            }
            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; r++)
            {
                if (!fg.Rows[r].Visible)
                {
                    fg.Rows.Remove(r);
                    r = r - 1;
                }
            }
            for (int r = fg.Rows.Fixed; r < fg.Rows.Count; ++r)
            {
                if (fg.Rows[r].Node.Level == 0 && fg.Rows[r].Visible && IsNode0(r))
                {
                    r = TimCongViecGoc(r, 1);
                }
            }
            int level = 1;

            while (TonTaiCongViecGoc(level))
            {
                for (int r1 = fg.Rows.Fixed; r1 < fg.Rows.Count; ++r1)
                {
                    if (fg.Rows[r1].Node.Level == level && fg.Rows[r1].Visible)
                    {
                        r1 = TimCongViecGoc(r1, level + 1);
                    }
                }
                ++level;
            }
            fg.Tree.Column = 1;
            //ShowTimeline(m_dtDtNow);
            DoiMauTrangThai(fg);
            ChiHienThiCoCongViec(chkHienThiKhiCoCV.Checked);
            HienThi_ChuaDoc_Comment();
            SetSTT();
            fg.Row = -1;
            fg.EndUpdate();
            fg.Tag = 1;
            //fg.Row = m_iSelectedRow;
        }