Esempio n. 1
0
        private void ChooseModelModifCB_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            СhooseMarkModifCB.Items.Clear();
            string sqlExpression = "SELECT Mark_auto FROM Automobile Where Model_auto = '" + ChooseModelModifCB.Text + "'";

            CBquery(sqlExpression, СhooseMarkModifCB);
            if (!Model)
            {
                ++countChosenauto;
                Model = true;
            }
            if (countChosenauto == 2)
            {
                countChosenauto = 0;
                ColorModif.Show();
                EngineModif.Show();
                ComplectationModif.Show();
                YearModif.Show();
                YearTB.Show();
                Pricelbl.Show();
                PriceTB.Show();
                ModifButton.Show();
                ColorModifCB.Show();
                sqlExpression = "SELECT Colour FROM Automobile_colour Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')";
                CBquery(sqlExpression, ColorModifCB);
                SpecsModifCB.Show();
                sqlExpression = "SELECT Engine_type FROM Automobile_Specification Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')";
                CBquery(sqlExpression, SpecsModifCB);
                ComplectModifCB.Show();
                sqlExpression = "SELECT Equipment FROM Automobile_Complectation Where _ID_Auto IN(select ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "')";
                CBquery(sqlExpression, ComplectModifCB);
                Model = false;
            }
        }
Esempio n. 2
0
        private void ModifButton_Click(object sender, EventArgs e)
        {
            string sqlExpression = "Insert into Modification Values((select TOP 1 ID_Auto from Automobile Where Mark_Auto = '" + СhooseMarkModifCB.Text + "' AND Model_auto = '" + ChooseModelModifCB.Text + "'),'" +
                                   ColorModifCB.Text + "','" + ComplectModifCB.Text + "','" + SpecsModifCB.Text + "'," + Convert.ToInt32(YearTB.Text) + "," + Convert.ToInt32(PriceTB.Text) + ", NULL)";

            ExecuteQuery(sqlExpression);
            sqlExpression = "insert into Storage Values((select max(ID_Modification) From Modification), NULL)";
            ExecuteQuery(sqlExpression);
            ColorModif.Hide();
            EngineModif.Hide();
            ComplectationModif.Hide();
            YearModif.Hide();
            YearTB.Hide();
            Pricelbl.Hide();
            PriceTB.Hide();
            ModifButton.Hide();
            ColorModifCB.Hide();
            SpecsModifCB.Hide();
            ComplectModifCB.Hide();
            СhooseMarkModifCB.Items.Clear();
            sqlExpression = "SELECT Distinct Mark_auto FROM Automobile";
            CBquery(sqlExpression, СhooseMarkModifCB);
            ChooseModelModifCB.Items.Clear();
            sqlExpression = "SELECT Model_auto FROM Automobile";
            CBquery(sqlExpression, ChooseModelModifCB);
        }
 private void UpdateItemsUC_Load(object sender, EventArgs e)
 {
     loadData();
     ItemTxtLb.Text = "";
     PriceTB.Hide();
     CategoryTB.Hide();
 }
Esempio n. 4
0
 public void ClearTB()
 {
     WarrantyTB.Clear();
     PQtyTB.Clear();
     PriceTB.Clear();
     PModelCombo.Items.Clear();
     TotalTB.Clear();
 }
 private void UpdateItemsUC_Leave(object sender, EventArgs e)
 {
     dataGridView1.ClearSelection();
     PriceTB.Clear();
     CategoryTB.Clear();
     ItemTxtLb.Text = "";
     PriceTB.Hide();
     CategoryTB.Hide();
 }
Esempio n. 6
0
        public ModifyAVPage(int docID, DocumentsManagementPage page)
        {
            _docID = docID;
            InitializeComponent();

            Document doc = SDM.LMS.GetDoc(docID);

            TitleTB.AppendText(doc.Title);
            AutorsTB.AppendText(doc.Autors);
            PriceTB.AppendText(doc.Price.ToString());
            CopiesTB.AppendText(doc.Quantity.ToString());
            TagsTB.AppendText(doc.Tags);

            prevPage = page;
        }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                String name     = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
                String category = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                int    price    = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString());

                ItemTxtLb.Text  = name;
                CategoryTB.Text = category;
                PriceTB.Text    = price.ToString();

                PriceTB.Show();
                CategoryTB.Show();
            }
            catch { }
        }
Esempio n. 8
0
    //计算运费
    private void Charging()
    {
        //根据客户id和公司id获得模板编号
        CustomerPriceTB cpt   = new CustomerPriceTB();
        int             cusid = Convert.ToInt32(ddlName.SelectedValue);
        int             cid   = Convert.ToInt32(ddlCompany.SelectedValue);

        cpt = cpm.GetInfoByCusidAndCid(cusid, cid);
        //根据模板编号,公斤数和目的地计算运费
        string  pno  = cpt.PNo;
        double  kilo = Convert.ToDouble(txtKilo.Text);
        string  des  = txtDes.Text;
        PriceTB pt   = new PriceTB();

        pt = pm.GetPriceByInfo(pno, kilo, des);
        //计算出价格
        txtPrice.Text = pt.Price.ToString();
    }
Esempio n. 9
0
        //根据sql语句查找
        public static List <PriceTB> SelectBySql(string strsql)
        {
            List <PriceTB> list = new List <PriceTB>();

            DataTable ds = DBHelper.GetTable(strsql);

            foreach (DataRow row in ds.Rows)
            {
                PriceTB pt = new PriceTB();
                pt.Pid         = Convert.ToInt32(row["pid"]);
                pt.PNo         = row["pno"].ToString();
                pt.Destination = row["destination"].ToString();
                pt.Kilo        = Convert.ToDouble(row["kilo"]);
                pt.Price       = Convert.ToInt32(row["price"]);
                pt.Remark      = (row["remark"] == DBNull.Value) ? "" : row["remark"].ToString();
                list.Add(pt);
            }
            return(list);
        }
Esempio n. 10
0
        public ModifyBookPage(int docID, DocumentsManagementPage page)
        {
            _docID = docID;
            InitializeComponent();

            Document doc = SDM.LMS.GetDoc(docID);

            TitleTB.AppendText(doc.Title);
            AutorsTB.AppendText(doc.Autors);
            PublisherTB.AppendText(doc.Publisher);
            PublishYearTB.AppendText(doc.PublishYear.ToString());
            EditionTB.AppendText(doc.Edition);
            DescriptionTB.AppendText(doc.Description);
            PriceTB.AppendText(doc.Price.ToString());
            IsBestsellerCB.SelectedIndex = doc.IsBestseller ? 0 : 1;
            CopiesTB.AppendText(doc.Quantity.ToString());
            TagsTB.AppendText(doc.Tags);

            prevPage = page;
        }
Esempio n. 11
0
        private void UpdateBtn_Click(object sender, EventArgs e)
        {
            if (ItemTxtLb.Text == "")
            {
                MessageBox.Show("Choose an item to update", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (CategoryTB.Text == "" || PriceTB.Text == "")
            {
                MessageBox.Show("Complete all the values", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                query = "update items set category = '" + CategoryTB.Text + "', price = '" + PriceTB.Text + "' where name = '" + ItemTxtLb.Text + "'";
                db.setData(query);
                MessageBox.Show("Data Processed Succesfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                loadData();

                SearchTextBox.Text = "Search Item";
                ItemTxtLb.Text     = "";
                CategoryTB.Clear();
                PriceTB.Clear();
            }
        }
Esempio n. 12
0
    public static string LoadDataFromExcel1(string filePath, string fileName, string tableName)
    {
        CustomerPriceService priceservce = new CustomerPriceService();
        string Mess = string.Empty;

        try
        {
            if (!tableName.EndsWith("$"))
            {
                tableName = tableName + "$";
            }

            string          strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + fileName + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'";
            OleDbConnection OleConn = new OleDbConnection(strConn);
            OleConn.Open();
            string           sql        = "SELECT * FROM [" + tableName + "]";
            OleDbCommand     com        = new OleDbCommand(sql, OleConn);
            OleDbDataAdapter OleDaExcel = new OleDbDataAdapter(sql, OleConn);
            DataSet          ds         = new DataSet();
            OleDaExcel.Fill(ds, tableName);
            OleConn.Close();
            int k         = 0;
            int Datacount = 0;
            for (int n = 0; n < ds.Tables.Count; n++)
            {
                if (ds.Tables[n].Rows.Count < 1)
                {
                    Mess = "没有数据!";
                    Datacount++;
                }
            }
            for (int j = 0; j < ds.Tables.Count; j++)
            {
                for (int i = 0; i < ds.Tables[j].Rows.Count; i++)
                {
                    long   num    = Convert.ToInt64(ds.Tables[j].Rows[i + 1][1]);
                    string sqlStr = "insert into CustomerSentTB(Rid,CusID,Cid,Destination,Kilo,Price,Resdate,IsSet) values";
                    sqlStr += " (" + ds.Tables[j].Rows[i + 1][1].ToString() + ",";    //面单号
                    //面单分配
                    DisNoteManager numdis = new DisNoteManager();
                    DisNoteTB      dnt    = new DisNoteTB();
                    //根据面单号查客户ID和公司ID
                    dnt = numdis.GetNoteByRid(Convert.ToInt64(ds.Tables[j].Rows[i + 1][1]));
                    if (dnt.Customer != null)
                    {
                        sqlStr += dnt.Customer.CusID + ",";     //客户ID
                        sqlStr += dnt.CarrieCompany.Cid + ",'"; //公司ID
                    }
                    else
                    {
                        sqlStr += "null" + ",";
                        sqlStr += "null" + ",'";
                    }
                    sqlStr += ds.Tables[j].Rows[i + 1][2].ToString() + "',";    //目的地
                    double kg = Convert.ToDouble(ds.Tables[j].Rows[i + 1][3]);
                    if (kg % 1 > 0)
                    {
                        kg = kg - kg % 1 + 1;
                    }
                    sqlStr += Convert.ToDouble(ds.Tables[j].Rows[i + 1][3]) + ",";    //公斤数
                    if (dnt.Customer != null)
                    {
                        CustomerPriceTB tem = new CustomerPriceTB();
                        tem = priceservce.GetInfoByCusidAndCid(dnt.Customer.CusID, dnt.CarrieCompany.Cid);
                        PriceTB       pt = new PriceTB();
                        PricesManager pm = new PricesManager();
                        pt = pm.GetPriceByInfo(tem.PNo, kg, ds.Tables[j].Rows[i + 1][2].ToString());
                        double price = pt.Price;
                        sqlStr += price + ",'";    //运费
                    }
                    else
                    {
                        sqlStr += 0 + ",'";                                                             //运费
                    }
                    sqlStr += Convert.ToDateTime(ds.Tables[j].Rows[i + 1][4].ToString().Trim()) + "',"; //揽件时间
                    sqlStr += 0 + ")";
                    int row = DBHelper.ExecuteCommand(sqlStr);
                    k += row;
                }
            }
            Mess = k.ToString();
            return(Mess);
        }
        catch (Exception ex)
        {
            Mess = "" + ex.Message;
            return(Mess);
        }
    }