Beispiel #1
0
 private void buttonX1_Click(object sender, EventArgs e)
 {
     //TestBZFrom tbz = new TestBZFrom();
     //tbz.Show();
     for (int i = 0; i < gridView1.RowCount; i++)
     {
         int    XH   = Convert.ToInt32(gridView1.GetRowCellValue(i, "id"));
         string LJH  = gridView1.GetRowCellValue(i, "PN").ToString();
         string NM   = gridView1.GetRowCellValue(i, "name").ToString();
         string GDH  = gridView1.GetRowCellValue(i, "jobnum").ToString();
         string CSBH = gridView1.GetRowCellValue(i, "ARef").ToString();
         string CC   = gridView1.GetRowCellValue(i, "size").ToString();
         string sd   = gridView1.GetRowCellValue(i, "sm").ToString();
         string TM   = gridView1.GetRowCellValue(i, "Barcode").ToString();
         Maticsoft.BLL.parts   use = new Maticsoft.BLL.parts();
         Maticsoft.Model.parts us  = new parts()
         {
             id = XH,
             PN = LJH,
             //name = NM,
             //jobnum = GDH,
             //ARef = CSBH,
             //size = CC,
             //sm = sd,
             Barcode = TM,
         };
         use.Update(us);
     }
     MessageBox.Show("修改成功");
 }
Beispiel #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtPN.Text.Trim().Length == 0)
            {
                strErr += "PN不能为空!\\n";
            }
            if (this.txtname.Text.Trim().Length == 0)
            {
                strErr += "name不能为空!\\n";
            }
            if (this.txtjobnum.Text.Trim().Length == 0)
            {
                strErr += "jobnum不能为空!\\n";
            }
            if (this.txtARef.Text.Trim().Length == 0)
            {
                strErr += "ARef不能为空!\\n";
            }
            if (this.txtsize.Text.Trim().Length == 0)
            {
                strErr += "size不能为空!\\n";
            }
            if (this.txtsm.Text.Trim().Length == 0)
            {
                strErr += "sm不能为空!\\n";
            }
            if (this.txtBarcode.Text.Trim().Length == 0)
            {
                strErr += "Barcode不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    id      = int.Parse(this.lblid.Text);
            string PN      = this.txtPN.Text;
            string name    = this.txtname.Text;
            string jobnum  = this.txtjobnum.Text;
            string ARef    = this.txtARef.Text;
            string size    = this.txtsize.Text;
            string sm      = this.txtsm.Text;
            string Barcode = this.txtBarcode.Text;


            Maticsoft.Model.parts model = new Maticsoft.Model.parts();
            model.id      = id;
            model.PN      = PN;
            model.name    = name;
            model.jobnum  = jobnum;
            model.ARef    = ARef;
            model.size    = size;
            model.sm      = sm;
            model.Barcode = Barcode;

            Maticsoft.BLL.parts bll = new Maticsoft.BLL.parts();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_ljh.Text == "")
                {
                    MessageBox.Show("零件号为空");
                    return;
                }
                if (textBox_lxm.Text == "")
                {
                    MessageBox.Show("序列号为空");
                    return;
                }
                if (textbox_gongdan.Text == "")
                {
                    MessageBox.Show("工单号为空");
                    return;
                }
                if (comboBox1.SelectedIndex < 0)
                {
                    MessageBox.Show("请选择正确的类型");
                    return;
                }

                Maticsoft.BLL.parts          part_bll   = new Maticsoft.BLL.parts();
                List <Maticsoft.Model.parts> parts_list = part_bll.GetModelList(string.Format(" PN = '{0}'", textBox_ljh.Text));
                if (parts_list.Count > 0)
                {
                    Maticsoft.Model.parts parts_exmode = parts_list[0];
                    parts_exmode.Barcode     = textBox_lxm.Text;
                    parts_exmode.PN          = textBox_ljh.Text;
                    parts_exmode.remark      = "管理";
                    parts_exmode.gongdan     = textbox_gongdan.Text;
                    parts_exmode.componentId = this.comp_list[comboBox1.SelectedIndex].componentId;

                    if (part_bll.Update(parts_exmode))
                    {
                        MessageBox.Show("更新成功");
                    }
                    else
                    {
                        MessageBox.Show("更新失败");
                    }
                }
                else
                {
                    Maticsoft.Model.parts parts_mode = new Maticsoft.Model.parts()
                    {
                        Barcode     = textBox_lxm.Text,
                        PN          = textBox_ljh.Text,
                        remark      = "管理",
                        gongdan     = textbox_gongdan.Text,
                        componentId = this.comp_list[comboBox1.SelectedIndex].componentId,
                    };


                    if (part_bll.Add(parts_mode))
                    {
                        MessageBox.Show("添加成功");
                    }
                    else
                    {
                        MessageBox.Show("添加失败");
                    }
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally
            {
                this.DialogResult = DialogResult.OK;
            }
        }