Ejemplo n.º 1
0
        public void setDeadline(string time)
        {
            DateTime _time = Convert.ToDateTime(time);

            _second = _time.Second - DateTime.Now.Second;
            _minute = _time.Minute - DateTime.Now.Minute;
            _hour   = _time.Hour - DateTime.Now.Hour;
            _year   = _time.Year - DateTime.Now.Year;

            if (_year == 0)
            {
                _day = _time.DayOfYear - DateTime.Now.DayOfYear;
            }
            else
            {
                _day = _time.DayOfYear - DateTime.Now.DayOfYear + 366;
            }

            checkdatetime();
            converttostring();
            //lbTime.Visible = true;
            if (_day < 0)
            {
                Timer.Enabled = false;
                lbTime.Text   = "Time-expired!";
                DataHandle.getInstance().SendEmail("Project " + this.lbProjectName.Text + " đã quá thời gian!", "Bạn chưa hoàn thành " + _viecchualam + " công việc.\nTiến độ công việc " + lbComplete.Text.Substring(10) + ".", email);
            }
            else
            {
                lbTime.Text = _day + ":" + hour + ":" + minute + ":" + second;
            }
            lbTime.Location = new System.Drawing.Point(this.Width - this.lbTime.Width - 5, 277);
            Console.WriteLine(lbTime.Text);
        }
Ejemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (txtTittle.Text == "")
     {
         MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     if (DataHandle.getInstance().checkTittleReminder(txtTittle.Text) == false)
     {
         MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         DataHandle.getInstance().CreateNewReminder(
             new Reminders()
         {
             Tittle  = txtTittle.Text,
             Content = txtContent.Text,
             Time    = dateTimePicker1.Value.ToString(),
             Check   = Convert.ToInt32(checkBox.Checked),
             User_id = User_ID
         });
         DataHandle.getInstance().ShowNote();
         this.Dispose();
     }
 }
Ejemplo n.º 3
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtTittle.Text == "")
     {
         MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     if (DataHandle.getInstance().checkTittleToDoList(txtTittle.Text) == false)
     {
         MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         int p = 1;
         if (txtbox.Count() == 0)
         {
             MessageBox.Show("Thêm list to do", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             DataHandle.getInstance().CreateMyToDoList(txtTittle.Text, User_ID);
             foreach (string t in txtbox)
             {
                 DataHandle.getInstance().CreateNewToDoList(txtTittle.Text, t, p, 0);
                 p++;
             }
             DataHandle.getInstance().ShowNote();
             this.Dispose();
         }
     }
 }
Ejemplo n.º 4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (txtTittle.Text == "")
     {
         MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     if (DataHandle.getInstance().checkEditTittleToDoList(txtTittle.Text) == false)
     {
         MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (eitem.Count() == 0 && newitem.Count() == 0)
         {
             MessageBox.Show("Thêm list to do", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             DataHandle.getInstance().EditToDoList(txtTittle.Text, eitem);
             foreach (ItemTDLs i in newitem)
             {
                 DataHandle.getInstance().CreateNewToDoList(txtTittle.Text, i.Content, i.STT, Convert.ToInt32(i.check));
             }
             foreach (ItemTDLs i in deletedItem)
             {
                 DataHandle.getInstance().DeleteItemInToDoList(txtTittle.Text, i.STT);
             }
             DataHandle.getInstance().ShowNote();
             this.Dispose();
         }
     }
 }
Ejemplo n.º 5
0
        protected override void BandingReport()
        {
            //定义报表参数对象
            List <ReportParameter>      parameterList = new List <ReportParameter>();
            Dictionary <string, string> paramDic      = RdlcParam();

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            parameterList.Add(new ReportParameter("PollutionName", PollutionName));
            parameterList.Add(new ReportParameter("PollutionNo", PollutionNo));

            string ReportPath = "Areas\\Report\\Template\\AirYear.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);
            DataTable table = MonitorData.GetMonitorDataForReportAir(Request.QueryString["dataFrom"], startTime, endTime, Request.QueryString["type"], Request.QueryString["id"], "month");

            DataHandle.TableDataStyle(table, "DATA_TIME", Request.QueryString["rdlcType"]);
            ReportDataSource rds = new ReportDataSource("AirHour", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                 //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                           //刷新报表
        }
Ejemplo n.º 6
0
        public List <T> ExeSelectListM <T>(List <T> baselst) where T : DtBase, new()
        {
            T        dto = new T();
            List <T> lst = new List <T>();

            DataTable dt = Select(dto.MakeSelectAll());

            DataHandle.Table2List(dt, lst);

            for (int i = 0; i < baselst.Count; i++)
            {
                T    itm1 = baselst[i];
                bool fEql = false;
                for (int j = 0; j < lst.Count; j++)
                {
                    T itm2 = lst[j];
                    if (itm1.KeyEqual(itm2))
                    {
                        fEql = true;
                        break;
                    }
                }
                if (!fEql)
                {
                    lst.Add(itm1);
                }
            }

            return(lst);
        }
Ejemplo n.º 7
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (txtTittle.Text == "")
            {
                MessageBox.Show("Không thể để trống!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            if (DataHandle.getInstance().checkTittleNote(txtTittle.Text) == false)
            {
                MessageBox.Show("Tittle đã tồn tại!", "Nhập lại", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DataHandle.getInstance().CreateNewNote(
                    new Notes()
                {
                    Tittle  = txtTittle.Text,
                    Content = txtContent.Text,
                    user_id = User_ID
                });

                DataHandle.getInstance().ShowNote();
                this.Dispose();
            }
        }
Ejemplo n.º 8
0
        protected override void BandingReport()
        {
            //定义报表参数对象
            List <ReportParameter> parameterList = new List <ReportParameter>();
            var paramDic = RdlcParam(Request.QueryString["rdlcType"]);

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            string ReportPath = "Areas\\Report\\Template\\PollutionCompanyWarn.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);

            DataTable table = MonitorData.GetPollutionWarnData(startTime, endTime, Request.QueryString["type"], Request.QueryString["id"], dataType);

            DataHandle.TableDataStyle(table, "DATA_TIME", Request.QueryString["rdlcType"]);
            ReportDataSource rds = new ReportDataSource("PollutionCompanyWarn", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                              //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                             //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                                        //刷新报表
        }
Ejemplo n.º 9
0
        private void StoreMeshData <TVertex>(TVertex[] vertices, int[] indices, dReal[] normals)
        {
            ReleaseDataStores();
            verticesData = new DataHandle(vertices.Length * Marshal.SizeOf(typeof(TVertex)));
            indicesData  = new DataHandle(indices.Length * Marshal.SizeOf(typeof(int)));

            float[] floatVertices = vertices as float[];
            if (floatVertices != null)
            {
                verticesData.Copy(floatVertices);
            }

            double[] doubleVertices = vertices as double[];
            if (doubleVertices != null)
            {
                verticesData.Copy(doubleVertices);
            }

            indicesData.Copy(indices);
            if (normals != null)
            {
                normalsData = new DataHandle(normals.Length * Marshal.SizeOf(typeof(int)));
                normalsData.Copy(normals);
            }
        }
Ejemplo n.º 10
0
        public void setComplete()
        {
            double x = 0;
            double y = 0;

            Projects p = DataHandle.getInstance().GetDataProject();

            foreach (ItemProjects i in p.item)
            {
                if (i.check == true)
                {
                    x++;
                }
                y++;
            }
            double a = y - x;

            x = ((x / y) * 100);
            if (x.ToString().Length > 5)
            {
                z = x.ToString().Substring(0, 5);
            }
            else
            {
                save = Convert.ToInt32(y - x);
                z    = x.ToString();
            }

            Form1.getInstance().ShowProject(p.Tittle, p.item, z, p.deadline, Convert.ToInt32(a));
        }
Ejemplo n.º 11
0
        protected override void BandingReport()
        {
            //定义报表参数对象
            List <ReportParameter> parameterList = new List <ReportParameter>();
            var paramDic = RdlcParam(Request.QueryString["rdlcType"]);

            foreach (var key in paramDic.Keys)
            {
                parameterList.Add(new ReportParameter(key, paramDic[key]));
            }
            dynamic companyInfo = BaseCommonInfo.GetCompanyOrPK(Request.QueryString["type"], Request.QueryString["id"]);

            parameterList.Add(new ReportParameter("PollutionName", companyInfo.Name));
            parameterList.Add(new ReportParameter("PollutionNo", companyInfo.Code));


            string ReportPath = "Areas\\Report\\Template\\VocsHour.rdlc";

            ReportViewer1.LocalReport.ReportPath             = ReportPath;
            ReportViewer1.LocalReport.ReportEmbeddedResource = "Tablix1";
            ReportViewer1.LocalReport.SetParameters(parameterList);

            DataTable table = MonitorData.GetMonitorDataForReportVocs(Request.QueryString["dataFrom"], startTime, endTime, Request.QueryString["type"], Request.QueryString["id"], dataType);

            DataHandle.TableDataStyle(table, "DATA_TIME", Request.QueryString["rdlcType"]);
            ReportDataSource rds = new ReportDataSource("VocsMonitor", table); //指定数据源GetTestDataTable()

            ReportViewer1.LocalReport.DataSources.Clear();                     //报表数据源清除,必须
            ReportViewer1.LocalReport.DataSources.Add(rds);                    //报表数据源增加
            ReportViewer1.LocalReport.Refresh();                               //刷新报表
        }
Ejemplo n.º 12
0
        public void populateAccounts()
        {
            List <NoteMakingApp.Models.Account> accounts = DataHandle.getInstance().GetAccounts();

            switch (cbOrder.SelectedItem)
            {
            case "Created":
                accounts.OrderBy(a => a.created).ToList();
                break;

            case "Username":
            default:
                accounts.OrderBy(a => a.username).ToList();
                break;
            }
            accounts = accounts.FindAll(a => a.username.Contains(tbSearch.Text));
            if (!increasingOrder)
            {
                accounts.Reverse();
            }

            this.pnlList.Controls.Clear();
            AccountListItem item;

            foreach (NoteMakingApp.Models.Account a in accounts)
            {
                item          = new AccountListItem(a, accounts.IndexOf(a) + 1);
                item.Location = new System.Drawing.Point(0, this.pnlList.Controls.Count * item.Height);
                this.pnlList.Controls.Add(item);
            }
        }
Ejemplo n.º 13
0
        private void KhoiTaoHocPhi(string maTre, DateTime start, DateTime end)
        {
            List <ThangNam> listThangNam = DataHandle.GetThoiGianTrongKhoan(start, end);

            foreach (ThangNam tn in listThangNam)
            {
                TreBLL.KhoiTaoHocPhi(maTre, tn.thang, tn.nam);
            }
        }
Ejemplo n.º 14
0
        private static void ReleaseDataStore(ref DataHandle storeHandle)
        {
            if (storeHandle != null)
            {
                storeHandle.Close();
            }

            storeHandle = null;
        }
Ejemplo n.º 15
0
        private void TCP_Connect(object state)
        {
            TcpClient Tcp_Client = state as TcpClient;

            DataHandle.WriteLog($"接收来自{Tcp_Client.Client.RemoteEndPoint},当前线程数:{ThreadPool.ThreadCount}");
            NetworkStream TCP_Stream = Tcp_Client.GetStream();
            var           State_VT   = (Tcp_Client, TCP_Stream);

            TCP_Stream.BeginRead(Receive_Data, 0, Data_Size, new AsyncCallback(TCP_Receive), State_VT);
        }
Ejemplo n.º 16
0
        public Socsk_Listen(IPAddress IP, int Port)
        {
            Receive_Data = new byte[Data_Size];
            dataHandle   = new DataHandle();
            TcpListener Socks_Server = new TcpListener(IP, Port);

            Program.PrintLog(string.Format("Socks服务已启动,监听{0}端口中", Port));
            Socks_Server.Start();
            Socks_Server.BeginAcceptTcpClient(AcceptTcpClient, Socks_Server);
        }
Ejemplo n.º 17
0
 private void btnTest_Click(object sender, RoutedEventArgs e)
 {
     if (txtTest.Text != null)
     {
         txtbShow.Text += ("\n" + DataHandle.Handle(txtTest.Text));
     }
     else
     {
         MessageBox.Show("输入测试字符串");
     }
 }
Ejemplo n.º 18
0
 private bool checkData(NoteMakingApp.Models.Account acc)
 {
     if (DataHandle.getInstance().doesAccountExit(acc))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 19
0
        public List <T> ExeSelectList <T>() where T : DtBase, new()
        {
            T        dto = new T();
            List <T> lst = new List <T>();

            DataTable dt = Select(dto.MakeSelectAll());

            DataHandle.Table2List(dt, lst);

            return(lst);
        }
Ejemplo n.º 20
0
        public static PersonalDetailsPanel getInstance(int acc)
        {
            if (instance == null)
            {
                instance = new PersonalDetailsPanel();
            }
            instance.account = acc;
            instance.person  = DataHandle.getInstance().GetPerson(acc);
            if (instance.person != null)
            {
                instance.lbName.Text         = instance.person.name;
                instance.lbIntroduction.Text = instance.person.introduction;
            }
            else
            {
                instance.lbName.Text         = "";
                instance.lbIntroduction.Text = "";
            }
            instance.btnEdit.Visible = acc == DataHandle.getInstance().getRecentAccount().id;

            List <PersonalDetail>  details = DataHandle.getInstance().GetDetails(acc);
            List <PersonalDetail>  categorisedDetails;
            CategorisedDetailPanel categoryPanel;

            instance.pnlCategories.Controls.Clear();
            bool nodetails = true;

            foreach (string c in PersonalDetail.categories)
            {
                categorisedDetails = details.FindAll(d => d.category == c);

                categoryPanel          = new CategorisedDetailPanel(c, categorisedDetails, acc == DataHandle.getInstance().getRecentAccount().id);
                categoryPanel.Location = new System.Drawing.Point(0,
                                                                  instance.pnlCategories.Controls.Count == 0 ? 0 :
                                                                  instance.pnlCategories.Controls[instance.pnlCategories.Controls.Count - 1].Location.Y +
                                                                  instance.pnlCategories.Controls[instance.pnlCategories.Controls.Count - 1].Size.Height);
                instance.pnlCategories.Controls.Add(categoryPanel);
                if (categorisedDetails.Count != 0)
                {
                    nodetails = false;
                }
            }
            if (instance.person == null && nodetails)
            {
                instance.label1.Visible = true;
            }
            else
            {
                instance.label1.Visible = false;
            }
            instance.PerformLayout();
            instance.Refresh();
            return(instance);
        }
Ejemplo n.º 21
0
 public void Close()
 {
     try
     {
         DataHandle.WriteLog(string.Format("已关闭{0}的UDP代理隧道", Client_Point));
         UDP_Client.Close();
         TCP_Client.GetStream().Close();
         TCP_Client.Close();
     }
     catch (Exception) {
     }
 }
Ejemplo n.º 22
0
        private void KhoiTaoSucKhoe(List <string> listMatre, DateTime start, DateTime end)
        {
            List <ThangNam> listThangNam = DataHandle.GetThoiGianTrongKhoan(start, end);

            foreach (ThangNam tn in listThangNam)
            {
                foreach (string maTre in listMatre)
                {
                    TreBLL.KhoiTaoSucKhoe(maTre, tn.thang, tn.nam);
                }
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// 关闭UDP对象及TCP依赖
 /// </summary>
 public void Close()
 {
     try
     {
         DataHandle.WriteLog($"已关闭{Client_Point}的UDP代理隧道");
         UDP_Client.Close();
         TCP_Client.GetStream().Close();
         TCP_Client.Close();
     }
     catch (Exception) {
     }
 }
Ejemplo n.º 24
0
 /// <summary>
 /// 关闭客户端连接
 /// </summary>
 /// <param name="Tcp_Client">客户端TCPClient</param>
 private void Close(TcpClient Tcp_Client)
 {
     try
     {
         if (Tcp_Client.Connected)
         {
             DataHandle.WriteLog($"已关闭客户端{Tcp_Client.Client.RemoteEndPoint}的连接");
             Tcp_Client.GetStream().Close();
             Tcp_Client.Close();
         }
     }
     catch (SocketException) {
     }
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Pins the object to be allocated by cvSetData.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        // ReSharper disable once InconsistentNaming
        protected internal GCHandle AllocGCHandle(object obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (DataHandle.IsAllocated)
            {
                DataHandle.Free();
            }
            DataHandle = GCHandle.Alloc(obj, GCHandleType.Pinned);
            return(DataHandle);
        }
Ejemplo n.º 26
0
        public static void Main(
            string[] args
            )
        {
            DataHandle DH = DataHandle.getHandle(
                "server=192.168.56.101;" +
                "uid=logrpg;" +
                "pwd=logrpg;" +
                "database=logrpg;" +
                "Allow User Variables=True;"
                );

            DH.Auth("kevok", "logrpg");
        }
Ejemplo n.º 27
0
 private void Register_Click(object sender, EventArgs e)
 {
     if (checkUsername() && checkPassword() && checkConfirmation())
     {
         DataHandle.getInstance().saveAccount(
             new NoteMakingApp.Models.Account()
         {
             username = iUsername.Text,
             password = iPassword.Text,
             creator  = 0
         });
         nullifyField();
         Form1.getInstance().setWindow("Login");
     }
 }
Ejemplo n.º 28
0
 public ListProject()
 {
     InitializeComponent();
     instance = this;
     this.flowLayoutPanel1.Controls.Clear();
     DataHandle.getInstance().GetDataFromProject();
     AddProject(0, "New Project");
     foreach (Projects t in DataHandle.prjs)
     {
         if (t.user_id == user_id)
         {
             AddProject(t.id, t.Tittle);
         }
     }
 }
Ejemplo n.º 29
0
        private void LoadListChiTietHocPhi()
        {
            dgvChiTietHocPhi.DataSource = DataHandle.ListToDataTable(listChiTietHocPhi);

            dgvChiTietHocPhi.Columns[3].HeaderText = "Tên chi phí";
            dgvChiTietHocPhi.Columns[4].HeaderText = "Số tiền";

            dgvChiTietHocPhi.Columns[3].Width = 150;
            dgvChiTietHocPhi.Columns[4].Width = 100;

            string[] listProp = { "STT", "TenChiPhi", "SoTien" };
            ControlFormat.DataGridViewFormat(dgvChiTietHocPhi, listProp);

            dgvChiTietHocPhi.ClearSelection();
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Releases unmanaged resources
 /// </summary>
 protected virtual void DisposeUnmanaged()
 {
     if (DataHandle.IsAllocated)
     {
         DataHandle.Free();
     }
     if (AllocatedMemorySize > 0)
     {
         GC.RemoveMemoryPressure(AllocatedMemorySize);
         AllocatedMemorySize = 0;
     }
     if (AllocatedMemory != IntPtr.Zero)
     {
         Marshal.FreeHGlobal(AllocatedMemory);
         AllocatedMemory = IntPtr.Zero;
     }
 }