示例#1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtTestItems_Count.Text == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "检测项目次数不能为空!", txtTestItems_Count, this);
                    return;
                }
                if (this.txtTestItems_Name.Text == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "检测项目名称不能为空!", txtTestItems_Count, this);
                    return;
                }
                if (Convert.ToDouble(this.txtTestItems_Count.Text) == 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "检测项目次数不能为零!", txtTestItems_Count, this);
                    return;
                }
                if (this.cbxTestItemsState.SelectedIndex > -1)
                {
                    Expression <Func <TestItems, bool> > p = n => n.TestItems_NAME == this.lvwTestItems.SelectedRows[0].Cells["TestItems_NAME"].Value.ToString();
                    Action <TestItems> ap = s =>
                    {
                        s.TestItems_NAME = this.txtTestItems_Name.Text.Trim();
                        //s.Tes_TestItems_ID = Convert.ToInt32(this.txtTes_TestItems_ID.Text.Trim());
                        s.Tes_TestItems_ID        = Convert.ToInt32(this.cbxTes_TestItems_ID.SelectedValue);
                        s.TestItems_Dictionary_ID = Convert.ToInt32(this.cbxTestItemsState.SelectedValue);
                        s.TestItems_COUNT         = Convert.ToInt32(this.txtTestItems_Count.Text.Trim());
                        s.TestItems_REMARK        = this.txtTestItems_Remark.Text.Trim();
                    };

                    if (TestItemsDAL.Update(p, ap))
                    {
                        MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    string strContent = "检测项目名称为:" + this.txtTestItems_Name.Text.Trim();;
                    LogInfoDAL.loginfoadd("修改", "修改 " + strContent + " 的信息", Common.USERNAME);//添加日志
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("项目检测管理 bntUpUser_Click()" + ex.Message.ToString());
            }
            finally
            {
                page = new PageControl();
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();
                ShowAddButton();
            }
        }
示例#2
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtTestItems_Count.Text == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "检测项目次数不能为空!", txtTestItems_Count, this);
                    return;
                }
                if (Convert.ToDouble(this.txtTestItems_Count.Text) == 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "检测项目次数不能为零!", txtTestItems_Count, this);
                    return;
                }
                //ValidateTextBox();//调用验证文本框方法
                if (!btnCheck())
                {
                    return;             //去重
                }
                var TestItemsadd = new TestItems
                {
                    TestItems_NAME = this.txtTestItems_Name.Text.Trim(),
                    //Tes_TestItems_ID = Convert.ToInt32(this.txtTes_TestItems_ID.Text.Trim()),
                    Tes_TestItems_ID        = Convert.ToInt32(this.cbxTes_TestItems_ID.SelectedValue),
                    TestItems_Dictionary_ID = Convert.ToInt32(this.cbxTestItemsState.SelectedValue),
                    TestItems_COUNT         = Convert.ToInt32(this.txtTestItems_Count.Text.Trim()),
                    TestItems_REMARK        = this.txtTestItems_Remark.Text.Trim()
                };

                if (TestItemsDAL.InsertOneQCRecord(TestItemsadd))
                {
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                string strContent = "检测项目名称为:" + this.txtTestItems_Name.Text.Trim();;
                LogInfoDAL.loginfoadd("新增", "新增 " + strContent + " 的信息", Common.USERNAME);//添加日志
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("项目检测管理 btnAdd_Click()" + ex.Message.ToString());
            }
            finally
            {
                page = new PageControl();
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();
            }
        }
示例#3
0
        /// <summary>
        ///删除项目检测信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbtnDelUser_delete()
        {
            try
            {
                int j = 0;
                if (lvwTestItems.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = lvwTestItems.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <TestItems, bool> > funuserinfo = n => n.TestItems_ID == Convert.ToInt32(this.lvwTestItems.SelectedRows[i].Cells["TestItems_ID"].Value.ToString());

                            if (!TestItemsDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        string strContent = "检测项目编号为:" + this.lvwTestItems.SelectedRows[0].Cells["TestItems_ID"].Value.ToString();
                        LogInfoDAL.loginfoadd("删除", "删除 " + strContent + " 的信息", Common.USERNAME);//添加日志
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("项目检测管理 tbtnDelUser_delete()+" + ex.Message.ToString());
            }
            finally
            {
                page = new PageControl();
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();//更新
            }
        }
示例#4
0
        /// <summary>
        /// 登记
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            string Instrument_ID = Getclbinstrument();

            try
            {
                if (this.cob_ClientName.Text != "" && this.clbInstrument_Name.Text != "" && this.cob_Collection_Name.Text != "" && Instrument_ID != "")
                {
                    string sql = null;
                    //调用判断当前采集端是否被客户端占用的方法
                    if (!GetCollection_id(false))
                    {
                        MessageBox.Show("修改失败,该采集端已被占用", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    //判断当前采集端是否被客户端占用或者仪表被占用
                    if (GetInstrument_ID(false))
                    {
                        MessageBox.Show("修改失败,该仪表已被占用", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    sql = "insert into dbo.PolicyConfigurationInfo values('" + this.cob_ClientName.SelectedValue + "','" + this.cob_Collection_Name.SelectedValue + "','" + Instrument_ID + "')";

                    int cou = LinQBaseDao.ExecuteSql(sql);
                    if (cou > 0)
                    {
                        MessageBox.Show("登记成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        string strContent = "客户端为:" + this.cob_ClientName.Text;
                        LogInfoDAL.loginfoadd("登记", "登记" + strContent + "的策略配置的信息", Common.USERNAME);//添加日志
                        InstrumentList();
                        return;
                    }
                    else
                    {
                        MessageBox.Show("登记失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("客户端,采集端端,仪表不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
            catch (Exception)
            {
            }
            InstrumentList();
        }
        /// <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();
            }
        }
示例#6
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("");
            }
        }
示例#7
0
        /// <summary>
        /// 删除
        /// </summary>
        private void tsbDelete_Click()
        {
            try
            {
                int j = 0;
                if (this.DGVUnusual.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int count = DGVUnusual.SelectedRows.Count;
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <Unusualstandard, bool> > funUnusual = n => n.Unusualstandard_ID == Convert.ToInt32(DGVUnusual.SelectedRows[i].Cells["Unusualstandard_ID"].Value.ToString());

                            if (!UnusualstandardDAL.DeleteToMany(funUnusual))
                            {
                                j++;
                                LogInfoDAL.loginfoadd("删除", "删除检测项目异常标准:" + DGVUnusual.SelectedRows[i].Cells["Unusualstandard_PROD"].Value.ToString(), Common.USERNAME);//添加日志
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!");
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("检测项目异常标准 tsbDelete_Click()+" + ex.Message.ToString());
            }
            finally
            {
                page = new PageControl();
                //LoadData(Name);//更新
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        private void InstrumentYanzheng()
        {
            string sql = null;

            try
            {
                if (MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (this.dgvInstrumentInfo.SelectedRows.Count > 0)//选中删除
                    {
                        bool r = false;
                        //选中数量
                        int count = dgvInstrumentInfo.SelectedRows.Count;
                        int cou   = 0;
                        for (int i = 0; i < count; i++)
                        {
                            int id = Convert.ToInt32(dgvInstrumentInfo.SelectedRows[i].Cells["Instrument_ID"].Value.ToString());
                            sql = "delete from dbo.InstrumentInfo where Instrument_ID= " + id;
                            //受影响的行数
                            if (LinQBaseDao.ExecuteSql(sql) > 0)
                            {
                                string strContent = ":" + dgvInstrumentInfo.SelectedRows[i].Cells["Instrument_Name"].Value.ToString();
                                LogInfoDAL.loginfoadd("删除", "删除" + strContent + "仪表登记的信息", Common.USERNAME);//添加日志
                                cou++;
                            }
                        }
                        if (cou > 0)
                        {
                            MessageBox.Show("删除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                            BingList();
                        }
                        else
                        {
                            MessageBox.Show("删除失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择要删除的行!");
                    }
                }
            }
            catch (Exception)
            {
            }
        }
示例#9
0
 private void toolSave_Click(object sender, EventArgs e)
 {
     if (getIntCount() == 1)
     {
         if (intFalg == 1)
         {
             try
             {
                 //退货
                 Sales model = SalesDAL.getEntryById <Sales, DateTime>(addtime);
                 if (model == null)
                 {
                     MessageBox.Show("记录不存在", "提示");
                 }
                 else if (model.Num - sales.Num < 0)
                 {
                     MessageBox.Show("退货数量超出销售数量", "提示");
                 }
                 else if (model.Num - sales.Num == 0)
                 {
                     //退货数量和销售数量一致,删除该销售记录
                     SalesDAL.DeleteEntry <Sales, DateTime>(model.AddTime);
                     LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 3, model.Num, DateTime.Now));
                     MessageBox.Show("退货成功", "提示");
                     BinddgvData();
                 }
                 else
                 {
                     sales.Num = (model.Num - sales.Num);
                     SalesDAL.EditEntry <Sales>(sales, "AddTime");
                     LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 2, (model.Num - sales.Num), DateTime.Now));
                     MessageBox.Show("退货成功", "提示");
                     BinddgvData();
                 }
                 intFalg = 0;
                 ClearControl();
                 ControlStaus();
             }
             catch (Exception ex)
             {
                 MessageBox.Show("退货失败," + ex.Message, "提示");
             }
         }
     }
 }
示例#10
0
        /// <summary>
        /// 确认修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            //得到要修改的仪表
            string Instrument_Name = Getclbinstrument();

            try
            {
                if (this.cob_ClientName.Text != "" && this.clbInstrument_Name.Text != "" && this.cob_Collection_Name.Text != "")
                {
                    string sql = null;
                    //调用判断当前采集端是否被客户端占用的方法
                    if (!GetCollection_id(false))
                    {
                        MessageBox.Show("修改失败,该采集端已被占用", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                    //判断当前采集端是否被客户端占用或者仪表被占用
                    if (GetInstrument_ID(false))
                    {
                        MessageBox.Show("修改失败,该仪表已被占用", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    //修改客户端,采集表
                    int id = int.Parse(cob_ClientName.Tag.ToString());
                    sql = "Update dbo.PolicyConfigurationInfo set PolicyConfiguration_Client_ID=" + this.cob_ClientName.SelectedValue + ",PolicyConfiguration_Collection_ID=" + this.cob_Collection_Name.SelectedValue + ", PolicyConfiguration_Instrument_ID='" + Instrument_Name + "' where PolicyConfiguration_Id=" + id;
                    if (LinQBaseDao.ExecuteSql(sql) > 0)
                    {
                        MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        string strContent = "编号为:" + this.cob_ClientName.Tag;
                        LogInfoDAL.loginfoadd("修改", "修改" + strContent + "的策略配置的信息", Common.USERNAME);//添加日志
                        InstrumentList();
                        return;
                    }
                    else
                    {
                        MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// 添加仪表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnADD_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtInstrument_name.Text.Trim() == "")
                {
                    MessageBox.Show("登记失败!仪表不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string    sql = "";
                DataTable dt  = SelectName();
                //if (dt.Rows.Count <= 0)
                //{
                if (cobInstrument_UserName.Text == "")
                {
                    sql = "insert into InstrumentInfo(Instrument_Collection_ID,Instrument_Name,Instrument_Type) values( " + cmbCollection.SelectedValue + ",'" + txtInstrument_name.Text + "','" + cmbType.SelectedIndex + "')";
                }
                else
                {
                    sql = "insert into InstrumentInfo(Instrument_Collection_ID,Instrument_Name,Instrument_UserID,Instrument_Type) values(" + cmbCollection.SelectedValue + ",'" + txtInstrument_name.Text + "'," + cobInstrument_UserName.SelectedValue + ",'" + cmbType.SelectedIndex + "')";
                }
                if (LinQBaseDao.ExecuteSql(sql) > 0)
                {
                    MessageBox.Show("登记成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    string strContent = this.txtInstrument_name.Text;
                    LogInfoDAL.loginfoadd("添加", "添加:" + strContent + "仪表登记的信息", Common.USERNAME);    //添加日志
                    BingList();
                }
                else
                {
                    MessageBox.Show("登记失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                //}
                //else
                //{
                //    MessageBox.Show("登记失败,该仪表或检测员已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //}
            }
            catch (Exception)
            {
            }
        }
示例#12
0
 /// <summary>
 /// 操作记录到数据库表fh_operateinfo
 /// </summary>
 /// <param name="operType">操作类型</param>
 /// <param name="content">内容</param>
 /// <param name="oper_name">操作人</param>
 public static void WriteLogData(string operType, string content, string oper_name)
 {
     try
     {
         LogInfo qcRecord = new LogInfo();
         if (oper_name == "")
         {
             oper_name = Common.USERNAME;
         }
         qcRecord.Log_Name          = oper_name;
         qcRecord.Log_Dictionary_ID = DictionaryDAL.GetDictionaryID(operType);
         qcRecord.Log_Content       = content;
         qcRecord.Log_Time          = DateTime.Now;
         LogInfoDAL.InsertOneQCRecord(qcRecord);
     }
     catch (Exception ex)
     {
         Common.WriteTextLog("Common.WriteLogData:" + ex.Message.ToString());
     }
 }
        /// <summary>
        /// 确认修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtInstrument_name.Text.Trim() == "")
                {
                    MessageBox.Show("修改失败!仪表不能为空", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    string    sql = "";
                    DataTable dt  = SelectName();
                    if (dt.Rows.Count > 0 && dt.Rows[0]["Instrument_ID"].ToString() != this.txtInstrument_name.Tag.ToString())
                    {
                        MessageBox.Show("修改失败,该仪表已存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    sql = "Update InstrumentInfo set Instrument_Collection_ID=" + cmbCollection.SelectedValue + ", Instrument_UserID=" + this.cobInstrument_UserName.SelectedValue + ",Instrument_Name='" + this.txtInstrument_name.Text + "',Instrument_Type='" + cmbType.SelectedIndex + "' where Instrument_ID=" + this.txtInstrument_name.Tag + "";
                    if (LinQBaseDao.ExecuteSql(sql) > 0)
                    {
                        MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        string strContent = this.txtInstrument_name.Text;
                        LogInfoDAL.loginfoadd("修改", "修改:" + strContent + "仪表登记的信息", Common.USERNAME);//添加日志
                        BingList();
                        btnUpdate.Enabled = false;
                        btnADD.Enabled    = true;
                        btnqk.Enabled     = false;
                    }
                    else
                    {
                        MessageBox.Show("修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
示例#14
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            if (getIntCount() == 1)
            {
                if (intFalg == 1)
                {
                    try
                    {
                        if (StockDAL.add(stock))
                        {
                            LogInfoDAL.add(new LogInfo(0, 1, currentUser.EmpId, 1, stock.Num, stock.AddTime));
                            MessageBox.Show("添加成功", "提示");
                            BinddgvData();
                        }
                        else
                        {
                            MessageBox.Show("添加失败", "提示");
                        }


                        intFalg = 0;

                        ClearControl();
                        ControlStaus();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("添加失败," + ex.Message, "提示");
                    }
                }
                if (intFalg == 2)
                {
                    //修改
                    Stock model = StockDAL.getEntryById <Stock, DateTime>(stock.AddTime);
                    if (model == null)
                    {
                        MessageBox.Show("记录不存在", "提示");
                    }
                    else
                    {
                        stock.AddTime = model.AddTime;
                        StockDAL.EditEntry <Stock>(stock, "AddTime");
                        LogInfoDAL.add(new LogInfo(0, 1, currentUser.EmpId, 2, stock.Num - model.Num, DateTime.Now));
                        MessageBox.Show("修改成功", "提示");
                        BinddgvData();
                    }
                    intFalg = 0;
                    ClearControl();
                    ControlStaus();
                }
                if (intFalg == 3)
                {
                    Stock model = StockDAL.getEntryById <Stock, DateTime>(stock.AddTime);
                    if (model == null)
                    {
                        MessageBox.Show("记录不存在", "提示");
                    }
                    else
                    {
                        if (MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            LogInfoDAL.add(new LogInfo(0, 1, currentUser.EmpId, 3, model.Num, DateTime.Now));
                            StockDAL.DeleteEntry <Stock, DateTime>(model.AddTime);
                            MessageBox.Show("删除成功", "提示");
                            BinddgvData();
                        }
                    }

                    intFalg = 0;
                    ClearControl();
                    ControlStaus();
                }
            }
        }
示例#15
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("");
            }
        }
示例#16
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            if (getIntCount() == 1)
            {
                if (intFalg == 1)
                {
                    try
                    {
                        ReturnRet <int> result = StockDAL.QueryGoodsNum(sales.GoodsId, sales.Num);
                        if (result.success)
                        {
                            if (SalesDAL.add(sales))
                            {
                                LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 1, sales.Num, sales.AddTime));
                                MessageBox.Show("添加成功", "提示");
                                BinddgvData();
                                intFalg = 0;

                                ClearControl();
                                ControlStaus();
                            }
                            else
                            {
                                MessageBox.Show("添加失败", "提示");
                            }
                        }
                        else
                        {
                            MessageBox.Show(result.message);
                            intFalg = 1;
                            txtSellGoodsNum.Text = result.data.ToString();
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("添加失败," + ex.Message, "提示");
                    }
                }
                if (intFalg == 2)
                {
                    //修改
                    Sales model = SalesDAL.getEntryById <Sales, DateTime>(addtime);
                    if (model == null)
                    {
                        MessageBox.Show("记录不存在", "提示");
                    }
                    else
                    {
                        ReturnRet <int> result = StockDAL.QueryGoodsNum(sales.GoodsId, sales.Num);
                        if (result.success)
                        {
                            sales.AddTime = model.AddTime;
                            SalesDAL.EditEntry <Sales>(sales, "AddTime");
                            LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 2, sales.Num - model.Num, DateTime.Now));
                            MessageBox.Show("修改成功", "提示");
                            BinddgvData();
                        }
                        else
                        {
                            MessageBox.Show(result.message);
                            txtSellGoodsNum.Text = result.data.ToString();
                            intFalg = 2;
                            return;
                        }
                    }
                    intFalg = 0;
                    ClearControl();
                    ControlStaus();
                }
                if (intFalg == 3)
                {
                    Sales model = SalesDAL.getEntryById <Sales, DateTime>(addtime);
                    if (model == null)
                    {
                        MessageBox.Show("记录不存在", "提示");
                    }
                    else
                    {
                        if (MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 3, model.Num, DateTime.Now));
                            SalesDAL.DeleteEntry <Sales, DateTime>(model.AddTime);
                            MessageBox.Show("删除成功", "提示");
                            BinddgvData();
                        }
                    }

                    intFalg = 0;
                    ClearControl();
                    ControlStaus();
                }
            }
        }
示例#17
0
        /// <summary>
        /// 删除信息
        /// </summary>
        private void tsbDelete_Click()
        {
            try
            {
                bool isdel = false;
                int  j     = 0;
                if (this.dvgCarList.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("将会同时删除该车辆过数DTS水分数据表的信息,确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        isdel = true;
                        //选中数量
                        int count = dvgCarList.SelectedRows.Count;
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <MATERIAL_QC_INTERFACE, bool> > material_qc = n => n.PO_NO == dvgCarList.SelectedRows[i].Cells["PO_NO"].Value.ToString() && n.SHIPMENT_NO == dvgCarList.SelectedRows[i].Cells["SHIPMENT_NO"].Value.ToString();
                            Expression <Func <OCC_MOIST_INTERFACE, bool> >   occ_moist   = n => n.PO_NO == dvgCarList.SelectedRows[i].Cells["PO_NO"].Value.ToString() && n.SHIPMENT_NO == dvgCarList.SelectedRows[i].Cells["SHIPMENT_NO"].Value.ToString();
                            IEnumerable <OCC_MOIST_INTERFACE> occ_erface = OCC_MOIST_INTERFACEDAL.Query(occ_moist);
                            string trans_to_dtsflag = "";
                            foreach (var occ in occ_erface)
                            {
                                if (!string.IsNullOrEmpty(occ.TRANS_TO_DTS_FLAG))
                                {
                                    trans_to_dtsflag = occ.TRANS_TO_DTS_FLAG;
                                }
                            }
                            if (!string.IsNullOrEmpty(trans_to_dtsflag))
                            {
                                if (MessageBox.Show("编号为:" + dvgCarList.SelectedRows[i].Cells["MATERIAL_QC_INTERFACE_ID"].Value.ToString() + "车牌号为:" + dvgCarList.SelectedRows[i].Cells["CNTRNO"].Value.ToString() + " 已经过数,确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    if (!MATERIAL_QC_INTERFACEDAL.DeleteToMany(material_qc))
                                    {
                                        j++;
                                    }
                                    if (!OCC_MOIST_INTERFACEDAL.DeleteToMany(occ_moist))
                                    {
                                        j++;
                                    }
                                }
                                else
                                {
                                    isdel = false;
                                }
                            }
                            else
                            {
                                if (!MATERIAL_QC_INTERFACEDAL.DeleteToMany(material_qc))
                                {
                                    j++;
                                }
                                if (!OCC_MOIST_INTERFACEDAL.DeleteToMany(occ_moist))
                                {
                                    j++;
                                }
                            }
                        }

                        if (j == 0)
                        {
                            if (isdel)
                            {
                                MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                        else
                        {
                            if (isdel)
                            {
                                MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        string strContent = "编号为:" + dvgCarList.SelectedRows[0].Cells["MATERIAL_QC_INTERFACE_ID"].Value.ToString() + ",车牌号为:" + dvgCarList.SelectedRows[0].Cells["CNTRN"].Value.ToString() + ",删除成功!";
                        LogInfoDAL.loginfoadd("删除", "删除过数DTS水分数据与过数DTS重量数据", Common.USERNAME);//添加日志
                    }
                }
                else if (this.dataGridView1.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("将会同时删除该车辆过数DTS重量数据表的信息,确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        isdel = true;
                        //选中数量
                        int count = dataGridView1.SelectedRows.Count;
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <MATERIAL_QC_INTERFACE, bool> > material_qc = n => n.PO_NO == dataGridView1.SelectedRows[i].Cells["PONO"].Value.ToString() && n.SHIPMENT_NO == dataGridView1.SelectedRows[i].Cells["SHIPMENTNO"].Value.ToString();
                            Expression <Func <OCC_MOIST_INTERFACE, bool> >   occ_moist   = n => n.PO_NO == dataGridView1.SelectedRows[i].Cells["PONO"].Value.ToString() && n.SHIPMENT_NO == dataGridView1.SelectedRows[i].Cells["SHIPMENTNO"].Value.ToString();
                            IEnumerable <OCC_MOIST_INTERFACE> occ_erface = OCC_MOIST_INTERFACEDAL.Query(occ_moist);
                            string trans_to_dtsflag = "";
                            foreach (var occ in occ_erface)
                            {
                                if (!string.IsNullOrEmpty(occ.TRANS_TO_DTS_FLAG))
                                {
                                    trans_to_dtsflag = occ.TRANS_TO_DTS_FLAG;
                                }
                            }
                            if (!string.IsNullOrEmpty(trans_to_dtsflag))
                            {
                                if (MessageBox.Show("编号为:" + dataGridView1.SelectedRows[i].Cells["OCC_MOIST_INTERFACE_ID"].Value.ToString() + "车牌号为:" + dataGridView1.SelectedRows[i].Cells["CNTRN"].Value.ToString() + " 已经过数,确定要删除吗?", "系统提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    if (!MATERIAL_QC_INTERFACEDAL.DeleteToMany(material_qc))
                                    {
                                        j++;
                                    }
                                    if (!OCC_MOIST_INTERFACEDAL.DeleteToMany(occ_moist))
                                    {
                                        j++;
                                    }
                                }
                                else
                                {
                                    isdel = false;
                                }
                            }
                            else
                            {
                                if (!MATERIAL_QC_INTERFACEDAL.DeleteToMany(material_qc))
                                {
                                    j++;
                                }
                                if (!OCC_MOIST_INTERFACEDAL.DeleteToMany(occ_moist))
                                {
                                    j++;
                                }
                            }
                        }
                        if (j == 0)
                        {
                            if (isdel)
                            {
                                MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                        else
                        {
                            if (isdel)
                            {
                                MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        string strContent = "编号为:" + dataGridView1.SelectedRows[0].Cells["OCC_MOIST_INTERFACE_ID"].Value.ToString() + ",车牌号为:" + dataGridView1.SelectedRows[0].Cells["CNTRN"].Value.ToString() + ",删除成功!";
                        LogInfoDAL.loginfoadd("删除", "删除过数DTS水分数据与过数DTS重量数据", Common.USERNAME);//添加日志
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!");
                }
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("InsetfaceFrom tsbDelete_Click()+" + ex.Message.ToString());
            }
            finally
            {
                page = new PageControl();
                page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();
            }
        }
        /// <summary>
        /// “搜 索” 的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch_Click(object sender, EventArgs e)
        {
            #region  注释
            try
            {
                int    i   = 0;
                string str = "";
                //得到查询的条件
                string name      = this.txtLog_Name.Text.Trim();
                string beginTime = this.txtbeginTime.Text.Trim();
                string endTime   = this.txtendTime.Text.Trim();
                string begin     = beginTime + " 00:00:00";
                string end       = endTime + "23:59:59 ";

                expr = PredicateExtensionses.True <View_LogInfo_Dictionary>();

                if (name != "")//操作人
                {
                    expr = expr.And(n => SqlMethods.Like(n.Log_Name, "%" + txtLog_Name.Text.Trim() + "%"));


                    i++;
                }
                if (beginTime != "")//开始时间
                {
                    expr = expr.And(n => n.Log_Time >= CommonalityEntity.GetDateTime(begin));

                    i++;
                }
                if (endTime != "")//结束时间
                {
                    expr = expr.And(n => n.Log_Time <= CommonalityEntity.GetDateTime(end));

                    i++;
                }
                if (beginTime != "" && endTime != "")
                {
                    if (CommonalityEntity.GetDateTime(beginTime) > CommonalityEntity.GetDateTime(endTime))
                    {
                        MessageBox.Show("查询开始时间不能大于结束时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        txtbeginTime.Text = "";
                        txtendTime.Text   = "";
                        return;
                    }
                }
                if (this.comboxType.SelectedValue != null)
                {
                    int stateID = Converter.ToInt(comboxType.SelectedValue.ToString());
                    if (stateID > 0)
                    {
                        Dictionary dicEntity = comboxType.SelectedItem as Dictionary;
                        if (dicEntity.Dictionary_Value == "全部")
                        {
                            expr = n => n.Log_ID != null;
                        }
                        else
                        {
                            expr = expr.And(n => n.Log_Type == CommonalityEntity.GetInt(comboxType.SelectedValue.ToString()));
                        }
                    }


                    i++;
                }

                if (i == 0)
                {
                    expr = n => n.Log_ID != null;
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("CommonalityEntity.btnSearch()");
            }
            finally
            {
                page = new PageControl();
                LogInfoLoad("");
                LoadData();
            }
            #endregion
            if (btnSearch.Enabled)
            {
                btnSearch.Enabled = false;
                GetLogInfoSeach();
                LogInfoDAL.AddLoginfo("查询", "检测项目查询", CommonalityEntity.USERNAME);//操作日志
                btnSearch.Enabled = true;
            }
        }