/// <summary>
        /// 删除详情信息
        /// </summary>
        private void tsbDelete_Click()
        {
            try
            {
                int j = 0;
                if (this.dvgCarList.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int count = dvgCarList.SelectedRows.Count;
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <QCRecord, bool> > funQCRecordinfo = n => n.QCInfo.QCInfo_ID == Convert.ToInt32(dvgCarList.SelectedRows[i].Cells["QCInfo_ID"].Value.ToString());

                            if (!QCRecordDAL.DeleteToMany(funQCRecordinfo))
                            {
                                j++;
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        string strContent = "质检编号为:" + Convert.ToInt32(dvgCarList.SelectedRows[0].Cells["QCInfo_ID"].Value.ToString()) + ",质检车牌号为:" + this.txtCarNO.Text.Trim() + ",删除成功!";
                        LogInfoDAL.loginfoadd("删除", "删除质检信息", Common.USERNAME);//添加日志
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!");
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("车辆统计详情 tsbDelete_Click()+" + ex.Message.ToString());
            }
            finally
            {
                page = new PageControl();
                //LoadData(Name);//更新
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 删除选中的行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbDelete_Click()
        {
            try
            {
                int j = 0;
                if (this.dgv_SFJC.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgv_SFJC.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <QCRecord, bool> > funQCRecordinfo = n => n.QCRecord_ID == Convert.ToInt32(dgv_SFJC.SelectedRows[i].Cells["QCRecord_ID"].Value.ToString());

                            if (!QCRecordDAL.DeleteToMany(funQCRecordinfo))
                            {
                                j++;
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示");
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示");
                        }
                        string strContent = "质检记录编号为:" + QCRecord_ID.ToString() + ",删除";
                        LogInfoDAL.loginfoadd("删除", "删除质检记录信息", Common.USERNAME);//添加日志
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!");
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("手动修改管理 tbtnDelUser_delete()+" + ex.Message.ToString());
            }
            finally
            {
                LoadData("");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 手 动 修 改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                btnSave.Enabled = false;
                #region 验证文本框
                if (this.txtQCRecord_RESULT.Text == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "质检结果不能为空!", txtQCRecord_RESULT, this);
                    btnSave.Enabled = true;
                    return;
                }
                if (Convert.ToDecimal(this.txtQCRecord_RESULT.Text) == 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "质检结果不能为零!", txtQCRecord_RESULT, this);
                    btnSave.Enabled = true;
                    return;
                }
                #endregion

                if (this.cboxState.SelectedIndex > -1 && this.cboxTestItems2.SelectedIndex > -1)
                {
                    Expression <Func <QCRecord, bool> > p = n => n.QCRecord_ID == iQCRecordId;

                    Action <QCRecord> ap = s =>
                    {
                        s.QCRecord_TestItems_ID  = Common.GetInt(cboxTestItems.SelectedValue.ToString()); //检测项目:
                        s.QCRecord_RESULT        = Common.GetDecimal(txtQCRecord_RESULT.Text.Trim());     //水分值/重量值:
                        s.QCRecord_Dictionary_ID = Common.GetInt(cboxState1.SelectedValue.ToString());    //数据状态:
                        s.QCRecord_DRAW          = Common.GetInt(txtQCRecord_DRAW.Text.Trim());           //抽检包序号:
                        s.QCRecord_TARE          = Common.GetInt(txtQCRecord_TARE.Text.Trim());           //(预置)皮重:
                        s.QCRecord_QCCOUNT       = Common.GetInt(txtQCRecord_QCCOUNT.Text.Trim());        //检测序号:
                        s.QCRecord_NUMBER        = txtQCRecord_NUMBER.Text.Trim();                        //仪表序号:
                        s.QCRecord_COUNT         = txtQCRecord_COUNT.Text.Trim();                         //仪表检测次数:

                        //s.QCRecord_RESULT = Convert.ToDecimal(this.txtQCRecord_RESULT.Text.Trim());//水分值
                        //s.QCRecord_NUMBER = this.txtQCRecord_NUMBER.Text.Trim();//质检序号
                        //s.QCRecord_DRAW = Convert.ToDecimal(this.txtQCRecord_DRAW.Text.Trim());//抽检包号
                        //s.QCRecord_TARE = Convert.ToDecimal(this.txtQCRecord_TARE.Text.Trim());//预置皮重
                        //s.QCRecord_QCCOUNT = Convert.ToInt32(this.txtQCRecord_QCCOUNT.Text.Trim());//结果质检次数
                        //s.QCRecord_COUNT = this.txtQCRecord_COUNT.Text.Trim();//记录质检次数
                    };

                    if (txtQCRecord_RESULT.Text.Substring(0, 1) == ".")
                    {
                        mf.ShowToolTip(ToolTipIcon.Info, "提示", "第一位不能是小数点!", txtQCRecord_RESULT, this);
                        this.txtQCRecord_RESULT.Text = "";
                    }
                    else
                    {
                        if (QCRecordDAL.Update(p, ap))
                        {
                            MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            btnSave.Enabled = true;
                            MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        string strContent = "手动修改质检记录编号为:" + iQCRecordId;
                        Common.WriteLogData("修改", strContent, "");//添加日志
                    }
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("手动修改管理 bntUpUser_Click()" + ex.Message.ToString());
            }
            finally
            {
                ClearB();

                LoadData("");
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 查看修改信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbUpdate_Click()
        {
            if (this.dgv_SFJC.SelectedRows.Count > 0)//选中行
            {
                if (dgv_SFJC.SelectedRows.Count > 1)
                {
                    MessageBox.Show("修改只能选中一行!");
                    return;
                }
                else
                {
                    if (dgv_SFJC.SelectedRows[0].Cells["QCRecord_ID"].Value != null)
                    {
                        iQCRecordId = Converter.ToInt(dgv_SFJC.SelectedRows[0].Cells["QCRecord_ID"].Value.ToString(), 0);
                    }
                    if (iQCRecordId > 0)
                    {
                        btnCanle.Enabled = true;
                        btnSave.Enabled  = true;
                        // this.btnSave.Enabled = true;
                        Expression <Func <View_QCRecordInfo, bool> > funviewinto = n => n.QCRecord_ID == iQCRecordId;
                        #region 修改时赋值
                        var qcrecord = QCRecordDAL.Query(funviewinto);
                        if (qcrecord == null)
                        {
                            return;
                        }

                        foreach (var n in QCRecordDAL.Query(funviewinto))
                        {
                            if (n.TestItems_ID > 0)//项目ID
                            {
                                cboxTestItems.SelectedValue = n.TestItems_ID;
                            }
                            if (!string.IsNullOrEmpty(n.TestItems_NAME))//项目名称
                            {
                                FormWate(n.TestItems_NAME);
                            }
                            if (n.QCRecord_RESULT > 0)//水分值/重量值:
                            {
                                txtQCRecord_RESULT.Text = n.QCRecord_RESULT.ToString();
                            }
                            if (n.Dictionary_ID > 0)//数据状态
                            {
                                cboxState1.SelectedValue = n.Dictionary_ID;
                            }
                            if (n.QCRecord_DRAW > 0)//抽检包序号:
                            {
                                txtQCRecord_DRAW.Text = n.QCRecord_DRAW.ToString();
                            }
                            if (n.QCRecord_TARE > 0)//(预置)皮重:
                            {
                                txtQCRecord_TARE.Text = n.QCRecord_TARE.ToString();
                            }
                            if (n.QCRecord_QCCOUNT > 0)//检测序号:
                            {
                                txtQCRecord_QCCOUNT.Text = n.QCRecord_QCCOUNT.ToString();
                            }
                            if (!string.IsNullOrEmpty(n.QCRecord_NUMBER))//仪表序号:
                            {
                                txtQCRecord_NUMBER.Text = n.QCRecord_NUMBER.ToString();
                            }
                            if (!string.IsNullOrEmpty(n.QCRecord_COUNT))//仪表检测次数:
                            {
                                txtQCRecord_COUNT.Text = n.QCRecord_COUNT.ToString();
                            }
                            break;
                        }

                        #endregion
                    }
                }
            }
            else
            {
                MessageBox.Show("请选择要修改的行!");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 对已绑定的单行数据进行修改并保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgv_SFJC.SelectedRows.Count > 1 || iQCRecordId <= 0)
                {
                    MessageBox.Show("修改只能选中一行!");
                }
                else
                {
                    #region 验证文本框
                    if (this.txtQCRecord_RESULT.Text == "")
                    {
                        mf.ShowToolTip(ToolTipIcon.Info, "提示", "质检结果不能为空!", txtQCRecord_RESULT, this);
                        return;
                    }
                    if (Convert.ToDecimal(this.txtQCRecord_RESULT.Text) == 0)
                    {
                        mf.ShowToolTip(ToolTipIcon.Info, "提示", "质检结果不能为零!", txtQCRecord_RESULT, this);
                        return;
                    }
                    #endregion

                    #region 找到要修改行信息的位置并进行修改
                    Expression <Func <QCRecord, bool> > p = n => n.QCRecord_ID == iQCRecordId;
                    Action <QCRecord> ap = s =>
                    {
                        s.QCRecord_RESULT  = Convert.ToDecimal(this.txtQCRecord_RESULT.Text.Trim()); //水分值
                        s.QCRecord_NUMBER  = this.txtQCRecord_NUMBER.Text.Trim();                    //质检序号
                        s.QCRecord_DRAW    = Convert.ToDecimal(this.txtQCRecord_DRAW.Text.Trim());   //抽检包号
                        s.QCRecord_TARE    = Convert.ToDecimal(this.txtQCRecord_TARE.Text.Trim());   //预置皮重
                        s.QCRecord_QCCOUNT = Convert.ToInt32(this.txtQCRecord_QCCOUNT.Text.Trim());  //结果质检次数
                        s.QCRecord_COUNT   = this.txtQCRecord_COUNT.Text.Trim();                     //记录质检次数
                    };

                    if (txtQCRecord_RESULT.Text.Substring(0, 1) == ".")
                    {
                        mf.ShowToolTip(ToolTipIcon.Info, "提示", "第一位不能是小数点!", txtQCRecord_RESULT, this);
                        return;
                    }
                    else
                    {
                        if (QCRecordDAL.Update(p, ap))
                        {
                            MessageBox.Show("修改成功", "提示");
                        }
                        else
                        {
                            MessageBox.Show("修改失败", "提示");
                        }
                    }
                    string strContent = "质检记录编号为:" + QCRecord_ID.ToString() + ",修改";
                    LogInfoDAL.loginfoadd("修改", "修改质检记录信息", Common.USERNAME);//添加日志
                    #endregion
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("手动修改管理 bntUpUser_Click()" + ex.Message.ToString());
            }
            finally
            {
                ClearB();
                LoadData("");
            }
        }