コード例 #1
0
        private void 物品平均价校对ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CheckMessage();

            int intGoodsID = Convert.ToInt32(txtName.Tag);

            if (!m_blFlag)
            {
                if (txtName.Tag == null || txtName.Text.Trim() == "")
                {
                    MessageDialog.ShowPromptMessage("请选择物品");
                }
                else
                {
                    if (!m_serverStore.ChangeAveragePrice(Convert.ToInt32(txtName.Tag), numPrice.Value,
                                                          rdbNowStockUnitPrice.Checked,
                                                          cmbYear.Text + cmbMonth.Text, out m_err))
                    {
                        MessageDialog.ShowPromptMessage(m_err);
                    }
                    else
                    {
                        MessageDialog.ShowPromptMessage("校对成功");
                    }
                }
            }
            else
            {
                DataTable dtAverageDate = (DataTable)dataGridView1.DataSource;

                for (int i = 0; i < dtAverageDate.Rows.Count; i++)
                {
                    if (!m_serverStore.ChangeAveragePrice(Convert.ToInt32(dtAverageDate.Rows[i]["物品ID"]),
                                                          Convert.ToDecimal(dtAverageDate.Rows[i]["物品实际平均价"]), rdbNowStockUnitPrice.Checked,
                                                          cmbYear.Text + cmbMonth.Text, out m_err))
                    {
                        MessageDialog.ShowPromptMessage(m_err);
                    }
                }

                MessageDialog.ShowPromptMessage("校对成功");
                m_blFlag = false;
            }


            RefreshDataGirdView(m_serverStore.GetStockAveragePrice(rdbNowStockUnitPrice.Checked, cmbYear.Text + cmbMonth.Text));

            if (txtName.Tag != null && txtName.Tag.ToString() != "")
            {
                PositioningRecord(intGoodsID.ToString());
            }
        }