Esempio n. 1
0
        /*
         * 方法名称:ProduceProportion
         * 方法功能描述:同时将生产配合比主表和明细表保存到数据库中的方法 插入到两个表中
         *
         * 创建人:夏阳明
         * 创建时间:20090305
         *
         * 修改人:
         * 修改时间:
         * 修改内容:
         *
         */

        public int ProduceProportion(ProduceProportionClass PPClass, List <ProduceProportionDetailClass> list)
        {
            int id;

            ArrayList sqllist = new ArrayList();

            sqllist.Add(qualityDb.GetPPInsertSqlps(PPClass));

            foreach (ProduceProportionDetailClass PPDClass in list)
            {
                sqllist.Add(qualityDb.GetPPInsertSqlpsd(PPDClass));
            }
            ds = sqlHelperObj.QueryForDateSet(sqllist);

            id = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());

            return(id);
        }
Esempio n. 2
0
        private ProduceProportionClass SetPara()
        {
            ProduceProportionClass PPClass = new ProduceProportionClass();

            try
            {
                PPClass.PId = qualityLogic.FrmMixtureRatioAddSearchPId(Convert.ToInt32(cbxPName.SelectedValue.ToString()),
                                                                       Convert.ToInt32(cbxPModel.SelectedValue.ToString()));
                PPClass.Producer  = cbxProducer.Text;
                PPClass.Remark    = txtRemark.Text;
                PPClass.InputDate = DateTime.Now;
                PPClass.InputMan  = this.userName;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }
            return(PPClass);
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int id;

            List <ProduceProportionDetailClass> list = new List <ProduceProportionDetailClass>();

            ProduceProportionDetailClass PPDClass = null;

            try
            {
                ProduceProportionClass PPClass = SetPara();

                foreach (object obj in panelTable.Controls)
                {
                    TextBox txtOjb = obj as TextBox;
                    if (txtOjb != null)
                    {
                        if (txtOjb.Text != "")
                        {
                            if (Check.CheckFloat((txtOjb.Text)))
                            {
                                PPDClass = new ProduceProportionDetailClass();

                                PPDClass.ProduceProportion      = txtOjb.Tag.ToString();
                                PPDClass.ProduceProportionValue = Convert.ToDouble(txtOjb.Text);
                                PPDClass.Producer  = cbxProducer.Text;
                                PPDClass.InputDate = DateTime.Now;
                                PPDClass.InputMan  = this.userName;

                                list.Add(PPDClass);
                            }
                            else
                            {
                                MessageBox.Show("配合比详细信息只能是数字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                }

                if (PPDClass == null)
                {
                    if (MessageBox.Show("还没有输入详细信息,确定退出吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) ==
                        DialogResult.OK)
                    {
                        this.Close();
                    }
                    else
                    {
                        return;
                    }
                }

                id = Convert.ToInt32(qualityLogic.ProduceProportion(PPClass, list).ToString());

                if (id != 0)
                {
                    txtId.Text = id.ToString();
                    MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    foreach (object obj in panelTable.Controls)
                    {
                        if (obj.GetType() == typeof(TextBox))
                        {
                            ((TextBox)obj).Clear();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("保存失败,请重新操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }
        }