private void btnRemove_Click(object sender, EventArgs e) { if (dgvFactors.SelectedRows.Count == 0) { return; } var result = MessageBox.Show("آیا مطئن هستید?", "اخطار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.No) { return; } var db = new shampazEntities(); foreach (DataGridViewRow row in dgvFactors.SelectedRows) { var id = Convert.ToInt32(row.Cells["clnId"].Value); var factor = db.BuyFactors.Where(x => x.Id == id).FirstOrDefault(); var items = db.BuyFactorItems.Where(x => x.BuyFactorId == factor.Id).ToList(); db.BuyFactorItems.RemoveRange(items); db.BuyFactors.Remove(factor); } db.SaveChanges(); DesktopAlert.Show("فاکتور حذف شد", eDesktopAlertColor.Green, eAlertPosition.BottomRight); btnFilter.PerformClick(); }
/// <summary> /// 去掉重复的行 /// </summary> private void RemoveRepeat() { if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (sBillNo == dt.Rows[i]["单据编号"].ToString()) { //[日期],[FInterID],[单据编号],[FEntryID],[购货单位],[发货仓库], //[产品名称],[规格型号],[实发数量],[批号],[摘要] , //[FActQty] ,[FQRCode] dt.Rows[i]["日期"] = DBNull.Value; dt.Rows[i]["内部编号"] = DBNull.Value; dt.Rows[i]["单据编号"] = ""; dt.Rows[i]["分录号"] = DBNull.Value; dt.Rows[i]["购货单位"] = ""; dt.Rows[i]["发货仓库"] = ""; dt.Rows[i]["产品名称"] = ""; dt.Rows[i]["规格型号"] = ""; dt.Rows[i]["实发数量"] = DBNull.Value; dt.Rows[i]["批号"] = ""; dt.Rows[i]["摘要"] = ""; dt.Rows[i]["扫描数量"] = DBNull.Value; } else { sBillNo = dt.Rows[i]["单据编号"].ToString(); } } } else { DesktopAlert.Show(Utils.H2("没有数据!")); } }
private void BAndR() { try { connectionString = "Data Source =" + Properties.Settings.Default.server.ToString() + "; User ID =" + Properties.Settings.Default.userName.ToString() + "; Password ="******""; //Data Source = USER - PC; User ID = sa; Password = *********** conn = new SqlConnection(connectionString); conn.Open(); sql = "EXEC sp_databases"; command = new SqlCommand(sql, conn); reader = command.ExecuteReader(); metroComboBox1.Items.Clear(); while (reader.Read()) { metroComboBox1.Items.Add(reader[0].ToString()); } metroButton3.Enabled = true; metroComboBox1.Enabled = true; } catch (Exception ex) { //MessageBox.Show(ex.Message); DesktopAlert.Show(ex.Message); } }
private void metroButton2_Click_2(object sender, EventArgs e) { try { connectionString = "Data Source =" + metroTextBox3.Text + "; User ID =" + metroTextBox1.Text + "; Password ="******""; //Data Source = USER - PC; User ID = sa; Password = *********** conn = new SqlConnection(connectionString); conn.Open(); sql = "EXEC sp_databases"; command = new SqlCommand(sql, conn); reader = command.ExecuteReader(); metroComboBox2.Items.Clear(); DesktopAlert.Show("You can now select database"); metroButton1.Enabled = true; while (reader.Read()) { metroComboBox2.Items.Add(reader[0].ToString()); } metroComboBox2.Enabled = true; } catch (Exception ex) { //MessageBox.Show(ex.Message); DesktopAlert.Show(ex.Message); metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; } }
private void metroButton1_Click_2(object sender, EventArgs e) { metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; try { if (metroComboBox2.Text.CompareTo("") == 0) { DesktopAlert.Show("Please select a database !"); return; } conn = new SqlConnection(connectionString); conn.Open(); //sql = "Alter Database " + metroComboBox2.Text + " Set SINGLE_USER WITH ROLLBACK IMMEDIATE "; sql += "Restore Database " + metroComboBox2.Text + "FROM Disk = '" + metroTextBox4.Text + "' WITH REPLACE;"; command = new SqlCommand("Alter Database " + metroComboBox2.Text + " Set SINGLE_USER WITH ROLLBACK IMMEDIATE Restore Database " + metroComboBox2.Text + " FROM Disk = '" + metroTextBox4.Text + "' WITH REPLACE; ", conn); command.ExecuteNonQuery(); DesktopAlert.Show("Successfully restore database!"); conn.Close(); conn.Dispose(); } catch { DesktopAlert.Show("Please check your credentials! \nNote: This machine may not be capable of using this feature.\n Please contact your administrator"); } }
/// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX1_Click(object sender, EventArgs e) { mingQRCode = EncryptHelper.Decrypt(textBoxX2.Text); //mingQRCode = textBoxX2.Text; //if (!string.IsNullOrEmpty(mingQRCode) && mingQRCode.Length == 9 && mingQRCode.StartsWith(DateTime.Now.Year.ToString().Substring(2))) if (!string.IsNullOrEmpty(mingQRCode) && mingQRCode.Length == 9) { string tableName = "t_QRCode" + mingQRCode.Substring(0, 4); ///二维码是否存在 sql = string.Format("SELECT FEntryID AS interID FROM [dbo].[{0}] WHERE [FQRCode] = '{1}' ", tableName, mingQRCode); object obj = SqlHelper.ExecuteScalar(sql); if (obj != null) { sql = string.Format("SELECT FEntryID as interID FROM [dbo].[{0}] WHERE [FQRCode] = '{1}' ORDER BY FCodeID DESC", tableName, mingQRCode); object obj1 = SqlHelper.ExecuteScalar(sql); string interID = obj1 != null?obj1.ToString() : ""; string billNo = interID.Substring(0, 10); int entryID = int.Parse(interID.Substring(10)); sql = string.Format("SELECT * FROM [icstock] WHERE [单据编号] = '{0}' AND [FEntryID] = {1}", billNo, entryID.ToString()); dt = SqlHelper.ExecuteDataTable(sql); dataGridViewX1.DataSource = dt; } else { info = Utils.H2(string.Format("{0} 二维码不存在!", mingQRCode)); DesktopAlert.Show(info); } } else { DesktopAlert.Show(Utils.H2("无效的二维码!")); } }
private void matExistCheck() //Check for material existence.... { string matMame = ""; string formula = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[CheckMtrlDup_formula] '" + textBoxX1.Text + "','" + metroLabel6.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; matMame = dr["Material"].ToString(); formula = dr["formulaName"].ToString(); } userConnect.dbOut(); if (user >= 1) { metroTextButton2.Enabled = false; DesktopAlert.Show("Already Exist"); } else { metroTextButton2.Enabled = true; } }
/// <summary> /// 查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonX1_Click(object sender, EventArgs e) { dataGridViewX1.DataSource = null; string billType = comboBoxEx2.SelectedIndex == 0 ? "XOUT" : "QOUT"; string billNo = billType + textBoxX1.Text; string interID = billNo + comboBoxEx1.SelectedValue.ToString().PadLeft(4, '0'); SqlParameter[] parms = { new SqlParameter("@interID", interID) }; dt = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionString, CommandType.StoredProcedure, "getQRCodeByinterID", parms).Tables[0]; if (dt.Rows.Count > 0) { dt.Columns.Add("QRCode", typeof(System.String));//二维码 for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["QRCode"] = EncryptHelper.Encrypt(dt.Rows[i]["FQRCode"].ToString()); } dataGridViewX1.DataSource = dt; dataGridViewX1.Columns[0].HeaderText = "编号"; dataGridViewX1.Columns[1].HeaderText = "二维码"; dataGridViewX1.Columns[1].Width = 300; } else { DesktopAlert.Show(Utils.H2("无记录!请检查单据设置")); } }
private void metroButton5_Click(object sender, EventArgs e) { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); foreach (DataGridViewRow item in metroGrid3.Rows) { if (bool.Parse(item.Cells[0].Value.ToString())) { SqlCommand material = new SqlCommand("[deletePosition]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@position", item.Cells[1].Value.ToString()); material.Parameters.AddWithValue("@stat", "Y"); material.Parameters.AddWithValue("@addBy", globalVar.name.ToString()); material.ExecuteNonQuery(); } //else //{ // SqlCommand material = new SqlCommand("[deletePosition]", sqlcon.calc); // material.CommandType = System.Data.CommandType.StoredProcedure; // material.Parameters.AddWithValue("@position", item.Cells[1].Value.ToString()); // material.Parameters.AddWithValue("@stat", "N"); // material.ExecuteNonQuery(); //} } userConnect.dbOut(); } catch { return; } displayUsers2(); reloadChkBox(); DesktopAlert.Show("Position has been updated!"); }
private void metroGrid1_DoubleClick(object sender, EventArgs e) { var rowsCntChck = metroGrid1.SelectedRows.Count; if (rowsCntChck == 0 || rowsCntChck > 1) { DesktopAlert.Show("Input a user first!"); metroButton3.Enabled = false; } else { slidePanel2.BringToFront(); metroTextBox11.Select(); slidePanel2.AnimationTime = 1000; slidePanel2.SlideSide = eSlideSide.Left; slidePanel2.IsOpen = true; slidePanel1.Enabled = false; metroGrid1.Enabled = false; var rowsCount = metroGrid1.SelectedRows.Count; if (rowsCount == 0 || rowsCount > 1) { return; } metroLabel12.Text = metroGrid1.SelectedCells[1].Value.ToString(); searchUser(); texiUsers tUsr = new texiUsers(); } }
private void metroComboBox2_SelectedIndexChanged(object sender, EventArgs e) { if (metroComboBox2.Text == "System Admin" && globalVar.position != "System Admin") { DesktopAlert.Show("You are not allowed to use or change this Position!"); } }
private void pinCheck() { int user = 0; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[resetPasswords2] '" + metroLabel2.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { user += 1; globalVar.pinCode = dr["pinCode"].ToString(); } userConnect.dbOut(); if (globalVar.pinCode == metroTextBox1.Text) { slidePanel2.IsOpen = true; slidePanel1.IsOpen = false; } else { DesktopAlert.Show("PIN code does not match"); } }
private void userExistCheck() //Check for user existence.... { string fName = ""; string lName = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[CheckDuplicates] '" + metroTextBox1.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; fName = dr["FirstName"].ToString(); lName = dr["LastName"].ToString(); } userConnect.dbOut(); if (fName.ToUpper() == metroTextBox1.Text.ToUpper() && lName.ToUpper() == metroTextBox2.Text.ToUpper() && metroTextBox1.Text != string.Empty && metroTextBox2.Text != string.Empty) { metroButton1.Enabled = false; DesktopAlert.Show("Already Exist"); } else { metroButton1.Enabled = true; } }
private void buttonX1_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "真的要删除这些记录吗?", "系统警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { for (int i = 0; i < listViewEx1.Items.Count; i++) { if (listViewEx1.Items[i].Checked == true) { //DesktopAlert.Show(listViewEx1.Items[i].SubItems[1].Text); //删QRCode string delQRCode = listViewEx1.Items[i].SubItems[1].Text; int ret = deleteQRCode2T_QRCode(delQRCode, billNo, entryID); //删icstock ret += deleteICStockByActQty(billNo, entryID); //删listview if (ret >= 2) //都成功 { listViewEx1.Items[i].Remove(); currVal--; dataGridViewX1.SelectedRows[0].Cells[5].Value = currVal; } else { info = string.Format("{0} 条码删除失败!", delQRCode); DesktopAlert.Show(info); } } } } }
private void btnRemove_Click(object sender, EventArgs e) { var result = MessageBox.Show("آیا از حذف شخص مطمئنید ؟", "اخطار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.No) { return; } if (dgvPersons.SelectedRows.Count == 0) { return; } var id = Convert.ToInt32(dgvPersons.SelectedRows[0].Cells["clnId"].Value); var db = new shampazEntities(); var p = db.Persons.Where(x => x.Id == id).FirstOrDefault(); try { db.Persons.Remove(p); db.SaveChanges(); DesktopAlert.Show("شخص حذف شد", eDesktopAlertColor.Green, eAlertPosition.BottomRight); dgvPersonsRefresh(); } catch { DesktopAlert.Show("امکان حذف شخص نیست", eDesktopAlertColor.Red, eAlertPosition.BottomRight); } }
private void metroButton2_Click_1(object sender, EventArgs e) { try { connectionString = "Data Source =" + metroTextBox3.Text + "; User ID =" + metroTextBox1.Text + "; Password ="******""; //Data Source = USER - PC; User ID = sa; Password = *********** conn = new SqlConnection(connectionString); conn.Open(); sql = "EXEC sp_databases"; command = new SqlCommand(sql, conn); reader = command.ExecuteReader(); metroComboBox1.Items.Clear(); DesktopAlert.Show("Database Authentication Success!"); metroButton1.Enabled = true; conn.Close(); conn.Dispose(); } catch (Exception ex) { //MessageBox.Show(ex.Message); DesktopAlert.Show(ex.Message); metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; } }
private void metroTextButton1_Click(object sender, EventArgs e) { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand material = new SqlCommand("[modifyFormulaDetails]", sqlcon.calc); material.CommandType = System.Data.CommandType.StoredProcedure; material.Parameters.AddWithValue("@matName", metroTextBox5.Text); material.Parameters.AddWithValue("@DESC", metroTextBox6.Text); material.Parameters.AddWithValue("@amt", metroTextBox7.Text); material.Parameters.AddWithValue("@PKG", metroTextBox8.Text); material.Parameters.AddWithValue("@user", globalVar.name.ToString()); material.Parameters.AddWithValue("@fglook", metroLabel6.Text); material.ExecuteNonQuery(); userConnect.dbOut(); displayFormula(); DesktopAlert.AutoCloseTimeOut = 3; textBoxX1.Text = null; metroTextBox11.Text = null; DesktopAlert.Show("Details has been updated!"); } catch { DesktopAlert.Show("Please check your inputs!"); } }
private void uploadwithImage() { string Con = Properties.Settings.Default.Database.ToString() + ".[dbo].Final_Sold_Goods "; string con3 = Con.Replace(" ", ""); sqlcon userConnect1 = new sqlcon(); userConnect1.dbIn(); SqlCommand soldFinishGood = new SqlCommand("[receivedGoods]", sqlcon.calc); soldFinishGood.CommandType = System.Data.CommandType.StoredProcedure; soldFinishGood.Parameters.AddWithValue("@userID", globalVar.x.ToString()); soldFinishGood.Parameters.AddWithValue("@emp2", globalVar.name.ToString()); soldFinishGood.Parameters.AddWithValue("@emp", metroLabel13.Text); soldFinishGood.Parameters.AddWithValue("@fGcode", metroLabel6.Text); soldFinishGood.ExecuteNonQuery(); userConnect1.dbOut(); sqlcon userConnect = new sqlcon(); userConnect.dbIn(); //SqlCommand cmd = new SqlCommand("[userIDdetect] '" + metroTextBox1.Text + "'", sqlcon.con); SqlCommand cmd = new SqlCommand("UPDATE " + con3.ToString() + " SET [image] = (SELECT BulkColumn FROM Openrowset( Bulk '" + imgloc.ToString() + "', Single_Blob) as img) WHERE FGCode = '" + metroLabel6.Text + "'", sqlcon.calc); SqlDataReader dr = cmd.ExecuteReader(); userConnect.dbOut(); displayReports(); slidePanel1.IsOpen = false; DesktopAlert.Show("Item has been sold"); metroTabControl1.Enabled = true; pictureBox1.Image = null; }
private void productExistCheck() //Check for product existence.... { string pName = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[chkFGProductsDup] '" + metroTextBox2.Text + "'", sqlcon.calc); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; pName = dr["productName"].ToString(); } userConnect.dbOut(); if (pName.ToUpper() == metroTextBox2.Text.ToUpper() && metroTextBox2.Text != string.Empty) { metroButton1.Enabled = false; DesktopAlert.Show("Already Exist"); } else { metroButton1.Enabled = true; } }
private void metroButton1_Click(object sender, EventArgs e) { imgloc = ""; pictureBox1.Image = null; try { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "JPG Files (*.jpg)|*.jpg|GIF Files(*.gif)|*.gif|All files(*.*)|*.*"; dlg.Title = "Select Receiving form for this customer"; if (dlg.ShowDialog() == DialogResult.OK) { imgloc = dlg.FileName; pictureBox1.ImageLocation = imgloc; textBox1.Text = dlg.FileName; } if (imgloc != "") { metroButton3.Enabled = true; } } catch (Exception ex) { DesktopAlert.Show(ex.Message); } }
private void matDuplicateCheck() { string fName = ""; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[CheckMtrlDup_MML] '" + metroTextBox3.Text + "'", sqlcon.con); SqlDataReader dr = cmd.ExecuteReader(); int user = 0; while (dr.Read()) { user += 1; fName = dr["MaterialName"].ToString(); } userConnect.dbOut(); if (fName.ToUpper() == metroTextBox3.Text.ToUpper()) { metroButton1.Enabled = false; DesktopAlert.Show("Material already Exist"); metroLabel6.Text = ""; } else { metroButton1.Enabled = true; } }
private void addNewMaterial() { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand newMat = new SqlCommand("[addItemMMML]", sqlcon.calc); newMat.CommandType = System.Data.CommandType.StoredProcedure; newMat.Parameters.AddWithValue("@matID", metroLabel6.Text); newMat.Parameters.AddWithValue("@matName", metroTextBox3.Text); newMat.Parameters.AddWithValue("@matDesc", metroTextBox4.Text); newMat.Parameters.AddWithValue("@minStock", metroTextBox5.Text); newMat.Parameters.AddWithValue("@employe", globalVar.name.ToString()); newMat.Parameters.AddWithValue("@price", metroTextBox1.Text); newMat.Parameters.AddWithValue("@userID", globalVar.x.ToString()); newMat.ExecuteNonQuery(); userConnect.dbOut(); DesktopAlert.Show("New material has been added."); Form1 updateList = new Form1(); updateList.notifDsply(); updateList.notifIcon(); metroTextBox1.Text = ""; metroTextBox3.Text = ""; metroTextBox4.Text = ""; metroTextBox5.Text = ""; metroLabel6.Text = ""; displayMaterialView(); } catch { DesktopAlert.Show("Please check your Inputs!"); } }
private void tempsoldFinishGood() { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand soldFinishGood = new SqlCommand("[TEMPmaterialOut]", sqlcon.calc); soldFinishGood.CommandType = System.Data.CommandType.StoredProcedure; soldFinishGood.Parameters.AddWithValue("@recipe", metroComboBox2.Text); soldFinishGood.Parameters.AddWithValue("@client", metroComboBox1.Text); soldFinishGood.Parameters.AddWithValue("@amount", metroTextBox1.Text); soldFinishGood.Parameters.AddWithValue("@employe", globalVar.name.ToString()); soldFinishGood.Parameters.AddWithValue("@pricePerBag", metroLabel3.Text); soldFinishGood.Parameters.AddWithValue("@bagging", metroLabel12.Text); soldFinishGood.Parameters.AddWithValue("@userID", globalVar.x.ToString()); soldFinishGood.Parameters.AddWithValue("@fGcode", metroLabel18.Text); //string result = ""; //if (stat == "N") { result = "Pending"; } //else {result = "Proceed"; } //soldFinishGood.Parameters.AddWithValue("@stat", result.ToString()); soldFinishGood.ExecuteNonQuery(); userConnect.dbOut(); metroTextBox1.Text = ""; DesktopAlert.AlertColor = eDesktopAlertColor.Green; DesktopAlert.Show("Item Has been added!"); DesktopAlert.AutoCloseTimeOut = 3; reloadChkBox(); }
private void metroGrid1_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { var senderGrid = (DataGridView)sender; globalVar.MatInID = Convert.ToInt32(metroGrid1.SelectedCells[2].Value); if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn) { DialogResult dialogResult = MetroMessageBox.Show(this, "Already Recieved ?", "Purchased Material", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { var rowsCount = metroGrid1.SelectedRows.Count; uploadToDB2(); DesktopAlert.Show("The list has been added to purchased materials list."); Form1 updateNotif = new Form1(); updateNotif.notifDsply(); updateNotif.notifIcon(); textBoxX1.Text = ""; metroTextBox1.Text = ""; tempTableOrderIN(); } } } catch {} }
/// <summary> /// /// </summary> /// <param name="EntryID"></param> /// <returns></returns> private int DeleteDetailTable(string EntryID) { int retVal = 0; string[] prodT = null; string prodType0 = "17"; string prodType1 = "16"; string confProdType = ConfigHelper.ReadValueByKey(ConfigHelper.ConfigurationFile.AppConfig, "ProdType"); if (confProdType == enumProductType.护理液.ToString()) { prodT = prodType0.Split(';'); } else if (confProdType == enumProductType.镜片.ToString()) { prodT = prodType1.Split(';'); } else { DesktopAlert.Show(Utils.H2("产品类型设置错误!")); } string baseTableName = "dbo.t_QRCode"; for (int j = 0; j < prodT.Length; j++) { for (int i = 0; i < 100; i++) { string fID = i < 10 ? "0" + i.ToString() : i.ToString(); sql = string.Format("DELETE {0}{1}{2} WHERE FEntryID = '{3}'", baseTableName, prodT[j], fID, EntryID); retVal += SqlHelper.ExecuteSql(sql); } } return(retVal); }
private void textBoxX2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string billType = comboBoxEx2.SelectedIndex == 0 ? "XOUT" : "QOUT"; string billNo = billType + textBoxX1.Text; string QRCode = textBoxX2.Text; string mingQRCode = EncryptHelper.Decrypt(QRCode); string EntryID = comboBoxEx1.SelectedValue.ToString(); string interID = billNo + comboBoxEx1.SelectedValue.ToString().PadLeft(4, '0'); string tableName = "t_QRCode" + mingQRCode.Substring(0, 4); int retValDetail = 0; int retValTotal = 0; sql = string.Format("DELETE FROM " + tableName + " WHERE [FQRCode] = '" + mingQRCode + "' AND [FEntryID] = '" + interID + "'"); retValDetail = SqlHelper.ExecuteNonQuery(sql); sql = string.Format("UPDATE [icstock] SET [FActQty] = [FActQty] - 1 WHERE [单据编号] = '{0}' AND [FActQty] > 0 AND [FEntryID] = {1}", billNo, EntryID.ToString()); retValTotal = SqlHelper.ExecuteNonQuery(sql); if (retValTotal > 0 && retValDetail > 0) { DesktopAlert.Show(Utils.H2("二维码删除成功!")); } else if (retValDetail < 1) { DesktopAlert.Show(Utils.H2("二维码不存在!")); } else { DesktopAlert.Show(Utils.H2("二维码删除失败!")); } //清空二维码框 textBoxX2.Text = ""; } }
private void autoSuggest() { AutoCompleteStringCollection namesCollection = new AutoCompleteStringCollection(); SqlDataReader dReader; sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlCommand cmd = new SqlCommand("[materialsListCombo]", sqlcon.calc); cmd.CommandType = CommandType.Text; userConnect.dbIn(); dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { namesCollection.Add(dReader["MaterialName"].ToString()); } } else { DesktopAlert.Show("Data not found"); } dReader.Close(); userConnect.dbOut(); textBoxX1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; textBoxX1.AutoCompleteSource = AutoCompleteSource.CustomSource; textBoxX1.AutoCompleteCustomSource = namesCollection; }
private void save() { var db = new shampazEntities(); var factor = new SellFactor { Date = (DateTime)pdpDate.GeorgianDate + dtpTime.Value.TimeOfDay, PersonId = SelectedPerson.Id, TotalPrice = Convert.ToDecimal(txtTotalPrice.Text), Description = txtDescription.Text, }; db.SellFactors.Add(factor); foreach (DataGridViewRow r in dgvItems.Rows) { factor.SellFactorItems.Add( new SellFactorItem { Name = r.Cells["clnProductName"].Value.ToString(), Numbers = Convert.ToInt32(r.Cells["clnNumber"].Value), Price = Convert.ToDecimal(r.Cells["clnProductPrice"].Value), ProductId = Convert.ToInt32(r.Cells["clnProductId"].Value), TotalPrice = Convert.ToDecimal(r.Cells["clnTotalPrice"].Value), } ); } db.SaveChanges(); DesktopAlert.Show("فاکتور ذخیره شد", eDesktopAlertColor.Green, eAlertPosition.BottomRight); EditedSellFactor = factor; }
private void BAndR() { try { sqlcon userConnect = new sqlcon(); userConnect.dbIn(); SqlDataAdapter da = new SqlDataAdapter("exec [DBBASE]", sqlcon.con); DataTable dt = new DataTable(); da.Fill(dt); metroComboBox1.DataSource = dt; metroComboBox1.DisplayMember = "name"; DataTable mod = new DataTable(); userConnect.dbOut(); metroButton3.Enabled = true; metroComboBox1.Enabled = true; } catch (Exception ex) { //MessageBox.Show(ex.Message); DesktopAlert.Show(ex.Message); } }
private void metroTextButton1_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode.ToString() == "R") { DesktopAlert.Show("Beng"); //slidePanel1.IsOpen = true; } }