private void cmbMaSo_SelectedIndexChanged(object sender, EventArgs e) { string sqlPageID = "select case when max(page_id) is null then 1 else max(page_id) +1 end as maxcode from m_header"; IPQC_Motor.TfSQL con = new IPQC_Motor.TfSQL(); con.sqlExecuteScalarString(sqlPageID); }
private void btnOk_Click(object sender, EventArgs e) { string datetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (checkdata()) { if (txtNewPass.Text == txtConfirmPass.Text) { //insert user into database. string sqlinsertUser = @"insert into m_user (user_name, user_pass, user_permision,user_dept_cd,registration_date_time) VALUES ('" + txtUserName.Text + "','" + txtNewPass.Text + "','" + cmbPermision.Text + "','" + cmbDept.Text + "','" + datetime + "')"; IPQC_Motor.TfSQL con = new IPQC_Motor.TfSQL(); con.sqlExecuteScalarString(sqlinsertUser); MessageBox.Show("User: '******' is created", "Info"); this.Close(); } else { MessageBox.Show("Password is incorrect", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show("Pls, insert fill full data", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void btnOk_Click(object sender, EventArgs e) { IPQC_Motor.TfSQL con = new IPQC_Motor.TfSQL(); string sqlpass = "******" + username + "'"; if (txtOldPass.Text == con.sqlExecuteScalarString(sqlpass)) {//update new password if (txtNewPass.Text == txtConfirmPass.Text) { string sqlupdatepass = "******" + txtNewPass.Text + "' where user_name = '" + username + "'"; IPQC_Motor.TfSQL update = new IPQC_Motor.TfSQL(); update.sqlExecuteScalarString(sqlupdatepass); MessageBox.Show("your Password is changed", "Info"); this.Close(); } else { MessageBox.Show("New Pasword is incorrect", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show("Old Pasword is incorrect", "Error", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
private void frmModel_Load(object sender, EventArgs e) { if (ModelId == "") { Text = "Add Model"; } else { IPQC_Motor.TfSQL tf = new IPQC_Motor.TfSQL(); string sqlModel = "select model_cd from m_model where model_id = " + int.Parse(ModelId); string sqlModelSub = "select model_sub_cd from m_model where model_id = " + int.Parse(ModelId); Text = "Update Model"; txtModel.Enabled = false; txtModel.Text = tf.sqlExecuteScalarString(sqlModel); txtModelSub.Text = tf.sqlExecuteScalarString(sqlModelSub); } }
private void frmModel_Load(object sender, EventArgs e) { IPQC_Motor.TfSQL tf = new IPQC_Motor.TfSQL(); if (DrawingId == "") { Text = "Add Drawing"; string sqlCmbModel = @"select distinct model_cd from(select model_cd ,user_dept_cd from m_model a,m_user b where a.user_id = b.user_id )t,m_user a where a.user_dept_cd = t.user_dept_cd and a.user_name = '" + User + "'"; getCmb(sqlCmbModel, ref cmbModel); } else { Text = "Update Drawing"; string sqlDwrCd = "select dwr_cd from m_drawing where dwr_id = " + int.Parse(DrawingId); string sqlDwrName = "select dwr_name from m_drawing where dwr_id = " + int.Parse(DrawingId); string sqlDoc = "select doc_name from m_drawing where dwr_id = " + int.Parse(DrawingId); string sqlModel = "select model_cd from m_model where model_id =" + int.Parse(ModelId); string sqlModelSub = "select model_sub_cd from m_model where model_id =" + int.Parse(ModelId); txtDwrCd.Text = tf.sqlExecuteScalarString(sqlDwrCd); txtDwrName.Text = tf.sqlExecuteScalarString(sqlDwrName); txtDoc.Text = tf.sqlExecuteScalarString(sqlDoc); cmbModel.SelectedText = tf.sqlExecuteScalarString(sqlModel); cmbModel.Text = tf.sqlExecuteScalarString(sqlModel); cmbSubModel.Text = tf.sqlExecuteScalarString(sqlModelSub); cmbSubModel.Enabled = false; cmbModel.Enabled = false; } }
void callpic() { IPQC_Motor.TfSQL tfSql = new IPQC_Motor.TfSQL(); string bytePic = tfSql.sqlExecuteScalarString("select dwr_image from m_drawing where dwr_cd = '" + drawingcd + "'"); if (bytePic != "") { byte[] imgBytes = Convert.FromBase64String(bytePic); MemoryStream ms = new MemoryStream(imgBytes, 0, imgBytes.Length); ms.Write(imgBytes, 0, imgBytes.Length); Image image = Image.FromStream(ms, true); picbox.Image = image; picbox.SizeMode = PictureBoxSizeMode.Zoom; } }