Beispiel #1
0
        private string ConvertDataTableToHTMLTable()
        {
            DataTable dt = SqlDataAccessHelper.ExecuteQueryString("select * from RelationDept");

            string messageBody = "<font>The following are the records: </font><br><br>";

            if (dt.Rows.Count == 0)
            {
                return(messageBody);
            }
            string htmlTableStart     = "<table style=\"border-collapse:collapse; text-align:center;\" >";
            string htmlTableEnd       = "</table>";
            string htmlHeaderRowStart = "<tr style =\"background-color:#6FA1D2; color:#ffffff;\">";
            string htmlHeaderRowEnd   = "</tr>";
            string htmlTrStart        = "<tr style =\"color:#555555;\">";
            string htmlTrEnd          = "</tr>";
            string htmlTdStart        = "<td style=\" border-color:#5c87b2; border-style:solid; border-width:thin; padding: 5px;\">";
            string htmlTdEnd          = "</td>";

            messageBody += htmlTableStart;
            messageBody += htmlHeaderRowStart;
            messageBody += htmlTdStart + "Description " + htmlTdEnd;
            messageBody += htmlHeaderRowEnd;

            foreach (DataRow Row in dt.Rows)
            {
                messageBody = messageBody + htmlTrStart;
                messageBody = messageBody + htmlTdStart + Row["Description"] + htmlTdEnd;
                messageBody = messageBody + htmlTrEnd;
            }
            messageBody = messageBody + htmlTableEnd;


            return(messageBody);
        }
Beispiel #2
0
        private void demo_loadTree_Load(object sender, EventArgs e)
        {
            var tablePB = SqlDataAccessHelper.ExecuteQueryString("select * from RelationDept");

            loadTreePhgBan(treeView1, tablePB);
            treeView1.AfterSelect += treePhongBan_AfterSelect;
        }
Beispiel #3
0
        public DataTable DocDSCheck(List <int> dsnv, DateTime gioBD, DateTime gioKT)
        {
            #region query

            string query   = @" select * from CheckInOut where TimeStr between (@giobd and @giokt) ";
            string chuoiOR = TaoChuoiOR(dsnv, "CheckInOut.UserEnrollNumber");
            query += " AND " + chuoiOR;

            #endregion

            DataTable tableCheckk = SqlDataAccessHelper.ExecuteQueryString(query, new[] { "@giobd", "@giokt" }, new object[] { gioBD, gioKT });
            return(tableCheckk);

            /*
             *          tableChkINN_Auto = tableCheckk.Clone();
             *          tableChkOUT_Auto = tableCheckk.Clone();
             *          DataRow[] arrChkINN_Auto = tableCheckk.Select("MachineNo % 2 = 1 and (IDXacNhanCaVaLamThem is null)");
             *          DataRow[] arrChkOUT_Auto = tableCheckk.Select("MachineNo % 2 = 0 and (IDXacNhanCaVaLamThem is null) ");
             *          DataRow[] arrChkINN_DaXN = tableCheckk.Select("MachineNo % 2 = 1 and (IDXacNhanCaVaLamThem is not null)");
             *          DataRow[] arrChkOUT_DaXN = tableCheckk.Select("MachineNo % 2 = 0 and (IDXacNhanCaVaLamThem is not null) ");
             *          Loc(arrChkINN_Auto, tableChkINN_Auto);
             *          Loc(arrChkOUT_Auto, tableChkOUT_Auto);
             */
            //ToDataTable(arrChkINN_DaXN, ta);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            table = SqlDataAccessHelper.ExecuteQueryString("select * from UserInfo where UserEnrollNumber between 9000 and 9500", null, null);
            var collection = new AutoCompleteStringCollection()
            {
            };
            var arrString = new string[table.Rows.Count];

            for (var i = 0; i < table.Rows.Count; i++)
            {
                arrString[i] = table.Rows[i]["UserFullCode"].ToString() + table.Rows[i]["UserFullName"].ToString();
            }
            collection.AddRange(arrString);
            tb1.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            tb1.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            tb1.AutoCompleteCustomSource = collection;
            dataGridView1.DataSource     = table;

            //Debug.WriteLine("dataGridView1.DataSource = table ");

            var table2 = SqlDataAccessHelper.ExecuteQueryString("select * from Shifts");

            comboBox1.ValueMember   = "ShiftID";
            comboBox1.DisplayMember = "ShiftCode";
            comboBox1.DataSource    = table2;
        }
        private void btnLoadDataSource_Click(object sender, EventArgs e)
        {
            DataTable tableNV = SqlDataAccessHelper.ExecuteQueryString("select * from UserInfo");

            checkedComboBoxEdit1.Properties.DataSource    = tableNV;
            checkedComboBoxEdit1.Properties.DisplayMember = "UserFullName";
            checkedComboBoxEdit1.Properties.ValueMember   = "UserEnrollNumber";
        }
Beispiel #6
0
        public void XemCong(List <int> dsnv, DateTime ngaybd, DateTime ngaykt)
        {
            DataTable table = SqlDataAccessHelper.ExecuteQueryString(
                @"select * from UserInfo, RelationDept where UserInfo.UserIDD = 294 and UserInfo.UserIDD = RelationDept.ID and UserInfo.Enabled = 1");
            List <string> iLstUserEnrollNumber = LayArrIDStr("UserEnrollNumber", table);

            DataTable tableCheck = DocDSCheck(dsnv, ngaybd, ngaykt);

            for (int i = 0; i < dsnv.Count; i++)
            {
                #region query

                string query = @"SELECT 
  dbo.UserInfo.UserEnrollNumber,
  dbo.Shifts.ShiftID,
  dbo.Shifts.ShiftCode,
  dbo.Shifts.Onduty,
  dbo.Shifts.Offduty,
  dbo.Shifts.DayCount,
  dbo.Shifts.OnTimeIn,
  dbo.Shifts.OnTimeOut,
  dbo.Shifts.CutIn,
  dbo.Shifts.CutOut,
  dbo.Shifts.OnLunch,
  dbo.Shifts.OffLunch,
  dbo.Shifts.WorkingTime,
  dbo.Shifts.Workingday,
  dbo.Shifts.LateGrace,
  dbo.Shifts.EarlyGrace,
  dbo.Shifts.AfterOT
FROM
  dbo.UserInfo,
  dbo.Schedule,
  dbo.Shifts,
  dbo.ShiftSch
WHERE
  dbo.UserInfo.SchID = dbo.Schedule.SchID AND 
  dbo.Schedule.SchID = dbo.ShiftSch.SchID AND 
  dbo.ShiftSch.T1 = dbo.Shifts.ShiftID AND 
  dbo.UserInfo.UserEnrollNumber = " + dsnv[i];
                #endregion
                DataTable table_Ca     = SqlDataAccessHelper.ExecuteQueryString(query, null, null);
                DataRow[] arrRow_INN_A = tableCheck.Select("UserEnrollNumber=" + dsnv[i] + " and MachineNo % 2 = 1 and (IDXacNhanCaVaLamThem is null)");
                DataRow[] arrRow_OUT_A = tableCheck.Select("UserEnrollNumber=" + dsnv[i] + " and MachineNo % 2 = 0 and (IDXacNhanCaVaLamThem is null)");
                DataTable tableINN_A   = tableCheck.Clone();
                DataTable tableOUT_A   = tableCheck.Clone();
                Loc(arrRow_INN_A, tableINN_A);
                Loc(arrRow_OUT_A, tableOUT_A);
                DataTable tableCIO_A = TaoCauTrucDataTable(
                    new[] { "UserEnrollNumber", "TimeStrVao", "MachineNoVao", "TimeStrRaa", "MachineNoRaa", "HaveINOUT", }
                    , new[] { typeof(int), typeof(DateTime), typeof(int), typeof(DateTime), typeof(int), typeof(int), });
                TaoTable_CIO_A(tableINN_A, tableOUT_A, tableCIO_A);

                XetCa_A(tableCIO_A, table_Ca);
            }
        }
Beispiel #7
0
        public DataTable GetAllNV(int IDPhong)
        {
            #region
            string query = @"SELECT 
  UserFullCode,
  UserFullName,
  UserLastName,
  UserEnrollNumber,
  UserEnrollName,
  UserIDTitle,
  UserIDC,
  UserIDD,
  SchID,
  HeSoLuongCB,
  HeSoLuongSP
FROM 
  UserInfo where UserEnabled = 1";
            #endregion

            DataTable table = SqlDataAccessHelper.ExecuteQueryString(query, null, null);
            return(table);
        }