Esempio n. 1
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            DoiTac        objDoiTac = new DoiTac();
            List <DoiTac> lstDoiTac = objDoiTac.GetListOfDoiTacs();
            List <BacCao_CuocGoiMoiGioi> lstBacCao_CuocGoiMoiGioi = new List <BacCao_CuocGoiMoiGioi>();
            int i = 0;

            foreach (DoiTac objDT in lstDoiTac)
            {
                BacCao_CuocGoiMoiGioi objCGMG = TimKiem_BaoCao.GetBaoCao_CuocGoiMoiGioi(calTuNgay.Value, calDenNgay.Value, objDT);
                lstBacCao_CuocGoiMoiGioi.Add(objCGMG);
                i++;
                m_fmProgress.lblDescription.Invoke(
                    (MethodInvoker) delegate()
                {
                    m_fmProgress.lblDescription.Text = "Processing ... " + objDT.Name;
                    m_fmProgress.progressBar.Value   = Convert.ToInt32(i * (100.0 / lstDoiTac.Count));
                }
                    );

                if (m_fmProgress.Cancel)
                {
                    // Set the e.Cancel flag so that the WorkerCompleted event
                    // knows that the process was canceled.
                    e.Cancel = true;
                    return;
                }
            }
            gridDienThoai.DataMember = "ListDienThoai";
            gridDienThoai.SetDataBinding(lstBacCao_CuocGoiMoiGioi, "ListDienThoai");
        }
Esempio n. 2
0
        /// <summary>
        /// hàm thực hiện trả về ds anh ba môi giới
        /// </summary>
        public static List <DanhBaEx> GetDanhBaMoiGioi()
        {
            try
            {
                List <DanhBaEx> listRet = new List <DanhBaEx>();
                DoiTac          dt      = new DoiTac();
                List <DoiTac>   listDT  = dt.GetListOfDoiTacs(true);

                foreach (DoiTac doiTac in listDT)
                {
                    // tác số điện thoại
                    string[] arrDienThoai = doiTac.Phones.Split(";".ToCharArray());
                    for (int i = 0; i < arrDienThoai.Length; i++)
                    {
                        DanhBaEx dtx = new DanhBaEx(arrDienThoai[i], doiTac.Name + " - " + doiTac.Address, KieuDanhBa.MoiGioi, doiTac.MaDoiTac, doiTac.Vung, "", doiTac.IsActive, "", doiTac.KinhDo, doiTac.ViDo, "");
                        listRet.Add(dtx);
                    }
                }

                return(listRet);
            }
            catch (Exception ex)
            {
                LogError.WriteLogError("GetDanhBaMoiGioi: ", ex);
                return(new List <DanhBaEx>());
            }
        }
Esempio n. 3
0
        private void LoadDanhSachDoiTac()
        {
            DoiTac objDoiTac = new DoiTac();

            cboDoiTac.DisplayMember = "Name";
            cboDoiTac.ValueMember   = "Ma_DoiTac";
            cboDoiTac.DataSource    = objDoiTac.GetListOfDoiTacs().ToArray();
        }
Esempio n. 4
0
        private void LoadMoiGioi()
        {
            DoiTac objDoiTac = new DoiTac();

            cboMoiGioi.DisplayMember = "Name";
            cboMoiGioi.ValueMember   = "MaDoiTac";
            cboMoiGioi.DataSource    = objDoiTac.GetListOfDoiTacs();
        }
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            if (!g_DaLoadDuLieu)
            {
                DoiTac objDoiTac  = new DoiTac();
                string MaNhanVien = "";
                if ((cboNhanVien.SelectedIndex != 0) && (cboNhanVien.SelectedIndex != -1))
                {
                    MaNhanVien = cboNhanVien.Items[cboNhanVien.SelectedIndex].DataRow.ToString();
                }

                List <DoiTac> lstDoiTac = new List <DoiTac> ();
                if (MaNhanVien.Length > 0)
                {
                    lstDoiTac = objDoiTac.GetListOfDoiTacs_ByNhanVien(MaNhanVien);
                }
                else
                {
                    lstDoiTac = objDoiTac.GetListOfDoiTacs();
                }

                g_lstBacCao_CuocGoiMoiGioi = new List <BacCao_CuocGoiMoiGioi>();
                int i = 0;
                foreach (DoiTac objDT in lstDoiTac)
                {
                    BacCao_CuocGoiMoiGioi objCGMG = TimKiem_BaoCao.GetBaoCao_CuocGoiMoiGioi(calTuNgay.Value, calDenNgay.Value, objDT);


                    if (objCGMG.SoChuyen >= intSoChuyen.Value)
                    {
                        g_lstBacCao_CuocGoiMoiGioi.Add(objCGMG);
                    }

                    i++;
                    m_fmProgress.lblDescription.Invoke(
                        (MethodInvoker) delegate()
                    {
                        m_fmProgress.lblDescription.Text = "Processing ... " + objDT.Name;
                        m_fmProgress.progressBar.Value   = Convert.ToInt32(i * (100.0 / lstDoiTac.Count));
                    }
                        );
                    if (m_fmProgress.Cancel)
                    {
                        // Set the e.Cancel flag so that the WorkerCompleted event
                        // knows that the process was canceled.
                        e.Cancel = true;
                        return;
                    }
                }
            }
            else
            {
                gridDienThoai.DataMember = "ListDienThoai";
                gridDienThoai.SetDataBinding(LocDuLieu(g_lstBacCao_CuocGoiMoiGioi, g_MaNhanVien, g_SoChuyen), "ListDienThoai");
            }
        }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            //g_lstDoiTacActive.
            // llay danh sach doi tác
            DoiTac        objDT = new DoiTac();
            List <DoiTac> lstDT = new List <DoiTac>();

            lstDT = objDT.GetListOfDoiTacs();
            if ((lstDT != null) && (lstDT.Count > 0))
            {
                string strTemp = "";
                foreach (DoiTac objDoiTac in lstDT)
                {
                    // lay dung so dien thoại của doi tac de so sanh
                    string strTrungSo = GetDoiTacsTrungSo(objDoiTac, lstDT);
                    if (strTrungSo.Length > 0)
                    {
                        strTemp += strTrungSo;
                        strTemp += Environment.NewLine + Environment.NewLine + " ";
                    }
                }
                textBox1.Text = strTemp;
            }

            if (lstDTTrung.Count > 0)
            {
                string strText = "";
                foreach (string strS in lstDTTrung)
                {
                    strText += strS + Environment.NewLine;
                }


                new MessageBox.MessageBox().Show("Có trùng số giữa các môi giời");
            }
            else
            {
                new MessageBox.MessageBox().Show("Không có trùng số giữa các môi giới");
            }
        }
Esempio n. 7
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            DoiTac objDoiTac  = new DoiTac();
            string MaNhanVien = "";

            if ((cboNhanVien.SelectedIndex != 0) && (cboNhanVien.SelectedIndex != -1))
            {
                MaNhanVien = cboNhanVien.SelectedItem.Value.ToString();
            }

            List <DoiTac> lstDoiTac = new List <DoiTac> ();

            if (MaNhanVien.Length > 0)
            {
                lstDoiTac = objDoiTac.GetListOfDoiTacs_ByNhanVien(MaNhanVien);
            }
            else
            {
                lstDoiTac = objDoiTac.GetListOfDoiTacs();
            }

            int      iDays      = 0;
            DateTime timeServer = DieuHanhTaxi.GetTimeServer();

            if ((calTuNgay.Value.Month == timeServer.Month) && (calTuNgay.Value.Year == timeServer.Year))
            {
                iDays = timeServer.Day;
            }
            else
            {
                iDays = StringTools.GetDayOfMonth(calTuNgay.Value.Year, calTuNgay.Value.Month);
            }

            DataTable dtDoiTacTheoNgay = CreateTableBaoCao8(iDays);

            int    i         = 0;
            string strYYYYMM = string.Format("{0:yyyy-MM}", calTuNgay.Value);

            foreach (DoiTac objDT in lstDoiTac)
            {
                DataRow dr = dtDoiTacTheoNgay.NewRow();
                dr["MaMoiGioi"]   = objDT.MaDoiTac;
                dr["DiaChi"]      = objDT.Address;
                dr["DienThoais"]  = objDT.Phones;
                dr["TenNhanVien"] = objDT.TenNhanVien;
                int    iTongXe = 0; int iSoChuyen = 0;
                string strDay = "";
                for (int iDay = 1; iDay <= iDays; iDay++)
                {
                    strDay    = strYYYYMM + "-" + StringTools.GeDayString(iDay);
                    iSoChuyen = TimKiem_BaoCao.GetSoChuyenCuocGoiMoiGioiInOneDay(strDay, objDT);
                    dr["Ngay" + iDay.ToString()] = iSoChuyen.ToString();
                    iTongXe += iSoChuyen; iSoChuyen = 0;
                }
                dr["SoChuyen"] = iTongXe.ToString();
                if (iTongXe > (int)intSoChuyen.Value)
                {
                    dtDoiTacTheoNgay.Rows.Add(dr);
                }
                i++;
                m_fmProgress.lblDescription.Invoke(
                    (MethodInvoker) delegate()
                {
                    m_fmProgress.lblDescription.Text = "Processing ... " + objDT.Name;
                    m_fmProgress.progressBar1.Value  = Convert.ToInt32(i * (100.0 / lstDoiTac.Count));
                }
                    );
                if (m_fmProgress.Cancel)
                {
                    // Set the e.Cancel flag so that the WorkerCompleted event
                    // knows that the process was canceled.
                    e.Cancel = true;
                    return;
                }
            }
            gridDienThoai.DataMember = "ListDienThoai";
            gridDienThoai.SetDataBinding(dtDoiTacTheoNgay, "ListDienThoai");
            if (iDays < 31)
            {
                for (int t = iDays + 1; t <= 31; t++)
                {
                    gridDienThoai.RootTable.Columns["Ngay" + t.ToString()].Visible = false;
                }
            }
        }