public void ChatLoad() { timer1.Start(); dtitem = DHuy.SELECT_NEWROW("CHAT"); ResetInfoID(); RefreshChat(); edtChat.Focus(); this.ActiveControl = edtChat; }
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(); } }
public FileTransfer(int CID, int RID, string FilePath) { InitializeComponent(); try { DataTable dti = DHuy.SELECT_NEWROW("FILE_TRANSFER"); String key = DBase.biDateTimeSave(DateTime.Now); dti.Rows[0]["ID"] = 0; dti.Rows[0]["DATA"] = new byte[3]; dti.Rows[0]["FILE_DATA"] = new byte[3]; dti.Rows[0]["CONTROL_ID"] = CID; dti.Rows[0]["REMOTE_ID"] = RID; dti.Rows[0]["MD5"] = key; kq = DHuy.INSERT_IDENTITY_UID("FILE_TRANSFER", dti); DataTable temp = DHuy.SELECT_SQL("SELECT * FROM FILE_TRANSFER WHERE MD5 = '" + key + "'"); SESSION_TRANS_ID = DBase.IntReturn(temp.Rows[0]["ID"]); REMOTE_ID = RID; CONTROL_ID = CID; FileTransfer_Process P = new FileTransfer_Process(); P.isSend = 1; P.dt = temp; P.Here_File = FilePath; P.Remote_File = "Home"; P.SESSION_TRANS_ID = SESSION_TRANS_ID; P.F = this; P.StartPosition = FormStartPosition.CenterParent; P.Show(this); //this.Close(); } catch (Exception ex) { } }
private void CODER_DETAIL_Load(object sender, EventArgs e) { if (ID != "") // Update { type = 1; // 0 - insert ; 1 - update dt = DHuy.SELECT(TableName, KEYCOL, ID); } else { dt = DHuy.SELECT_NEWROW(TableName); foreach (DataColumn dc in dt.Columns) { if (dc.ColumnName == "CUSERCODE" || dc.ColumnName == "UUSERCODE") { dt.Rows[0][dc.ColumnName] = DBase.UserCodeLogin; } if (dc.ColumnName == "CREATEDBYAGY" || dc.ColumnName == "UPDATEDBYAGY") { // dt.Rows[0][dc.ColumnName] = DBase.AgencyCodeLogin; } string sqlType = dc.DataType.ToString(); if (sqlType == "System.DateTime") { dt.Rows[0][dc.ColumnName] = DBase.DatetimeReturn_NowIfNull(dt.Columns[dc.ColumnName]); } } } foreach (Control C in this.Controls) { if (!C.Name.Contains("edt")) { continue; } String ColName = C.Name.Replace("edt", ""); string sqlType = dt.Rows[0][ColName].GetType().ToString(); if (sqlType == "System.DateTime") { DateTimePicker D = (DateTimePicker)C; D.Value = DBase.DatetimeReturn(dt.Rows[0][C.Name.Replace("edt", "")]); } else { // if (C.GetType() == typeof(TextPopup)) // { // TextPopup T = (TextPopup)C; // T.StopEvent(); // T.Text = DBase.StringReturn(dt.Rows[0][C.Name.Replace("edt", "")]); // T.StartEvent(); // } if (C.GetType() == typeof(ComboBox)) { ComboBox T = (ComboBox)C; T.Text = DBase.StringReturn(dt.Rows[0][C.Name.Replace("edt", "")]); } else if (C.GetType() == typeof(CheckBox)) { CheckBox T = (CheckBox)C; T.Checked = DBase.BoolReturn(dt.Rows[0][C.Name.Replace("edt", "")]); } else if (C.GetType() == typeof(PictureBox)) { PictureBox T = (PictureBox)C; T.Click += new System.EventHandler(this.edtIMAGE_Click); try { System.IO.MemoryStream ms = new System.IO.MemoryStream((Byte[])(dt.Rows[0][C.Name.Replace("edt", "")])); T.Image = Image.FromStream(ms); // ms.Dispose(); } catch (Exception ex) { } } else { C.Text = DBase.StringReturn(dt.Rows[0][C.Name.Replace("edt", "")]); } } } //Asign Value Change Event foreach (Control C in this.Controls) { C.TextChanged += new System.EventHandler(this.TextChange); } //Asign Checkchange Event foreach (Control C in this.Controls) { if (C.GetType() == typeof(CheckBox)) { ((CheckBox)C).CheckedChanged += new System.EventHandler(this.CheckedChanged); } } //Remove Readonly foreach (DataColumn col in dt.Columns) { col.ReadOnly = false; } }