private void bgw_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { isbusy = 1; try { if (isSend == 1) { byte[] file_data = System.IO.File.ReadAllBytes(Here_File); dt.Rows[0]["FILE_DATA"] = file_data; kq = DHuy.UPDATE("FILE_TRANSFER", dt, "ID", "FILE_DATA"); dt.Rows[0]["SEND_STATUS"] = 1; kq = DHuy.UPDATE("FILE_TRANSFER", dt, "ID", "SEND_STATUS"); DHuy.AddCommand_Trans(SESSION_TRANS_ID, "FILE_TRANSFER_RECEIVE;" + Remote_File + ";" + Here_FileName); } else { if (Here_File == "Home") { Here_File = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); } DHuy.DownloadFile("FILE_TRANSFER", "FILE_DATA", "ID", SESSION_TRANS_ID, Here_File + "\\" + Path.GetFileName(Remote_File)); } } catch (Exception ex) { } }
private void Save_Click(object sender, EventArgs e) { foreach (Control C in this.Controls) { if (C.GetType() == typeof(PictureBox)) { try { try { dt.Rows[0][C.Name.Replace("edt", "")] = new byte[3]; dt.Rows[0][C.Name.Replace("edt", "")] = DBase.ImageToByte(((PictureBox)C).Image); } catch (Exception ex) { dt.Rows[0][C.Name.Replace("edt", "")] = DBase.ImageToByte(Properties.Resources.GoogleTrans24); } } catch (Exception ex) { } } } int kq = 0; if (type == 0 || Clone == 1) { kq = (int)DHuy.INSERT_IDENTITY_RETURNID(TableName, dt); if (kq > 0) { DBase.DTAPP = DHuy.SELECT_SQL("SELECT APPNAME,ENABLE,SHORTKEY,DOUBLECLICK,HOLDCLICK FROM APPTRANSLATE WHERE USERCODE ='ADMIN'"); //MessageBox.Show("Insert Succesful!"); if (Parent != null) { Parent.RefreshInsert(kq.ToString()); } this.Close(); } } else if (type == 1) { kq = DHuy.UPDATE(TableName, dt, KEYCOL); if (kq > 0) { DBase.DTAPP = DHuy.SELECT_SQL("SELECT APPNAME,ENABLE,SHORTKEY,DOUBLECLICK,HOLDCLICK FROM APPTRANSLATE WHERE USERCODE ='ADMIN'"); //MessageBox.Show("Saved!"); if (Parent != null) { Parent.RefreshSelect(); } this.Close(); } } }
private void Save_Click(object sender, EventArgs e) { foreach (Control C in this.Controls) { if (C.GetType() == typeof(PictureBox)) { try { try { dt.Rows[0][C.Name.Replace("edt", "")] = new byte[3]; dt.Rows[0][C.Name.Replace("edt", "")] = DBase.ImageToByte(((PictureBox)C).Image); } catch (Exception ex) { } } catch (Exception ex) { } } } int kq = 0; if (type == 0 || Clone == 1) { kq = (int)DHuy.INSERT_IDENTITY(TableName, dt); if (kq > 0) { MessageBox.Show("Insert Succesful!"); if (Parent != null) { Parent.RefreshInsert(kq.ToString()); } this.Close(); } } else if (type == 1) { kq = DHuy.UPDATE(TableName, dt, KEYCOL); if (kq > 0) { MessageBox.Show("Saved!"); if (Parent != null) { Parent.RefreshSelect(); } this.Close(); } } }
private void Save_Click(object sender, EventArgs e) { DataTable dt = DHuy.SELECT_NEWROW("USER_PCS"); dt.Rows[0]["ID"] = ID; dt.Rows[0]["USERCODE"] = USERCODE; dt.Rows[0]["PCS_ID"] = edtPCS_ID.Text; dt.Rows[0]["PASS"] = edtPass.Text; if (edtPass.Text == "") { dt.Rows[0]["PASS"] = ""; } else { dt.Rows[0]["PASS"] = DHuy.HideFood(edtPass.Text, "ForTheWin", new byte[256]); } dt.Rows[0]["PCS_NAME"] = edtPCS_NAME.Text; int kq = 0; if (isUpdate == 0) { kq = DHuy.INSERT_IDENTITY("USER_PCS", dt); } else { if (ID > 0) { kq = DHuy.UPDATE("USER_PCS", dt, "ID"); } } if (kq > 0) { Res = 1; // MessageBox.Show("Saved!"); this.Close(); } }