Esempio n. 1
0
        //
        //查看重工记录
        //
        private void dgv_Info_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                Maticsoft.Model.Rework   temRek = (Maticsoft.Model.Rework)dgv_Info.SelectedItem;
                Maticsoft.Model.Rejected temRej = new Maticsoft.Model.Rejected();
                Maticsoft.Model.Dispose  temDis = new Maticsoft.Model.Dispose();
                temRej = _M_Rejected.GetModel(temRek.RejectID);
                temDis = _M_Dispose.GetModel(decimal.Parse(temRek.DisposeID));

                //不良显示
                cmb_Reject.Text            = temRej.Reject;
                txb_Search_RejectCode.Text = temRej.RejectCode;
                //在控件中显示图片
                BitmapImage BI = new BitmapImage();
                BI.BeginInit();
                BI.StreamSource = new MemoryStream(temRej.Picture); //bufPic是图片二进制,byte类型
                BI.EndInit();
                image1.Source = BI;                                 //image是XAML页面上定义的Image控件


                //处理方法显示
                cmb_DesposeMethod.Text = temDis.DisposeMethod;
                lab_ID.Content         = temDis.ID;

                //处理结果
                txb_SerialNumber.Text = temRek.SN;
                cmb_PigtaiType.Text   = temRek.PigtailType;
                cmb_Result.Text       = temRek.Result;
                txb_Operator.Text     = temRek.ReworkID;
                txb_Verify.Text       = temRek.VerifyID;
                txb_Length.Text       = temRek.Length;
            }
            catch (System.Exception ex) { My_MessageBox.My_MessageBox_Message(ex.Message); }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.Rejected model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Rejected(");
            strSql.Append("RejectCode,Reject,Descriptions,Picture,Notes)");
            strSql.Append(" values (");
            strSql.Append("@RejectCode,@Reject,@Descriptions,@Picture,@Notes)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RejectCode",   SqlDbType.VarChar,  20),
                new SqlParameter("@Reject",       SqlDbType.VarChar,  50),
                new SqlParameter("@Descriptions", SqlDbType.VarChar, 100),
                new SqlParameter("@Picture",      SqlDbType.Image),
                new SqlParameter("@Notes",        SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.RejectCode;
            parameters[1].Value = model.Reject;
            parameters[2].Value = model.Descriptions;
            parameters[3].Value = model.Picture;
            parameters[4].Value = model.Notes;

            object obj = dbs.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.Rejected DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Rejected model = new Maticsoft.Model.Rejected();
     if (row != null)
     {
         if (row["RejectCode"] != null)
         {
             model.RejectCode = row["RejectCode"].ToString();
         }
         if (row["Reject"] != null)
         {
             model.Reject = row["Reject"].ToString();
         }
         if (row["Descriptions"] != null)
         {
             model.Descriptions = row["Descriptions"].ToString();
         }
         if (row["Picture"] != null && row["Picture"].ToString() != "")
         {
             model.Picture = (byte[])row["Picture"];
         }
         if (row["Notes"] != null)
         {
             model.Notes = row["Notes"].ToString();
         }
     }
     return(model);
 }
Esempio n. 4
0
        //
        //查找
        //
        private void btn_Find_Click(object sender, RoutedEventArgs e)
        {
            _Rejected = _M_Rejected.GetModel(txb_RejectCode.Text.Trim());
            if (_Rejected != null)
            {
                //填充不良现象
                txb_Reject.Text = _Rejected.Reject;
                //在控件中显示图片
                BitmapImage BI = new BitmapImage();
                BI.BeginInit();
                BI.StreamSource = new MemoryStream(_Rejected.Picture); //bufPic是图片二进制,byte类型
                BI.EndInit();
                image1.Source = BI;                                    //image是XAML页面上定义的Image控件


                //加载不良处理方法
                _Dispe.Clear();
                foreach (Maticsoft.Model.Dispose disp in _M_Dispose.GetModelList(txb_RejectCode.Text.Trim()))
                {
                    _Dispe.Add(disp);
                }
            }
            else
            {
                My_MessageBox.My_MessageBox_Message("未找到该不良代码的记录!");
                ClearControlInfo();
            }
        }
Esempio n. 5
0
 private void ShowInfo(decimal ID)
 {
     Maticsoft.BLL.Rejected   bll   = new Maticsoft.BLL.Rejected();
     Maticsoft.Model.Rejected model = bll.GetModel(ID);
     this.lblID.Text            = model.ID.ToString();
     this.txttb_RejectCode.Text = model.tb_RejectCode;
     this.txtReject.Text        = model.Reject;
     this.txtDescriptions.Text  = model.Descriptions;
     this.txtPicture.Text       = model.Picture.ToString();
     this.txtNotes.Text         = model.Notes;
 }
Esempio n. 6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txttb_RejectCode.Text.Trim().Length == 0)
            {
                strErr += "tb_RejectCode不能为空!\\n";
            }
            if (this.txtReject.Text.Trim().Length == 0)
            {
                strErr += "Reject不能为空!\\n";
            }
            if (this.txtDescriptions.Text.Trim().Length == 0)
            {
                strErr += "Descriptions不能为空!\\n";
            }
            if (this.txtNotes.Text.Trim().Length == 0)
            {
                strErr += "Notes不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            decimal ID            = decimal.Parse(this.lblID.Text);
            string  tb_RejectCode = this.txttb_RejectCode.Text;
            string  Reject        = this.txtReject.Text;
            string  Descriptions  = this.txtDescriptions.Text;

            byte[] Picture = new UnicodeEncoding().GetBytes(this.txtPicture.Text);
            string Notes   = this.txtNotes.Text;


            Maticsoft.Model.Rejected model = new Maticsoft.Model.Rejected();
            model.ID            = ID;
            model.tb_RejectCode = tb_RejectCode;
            model.Reject        = Reject;
            model.Descriptions  = Descriptions;
            model.Picture       = Picture;
            model.Notes         = Notes;

            Maticsoft.BLL.Rejected bll = new Maticsoft.BLL.Rejected();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Esempio n. 7
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Rejected model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Rejected set ");
            strSql.Append("tb_RejectCode=@tb_RejectCode,");
            strSql.Append("Reject=@Reject,");
            strSql.Append("Descriptions=@Descriptions,");
            strSql.Append("Picture=@Picture,");
            strSql.Append("Notes=@Notes");

            SqlParameter[] parameters =
            {
                new SqlParameter("@RejectCode",   SqlDbType.VarChar,  20),
                new SqlParameter("@Reject",       SqlDbType.VarChar,  50),
                new SqlParameter("@Descriptions", SqlDbType.VarChar, 100),
                new SqlParameter("@Picture",      SqlDbType.Image),
                new SqlParameter("@Notes",        SqlDbType.VarChar,  50),
                new SqlParameter("@ID",           SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.RejectCode;
            parameters[1].Value = model.Reject;
            parameters[2].Value = model.Descriptions;
            parameters[3].Value = model.Picture;
            parameters[4].Value = model.Notes;


            int rows = dbs.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Rejected GetModel(string RejectCode)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,RejectCode,Reject,Descriptions,Picture,Notes from tb_Rejected ");
            strSql.Append(" where RejectCode=@RejectCode");
            SqlParameter[] parameters =
            {
                new SqlParameter("@RejectCode", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = RejectCode;

            Maticsoft.Model.Rejected model = new Maticsoft.Model.Rejected();
            DataSet ds = dbs.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }