示例#1
0
        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();
        }
示例#2
0
        /// <summary>
        /// Export to XPS
        /// </summary>
        public void ExportToXPS()
        {
            // If there are no rows in the grid then we cannot export
            if (_currentGrid.Rows.Count == 0)
            {
                MessageBox.Show("There is no data to Export", "Export Error");
            }

            else
            {
                // First browse for the folder / file that we will save
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.ValidateNames = false;
                saveFileDialog.FileName      = "AuditWizardData.xps";
                saveFileDialog.Filter        = "XML Paper Specification (*.xps)|*.xps";

                if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    UltraGridExporter.Export(saveFileDialog.FileName
                                             , ""
                                             , ""
                                             , ""
                                             , _currentGrid
                                             , Infragistics.Documents.Reports.Report.FileFormat.XPS);

                    DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'");
                }
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        /// <summary>
        /// Export to XPS
        /// </summary>
        public void ExportToXPS()
        {
            // If there are no rows in the grid then we cannot export
            if (this.OSDataSet.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("There is no data to Export", "Export Error");
            }

            else
            {
                // First browse for the folder / file that we will save
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.ValidateNames = false;
                saveFileDialog.FileName      = headerLabel.Text + ".xps";
                saveFileDialog.Filter        = "XML Paper Specification (*.xps)|*.xps";

                if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    UltraGridExporter.Export(saveFileDialog.FileName
                                             , "AuditWizard Applications View : " + OSGridView.Text
                                             , "Generated by AuditWizard from Layton Technology, Inc."
                                             , DataStrings.Disclaimer
                                             , OSGridView
                                             , Infragistics.Documents.Reports.Report.FileFormat.XPS);
                    DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'");
                }
            }
        }
示例#5
0
        /// <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);
        }
示例#6
0
        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;
            }
        }
示例#7
0
 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 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;
            }
        }
示例#9
0
        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);
            }
        }
示例#10
0
        /// <summary>
        /// save function for the IAdministrationView Interface
        /// </summary>
        public void Save()
        {
            if (!ValidateRequiredValues())
            {
                return;
            }

            auditAgentScannerDefinition.ScannerName = tbName.Text;
            auditAgentScannerDefinition.Filename    = Path.Combine(Application.StartupPath, @"scanners\auditagent\" + auditAgentScannerDefinition.ScannerName + ".xml");

            if (File.Exists(auditAgentScannerDefinition.Filename))
            {
                if (MessageBox.Show("The config file '" + auditAgentScannerDefinition.ScannerName + "' already exists." + Environment.NewLine + Environment.NewLine +
                                    "Do you wish to overwrite the file?", "AuditWizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            UpdateChanges();

            if (AuditWizardSerialization.SerializeObjectToFile(auditAgentScannerDefinition))
            {
                DesktopAlert.ShowDesktopAlert("The scanner configuration file '" + auditAgentScannerDefinition.ScannerName + "' has been saved.");
            }
        }
 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!");
     }
 }
示例#12
0
        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");
            }
        }
示例#13
0
        /// <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("无效的二维码!"));
            }
        }
示例#14
0
 /// <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("没有数据!"));
     }
 }
示例#15
0
文件: Form7.cs 项目: rayworld/DS9208
        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 = "";
            }
        }
示例#16
0
        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;
        }
示例#17
0
        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;
        }
示例#18
0
        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;
            }
        }
示例#19
0
        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();
            }
        }
示例#20
0
        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;
            }
        }
示例#21
0
        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!");
        }
示例#22
0
 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 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();
        }
示例#24
0
        /// <summary>
        /// The background worker has completed and as such we need to signal the UI thread of this fact
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void backgroundWorkerUpload_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bnClose.Visible     = true;
            bnClose.Enabled     = true;
            bnCancel.Visible    = false;
            bnUploadAll.Enabled = true;
            lvAudits.SelectedItems.Clear();

            // If we have been returned an error status then we do not display the summary but instead allow the user to see
            // the message reported.
            if ((int)e.Result == -1)
            {
                DesktopAlert.ShowDesktopAlert("Upload complete.");
            }
            else
            {
                DesktopAlert.ShowDesktopAlert("The selected Audit Data file(s) have been successfully uploaded.");

                foreach (AuditDataFile file in _uploadedFiles)
                {
                    foreach (UltraListViewItem listViewItem in lvAudits.Items)
                    {
                        if (listViewItem.Key == file.FileName)
                        {
                            lvAudits.Items.Remove(listViewItem);
                            break;
                        }
                    }
                }

                // Update the status bar
                lblProgress.Text = "Audit(s) uploaded.";
            }
        }
示例#25
0
 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);
                 }
             }
         }
     }
 }
示例#26
0
 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 {}
 }
        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;
        }
        /// <summary>
        /// Export to PDF
        /// </summary>
        public void ExportToPDF()
        {
            // If there are no rows in the grid then we cannot export
            if (this.applicationsDataSet.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show("There is no data to Export", "Export Error");
            }

            else
            {
                // We need to temporarily set the grid view to 'Resize all columns' in order to get
                // the resultant PDF file formatted correctly.
                AutoFitStyle oldStyle = applicationsGridView.DisplayLayout.AutoFitStyle;
                applicationsGridView.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;

                // First browse for the folder / file that we will save
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.ValidateNames = false;
                saveFileDialog.FileName      = headerLabel.Text + ".pdf";
                saveFileDialog.Filter        = "Adobe Acrobat Document (*.pdf)|*.pdf";

                if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    UltraGridDocumentExporter exporter = new UltraGridDocumentExporter();
                    exporter.Export(applicationsGridView, saveFileDialog.FileName, GridExportFileFormat.PDF);
                    DesktopAlert.ShowDesktopAlert("Data successfully exported to '" + saveFileDialog.FileName + "'");
                }

                // Populate the old autofit style
                this.applicationsGridView.DisplayLayout.AutoFitStyle = oldStyle;
            }
        }
示例#29
0
        /// <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 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);
            }
        }