private void test() { for (int i = 1; i < vs.Rows.Count; i++) { try { string ip = vs.Rows[i]["ADD_IP"] + ""; if (ip + "" == "") { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0); } else { if (dt.Connect(ip) == "1") { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 1); dt.Disconnect(); } else { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0); } } } catch { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0); } } vs.AutoSizeCols(); }
void Form1_Load(object sender, System.EventArgs e) { // bind grid to a data source string conn = GetConnectionString(); OleDbDataAdapter da = new OleDbDataAdapter("select * from products", conn); DataTable dt = new DataTable("Products"); da.Fill(dt); _flex.DataSource = dt; // open categories map da = new OleDbDataAdapter("select * from categories", conn); dt = new DataTable("Categories"); da.Fill(dt); // build data map Hashtable ht = new Hashtable(); foreach (DataRow dr in dt.Rows) { ht.Add(dr["CategoryID"], LoadImage(dr["Picture"] as byte[])); } // assign ImageMap to categories column _flex.Cols["CategoryID"].ImageMap = ht; _flex.Cols["CategoryID"].ImageAndText = false; // finish setting up the grid _flex.Cols[0].Width = _flex.Rows[0].HeightDisplay; _flex.ShowCursor = true; _flex.AutoSizeCols(); _flex.AutoSizeRows(); }
private void Init_Form() { Dep.Init_Tree(this.Tag + ""); Dep.vs1.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(Depvs1_AfterRowColChange); Dep.Show_Tree(); Init_vs(); Init_vs1(); Basic.Function.PublicFunction.L_Init_Label(this); cmd_ok.Enabled = vs1.Rows.Count > 1; string sql = "Select COL_NM,COL_" + PublicFunction.L_Lag + " from FILD01A where BAS_BT=1 "; if (ACC) { sql += " and ACC_BT=1"; } else { sql += " and HUR_BT=1"; } PublicFunction.InitCB(cb, sql, false); txt1.Text = vs.Cols[txt1.Tag + ""].Caption; txt2.Text = vs.Cols[txt2.Tag + ""].Caption; txt3.Text = vs.Cols[txt3.Tag + ""].Caption; vs.AutoSizeCols(); }
private void vs_EnabledChanged(object sender, EventArgs e) { label5.Text = PublicFunction.L_Get_PopMenu("COM", T_String.IsNullTo0(PublicFunction.CUS_ID)); vs.Cols["EN"].Visible = false; vs.Cols["VN"].Visible = false; vs.Cols["CH"].Visible = false; vs.Cols["TT"].Visible = false; vs.Cols[PublicFunction.L_Lag].Visible = true; vs.AutoSizeCols(); }
private void vs1_DoubleClick(object sender, System.EventArgs e) { if (vs1.Row > 0) { nav3.ToolBar_Click(new ToolBarButtonClickEventArgs(nav3.cmd_add)); int m = T_String.GetMax("MAX(ID)", "SYS_LABEL_VS", "NAME=N'" + vs1.Rows[vs1.Row]["ID"] + "'"); if (vs1.Rows.Count - 2 > 0) { if (m <= T_String.IsNullTo0(vs2.Rows[vs2.Rows.Count - 2]["ID"] + "")) { m = T_String.IsNullTo0(vs2.Rows[vs2.Rows.Count - 2]["ID"] + "") + 1; } } vs2.Rows[vs2.Rows.Count - 1]["ID"] = m; vs2.Rows[vs2.Rows.Count - 1]["NAME"] = vs1.Rows[vs1.Row]["ID"]; vs2.Rows[vs2.Rows.Count - 1]["FNAME"] = vs1.Rows[vs1.Row]["NAME"]; vs2.AutoSizeCols(); } }
private void vs_EnabledChanged(object sender, EventArgs e) { PublicFunction.L_Init_Label(vs, "frmTaLevel_vs", "SYS_LABEL_VS"); Func.RecordSet rs = new Func.RecordSet("Select * from FILD01A where BAS_BT=1", PublicFunction.C_con); for (int i = 0; i < rs.rows; i++) { vs.Cols[rs.record(i, "COL_NM")].Caption = rs.record(i, "COL_" + PublicFunction.L_Lag); } vs.AutoSizeCols(); }
private void vs_EnabledChanged(object sender, EventArgs e) { txt5.Text = vs.Cols[txt5.Tag + ""].Caption; txt6.Text = vs.Cols[txt6.Tag + ""].Caption; txt7.Text = vs.Cols[txt7.Tag + ""].Caption; for (int i = 1; i <= 31; i++) { vs.Cols["DAY_" + i.ToString("00")].Caption = "__" + i + "__"; } vs.AutoSizeCols(); }
private void change() { string YYY_MM = DateTime.Parse(dt.Value + "").ToString("yyyyMM"); int d = T_String.IsNullTo0(day.Text); if (d <= 0 || d > 31) { l.Text = PublicFunction.L_Get_Msg("msg", 89); day.Focus(); return; } else { int c = T_String.GetMax("Count(*)", "FILC03A", "EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + YYY_MM + "'"); if (c <= 1) { string st = ""; st = label4 + ": " + txt.Text + " - " + EMP_NM + " \n "; st = label1 + ": " + YYY_MM + " \n "; st = PublicFunction.L_Get_Msg("msg", 87); l.Text = st; } else { string sql = ""; sql = "update FILC03A set DAY_" + d.ToString("00") + "=N'" + cb.Text + "' where EMP_ID=N'" + EMP_ID + "' and YYY_MM=N'" + YYY_MM + "'"; PublicFunction.SQL_Execute(sql); vs.Rows.Count++; int r = vs.Rows.Count - 1; vs.Rows[r][0] = r; vs.Rows[r]["EMP_ID"] = EMP_ID; vs.Rows[r]["EMP_I1"] = EMP_I1; vs.Rows[r]["EMP_NM"] = EMP_NM; vs.Rows[r]["DEP_ID"] = DEP_ID; vs.Rows[r]["DT"] = DateTime.Parse(dt.Value + "").ToString("yyyy/MM") + "/" + d.ToString("00"); vs.Rows[r]["SHI_ID"] = cb.Text; vs.AutoSizeCols(); string st = ""; st = label4 + ": " + txt.Text + " - " + EMP_NM + " \n "; st = label1 + ": " + YYY_MM + " \n "; st = PublicFunction.L_Get_Msg("Staff", 1); l.Text = st; } } EMP_ID = EMP_I1 = EMP_NM = DEP_ID = ""; txt.Text = ""; txt_EMP_NM.Text = ""; day.Text = ""; txt.Focus(); }
private void Form1_Load(object sender, System.EventArgs e) { // create data table DataTable dt = new DataTable(); dt.Columns.Add("Customer", typeof(string)); dt.Columns.Add("Product", typeof(string)); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Amount", typeof(decimal)); // populate data table Random rnd = new Random(); string[] customers = "GM|Ford|Chrysler|Toyota|Honda|Mazda|Mitsubishi|Mercedes".Split('|'); string[] products = "Palm PC|Monitor|Keyboard|Printer|Fax|Copier|Mouse|Headphone".Split('|'); object[] data = new object[4]; for (int i = 0; i < 200; i++) { data[0] = customers[rnd.Next(customers.Length - 1)]; data[1] = products[rnd.Next(products.Length - 1)]; data[2] = DateTime.Now.AddDays(-356 * rnd.Next(-365, 0)); data[3] = rnd.NextDouble() * 10000; dt.Rows.Add(data); } dt.AcceptChanges(); // sort data table dt.DefaultView.Sort = "Customer, Product"; // bind to grid _flex.DataSource = dt; // configure grid _flex.Cols["Amount"].Format = "c"; _flex.Cols["Amount"].AllowDragging = false; _flex.Cols["Date"].AllowDragging = false; _flex.AutoSizeCols(); _flex.Cols[1].Width += 40; _flex.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.MultiColumn; }
private void txt_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string sql = "Select * from FILB01A where (VAC_BT=0 or VAC_BT is null) and "; if (r1.Checked) { sql += " EMP_ID=N'" + txt.Text + "'"; } else { sql += " EMP_I1=N'" + txt.Text + "'"; } Func.RecordSet rs = new Func.RecordSet(sql, PublicFunction.C_con); if (rs.rows > 0) { for (int i = 1; i < vs1.Rows.Count; i++) { if (vs1.Rows[i]["EMP_ID"] + "" == rs.record(0, "EMP_ID")) { return; } } vs1.Rows.Count++; vs1.Rows[vs1.Rows.Count - 1][0] = vs1.Rows.Count - 1; vs1.Rows[vs1.Rows.Count - 1]["EMP_ID"] = rs.record(0, "EMP_ID"); vs1.Rows[vs1.Rows.Count - 1]["EMP_I1"] = rs.record(0, "EMP_I1"); vs1.Rows[vs1.Rows.Count - 1]["EMP_NM"] = rs.record(0, "EMP_NM"); vs1.Rows[vs1.Rows.Count - 1]["EMP_N1"] = rs.record(0, "EMP_N1"); vs1.Rows[vs1.Rows.Count - 1]["DEP_ID"] = rs.record(0, "DEP_ID"); } txt.Text = ""; cmd_change.Enabled = vs1.Rows.Count > 1; vs1.AutoSizeCols(); txt.Focus(); } }
private void init_vs3() { vs3.Rows.Count = 1; vs3.Cols.Count = 3; vs3.Cols[1].Name = "GRP_NM"; vs3.Cols[2].Name = "GRP_ID"; vs3.Cols[2].Visible = false; Func.RecordSet rs = new Func.RecordSet("Select * from SYS_MENU where H_ID=-1 and ID<>0 and ID<>7", PublicFunction.C_con); vs3.Rows.Count++; vs3.Rows[vs3.Rows.Count - 1][0] = vs3.Rows.Count - 1; vs3.Rows[vs3.Rows.Count - 1]["GRP_NM"] = PublicFunction.L_GetLabel_VS(this.Name, "All"); vs3.Rows[vs3.Rows.Count - 1]["GRP_ID"] = "ALL"; for (int i = 0; i < rs.rows; i++) { vs3.Rows.Count++; vs3.Rows[vs3.Rows.Count - 1][0] = vs3.Rows.Count - 1; vs3.Rows[vs3.Rows.Count - 1]["GRP_NM"] = rs.record(i, PublicFunction.L_Lag); vs3.Rows[vs3.Rows.Count - 1]["GRP_ID"] = rs.record(i, "ID"); } vs3.AutoSizeCols(); vs3.AfterRowColChange += new C1.Win.C1FlexGrid.RangeEventHandler(vs3_AfterRowColChange); vs3.BackColor = Color.LemonChiffon; }
private void vs_EnabledChanged(object sender, EventArgs e) { txt1.Text = vs.Cols[txt1.Tag + ""].Caption; txt2.Text = vs.Cols[txt2.Tag + ""].Caption; vs.AutoSizeCols(); }
private void Transfer1() { // try // { con11 = new SqlConnection(PublicFunction.C_con.ConnectionString); con11.Open(); d1 = 0; for (int f = 1; f < vs.Rows.Count; f++) { if (vs.Rows[f]["FIN"] + "" == "FIN") { break; } vs.Rows[f]["FIN"] = "FIN"; vs.Rows[f]["SAT"] = "Downloading"; vs.AutoSizeCols(); try { string st = ""; string ip = vs.Rows[f]["ADD_IP"] + ""; string MCH_ID = vs.Rows[f]["MCH_ID"] + ""; l1.Text = MCH_ID + " - " + ip; if (dt1.Connect(ip) != "1") { vs.Rows[f]["SAT"] = "Fail!!!"; } else { string tm = DateToHex(T_String.GetDate()); st = dt1.SetTime(tm); while (true) { if (stop) { dt1.Disconnect(); con11.Close(); return; } st = dt1.GetRecord(); if (st.Length < 20) { if (st + "" == "" || st + "" == "1" || st + "" == "-3") { vs.Rows[f]["SAT"] = "Finished!!!"; dt1.Disconnect(); break; } // loi vs.Rows[f]["SAT"] = "Fail!!!"; dt1.Disconnect(); break; } else { int gt = T_String.IsNullTo0(PublicFunction.S_Left(st, 2)); if ((gt > 0 && gt <= 77) || PublicFunction.S_Left(st, 2) == "00") { string tam = PublicFunction.S_Right("000" + MCH_ID, 3) + "20"; //lb2.Items.Add("st:"+st); string st1 = st.Remove(0, 2); tam = PublicFunction.S_Right("000" + MCH_ID, 3) + st1; //lb2.Items.Add("tam:"+tam); try { Data_AQ800(tam, "DT6000", con11, "0"); } catch { vs.Rows[f]["SAT"] = "Fail!!!"; dt1.Disconnect(); } } } } } } catch (IOException ex) { MessageBox.Show("File :" + ex.Message); return; } } c1.Text = c1.Text + ". Completed!"; con11.Close(); fin1 = true; // if(fin2) // { // if(BT+""!="") // MessageBox.Show(BT); //this.Close(); // } // } // catch (Exception ex) // { // MessageBox.Show( ex.Message); // } }
private void nav_TBarClick(object sender, ToolBarButtonClickEventArgs e) { if (e.Button.Equals(nav.cmd_add)) { if (vs.Rows.Count == 1 || (int)vs.Rows[vs.Rows.Count - 1].UserData != 2) { nav.ToolBar_Click(e); } TextBoxAndVS.D_AddNewOrEdit(groupBox1, false); return; } if (e.Button.Equals(nav.cmd_save)) { try { TextBoxAndVS.D_GetDataFromTextBox(groupBox1, vs); if ((int)vs.Rows[vs.Row].UserData != 2) { vs.Rows[vs.Row].UserData = 1; } else { vs.Rows[vs.Row]["RPT_ID"] = T_String.GetMax("MAX(RPT_ID)", "FILE07A") + ""; vs2.Rows.Count++; int row = vs2.Rows.Count - 1; vs2.Rows[row].UserData = 2; vs2.Rows[row][0] = row; vs2.Rows[row]["SEQ_NO"] = row.ToString("000"); vs2.Rows[row]["RPT_ID"] = vs.Rows[vs.Row]["RPT_ID"]; vs2.Rows[row]["COL_ID"] = "EMP_ID"; vs2.Rows[row]["COL_NM"] = "WID"; vs2.Rows[row]["TAB_DR"] = "FILB01A"; vs2.Rows[row]["SHO_BT"] = 1; vs2.Rows[row]["WID_VL"] = 80; nav2.SaveRow(row); vs2.Rows.Count++; row = vs2.Rows.Count - 1; vs2.Rows[row].UserData = 2; vs2.Rows[row][0] = row; vs2.Rows[row]["SEQ_NO"] = row.ToString("000"); vs2.Rows[row]["RPT_ID"] = vs.Rows[vs.Row]["RPT_ID"]; vs2.Rows[row]["COL_ID"] = "EMP_NM"; vs2.Rows[row]["COL_NM"] = "Name"; vs2.Rows[row]["TAB_DR"] = "FILB01A"; vs2.Rows[row]["SHO_BT"] = 1; vs2.Rows[row]["WID_VL"] = 80; nav2.SaveRow(row); vs2.AutoSizeCols(); } nav.ToolBar_Click(e); return; } catch (Exception) {} } if (e.Button.Equals(nav.cmd_refresh)) { nav.ToolBar_Click(e); show_data(); return; } if (e.Button.Equals(nav.cmd_delete)) { nav.DeleteRow(vs.Row); return; } nav.ToolBar_Click(e); }
private void txt_Item_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (Row <= 0) { MessageBox.Show(PublicFunction.L_Get_Msg("msg", 214)); txt_item.Focus(); return; } if (!ok) { MessageBox.Show(PublicFunction.L_Get_Msg("msg", 213)); txt_WID.Focus(); return; } Double vl = T_String.IsNullTo00(txt_item.Text + ""); string sql = "Update FILD02A SET [" + vs.Rows[Row]["COL_NM"] + "]=" + vl + " where YYY_MM=N'" + dt.Text + "' and EMP_ID=N'" + EMP_ID + "'"; if (r1.Checked) { sql += " and SEQ_NO=1"; } else { sql += " and SEQ_NO=2"; } string st = ""; if (checkBox1.Checked) { st = DWID.Text + ": " + txt_WID.Text + " \n "; } else { st = WID.Text + ": " + txt_WID.Text + " \n "; } st += txt_Name.Text + "\n" + lb.Text + ": " + txt_item.Text + "\n "; if (PublicFunction.SQL_Execute(sql, true) == 0) { lb1.Text = st + PublicFunction.L_Get_Msg("Staff", 1); } else { lb1.Text = st + PublicFunction.L_Get_Msg("Staff", 2); return; } Double max = T_String.GetMax0("MAX(ID)", "GP_HISTORYINPUTPIECERATE"); sql = "Insert Into GP_HISTORYINPUTPIECERATE values(" + max + ",N'" + dt.Text + "',N'" + vs.Rows[Row]["COL_NM"] + "'," + vl + ",N'" + PublicFunction.A_UserID + "','" + T_String.GetDate().ToString("yyyy/MM/dd HH:mm") + "')"; PublicFunction.SQL_Execute(sql); vs2.Rows.Count++; vs2.Rows[vs2.Rows.Count - 1][0] = vs2.Rows.Count - 1; vs2.Rows[vs2.Rows.Count - 1]["YYY_MM"] = dt.Text; vs2.Rows[vs2.Rows.Count - 1]["EMP_ID"] = EMP_ID; vs2.Rows[vs2.Rows.Count - 1]["EMP_I1"] = EMP_I1; vs2.Rows[vs2.Rows.Count - 1]["EMP_NM"] = txt_Name.Text; vs2.Rows[vs2.Rows.Count - 1]["COL_NM"] = lb.Text; vs2.Rows[vs2.Rows.Count - 1]["COL_VL"] = vl; vs2.AutoSizeCols(); txt_Name.Text = ""; txt_Dep.Text = ""; txt_INH.Text = ""; txt_WID.Text = ""; txt_item.Text = ""; txt_WID.Focus(); } }
private void Show_VS1() { vs1.Rows.Count = 1; Func.RecordSet rs; if (rd3.Checked) { rs = new Func.RecordSet("Select * from GP_SYS_GET_PAYROLLFOR", PublicFunction.C_con); for (int i = 0; i < rs.rows; i++) { vs1.Rows.Count++; vs1.Rows[vs1.Rows.Count - 1][0] = vs1.Rows.Count - 1; vs1.Rows[vs1.Rows.Count - 1]["COL_ID"] = rs.record(i, "COL_ID"); if (rs.record(i, "COL_NM") + "" != "") { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "COL_NM"); } else { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "COL_ID"); } vs1.Rows[vs1.Rows.Count - 1]["COL_DR"] = PublicFunction.L_GetLabel_VS(rs.record(i, "DES_NM"), rs.record(i, "COL_ID")); vs1.Rows[vs1.Rows.Count - 1]["COL_TB"] = "GP_SYS_GET_PAYROLLFOR"; vs1.Rows[vs1.Rows.Count - 1]["COL_FD"] = "COL_NM"; vs1.Rows[vs1.Rows.Count - 1]["COL_UD"] = "COL_ID"; } } if (rd1.Checked) { rs = new Func.RecordSet("Select * from GP_SYS_SHIFT", PublicFunction.C_con); for (int i = 0; i < rs.rows; i++) { vs1.Rows.Count++; vs1.Rows[vs1.Rows.Count - 1][0] = vs1.Rows.Count - 1; vs1.Rows[vs1.Rows.Count - 1]["COL_ID"] = rs.record(i, "TYP_ID"); if (rs.record(i, "TYP_NM") + "" != "") { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "TYP_NM"); } else { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "TYP_ID"); } vs1.Rows[vs1.Rows.Count - 1]["COL_DR"] = rs.record(i, "TYP_" + PublicFunction.L_Lag); vs1.Rows[vs1.Rows.Count - 1]["COL_TB"] = "GP_SYS_SHIFT"; vs1.Rows[vs1.Rows.Count - 1]["COL_FD"] = "TYP_NM"; vs1.Rows[vs1.Rows.Count - 1]["COL_UD"] = "TYP_ID"; } rs = new Func.RecordSet("Select * from GP_MONTHADDUP", PublicFunction.C_con); for (int i = 0; i < rs.rows; i++) { vs1.Rows.Count++; vs1.Rows[vs1.Rows.Count - 1][0] = vs1.Rows.Count - 1; vs1.Rows[vs1.Rows.Count - 1]["COL_ID"] = rs.record(i, "TYP_ID"); if (rs.record(i, "TYP_NM") + "" != "") { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "TYP_NM"); } else { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "TYP_ID"); } vs1.Rows[vs1.Rows.Count - 1]["COL_DR"] = rs.record(i, "TYP_" + PublicFunction.L_Lag); vs1.Rows[vs1.Rows.Count - 1]["COL_TB"] = "GP_SYS_SHIFT"; vs1.Rows[vs1.Rows.Count - 1]["COL_FD"] = "TYP_NM"; vs1.Rows[vs1.Rows.Count - 1]["COL_UD"] = "TYP_ID"; } rs = new Func.RecordSet("Select * from FILC07A", PublicFunction.C_con); for (int i = 0; i < rs.rows; i++) { vs1.Rows.Count++; vs1.Rows[vs1.Rows.Count - 1][0] = vs1.Rows.Count - 1; vs1.Rows[vs1.Rows.Count - 1]["COL_ID"] = rs.record(i, "COL_NM"); if (rs.record(i, "COL_MM") + "" != "") { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "COL_MM"); } else { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "COL_NM"); } vs1.Rows[vs1.Rows.Count - 1]["COL_DR"] = rs.record(i, "COL_" + PublicFunction.L_Lag); vs1.Rows[vs1.Rows.Count - 1]["COL_TB"] = "FILC07A"; vs1.Rows[vs1.Rows.Count - 1]["COL_FD"] = "COL_MM"; vs1.Rows[vs1.Rows.Count - 1]["COL_UD"] = "COL_NM"; } } if (rd2.Checked) { rs = new Func.RecordSet("Select * from FILA15A", PublicFunction.C_con); for (int i = 0; i < rs.rows; i++) { vs1.Rows.Count++; vs1.Rows[vs1.Rows.Count - 1][0] = vs1.Rows.Count - 1; if (rs.record(i, "COL_NM") + "" != "") { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "COL_NM"); } else { vs1.Rows[vs1.Rows.Count - 1]["COL_NM"] = rs.record(i, "LEA_NM"); } vs1.Rows[vs1.Rows.Count - 1]["COL_DR"] = rs.record(i, "LEA_NM"); vs1.Rows[vs1.Rows.Count - 1]["COL_TB"] = "FILA15A"; vs1.Rows[vs1.Rows.Count - 1]["COL_ID"] = rs.record(i, "LEA_ID"); vs1.Rows[vs1.Rows.Count - 1]["COL_FD"] = "COL_NM"; vs1.Rows[vs1.Rows.Count - 1]["COL_UD"] = "LEA_ID"; } //vs1.Cols["COL_NM"].Visible=false; } //else{vs1.Cols["COL_NM"].Visible=true;} vs1.AutoSizeCols(); }