Beispiel #1
0
        /// <summary>
        /// 查重方法
        /// </summary>
        /// <returns></returns>
        private bool btnCheck()
        {
            bool rbool = true;

            try
            {
                var RoleNmae = txtRoleName.Text.Trim();
                if (RoleNmae == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "角色名不能为空!", txtRoleName, this);
                    txtRoleName.Text = "";
                    txtRoleName.Focus();
                    rbool = false;
                }
                Expression <Func <View_UserInfo_D_R_d, bool> > funview_userinfo = n => n.Role_Name == RoleNmae;
                if (UserInfoDAL.Query(funview_userinfo).Count() > 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "该角色已存在", txtRoleName, this);
                    txtRoleName.Focus();
                    rbool = false;;
                }

                return(rbool);
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("角色管理 btnCheck()" + ex.Message.ToString());
                rbool = false;
            }
            return(rbool);
        }
Beispiel #2
0
        /// <summary>
        /// 查重方法
        /// </summary>
        /// <returns></returns>
        private bool btnCheck()
        {
            bool rbool = true;

            try
            {
                var LoginId = txtName.Text.Trim();
                if (LoginId == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "真实姓名不能为空!", txtName, this);
                    txtName.Text = "";
                    txtName.Focus();
                    rbool = false;
                }
                Expression <Func <UserInfo2, bool> > funview_userinfo = n => n.UserName == LoginId;
                if (UserInfo2DAL.Query(funview_userinfo).Count() > 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "该真实姓名已存在", txtName, this);
                    txtName.Focus();
                    rbool = false;;
                }

                return(rbool);
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("用户管理 btnCheck()" + ex.Message.ToString());
                rbool = false;
            }
            return(rbool);
        }
        /// <summary>
        /// 判断
        /// </summary>
        /// <returns></returns>
        private bool GetBool()
        {
            bool rbool = true;

            if (string.IsNullOrEmpty(cob_Beonduty_Dictionary_Name.SelectedItem.ToString()))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "状态不能为空", cob_Beonduty_Dictionary_Name, this);
                rbool = false;
            }
            if (string.IsNullOrEmpty(cob_QCGroup_Name.SelectedItem.ToString()))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "小组不能为空", cob_QCGroup_Name, this);
                rbool = false;
            }
            if (string.IsNullOrEmpty(dtp_beginTime.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "开始时间不能为空", dtp_beginTime, this);
                rbool = false;
            }
            if (string.IsNullOrEmpty(dtp_endTime.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "结束不能为空", dtp_endTime, this);
                rbool = false;
            }
            if (Common.GetDateTime(dtp_beginTime.Text) > Common.GetDateTime(dtp_endTime.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "开始时间不能大于结束时间", dtp_endTime, this);
                rbool = false;
            }
            return(rbool);
        }
Beispiel #4
0
        /// <summary>
        /// 查重方法
        /// </summary>
        /// <returns></returns>
        private bool btnCheck()
        {
            bool rbool = true;

            try
            {
                //定义一个字段用以保存项目检测名称
                var TestItemsName = this.txtTestItems_Name.Text.Trim();
                //判断名称是否为空
                if (TestItemsName == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "检测项目名称不能为空!", txtTestItems_Name, this);
                    txtTestItems_Name.Text = "";
                    txtTestItems_Name.Focus();
                    rbool = false;
                }
                Expression <Func <View_TestItems_Dictionary, bool> > funview_TestItemsinfo = n => n.TestItems_NAME == TestItemsName;
                if (TestItemsDAL.Query(funview_TestItemsinfo).Count() > 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "该检测项目名称已存在", txtTestItems_Name, this);
                    txtTestItems_Name.Focus();
                    rbool = false;;
                }
                return(rbool);
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("项目检测管理 btnCheck()" + ex.Message.ToString());
                rbool = false;
            }
            return(rbool);
        }
Beispiel #5
0
 private void update()
 {
     try
     {
         if (txtOldPwd.Text.Trim() == "")
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码不能为空!", txtOldPwd, this);
             txtOldPwd.Focus();
             return;
         }
         else
         {
             if (txtOldPwd.Text.Trim() != Common.PWD)
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码不正确!", txtOldPwd, this);
                 txtOldPwd.Focus();
                 return;
             }
         }
         if (txtNewPwd.Text.Trim() == "")
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "新密码不能为空!", txtNewPwd, this);
             txtNewPwd.Focus();
             return;
         }
         if (txtSurePwd.Text.Trim() == "")
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "两次输入的密码不一致,请重新输入!", txtNewPwd, this);
             txtNewPwd.Text  = "";
             txtSurePwd.Text = "";
             txtNewPwd.Focus();
             return;
         }
         Expression <Func <UserInfo, bool> > funUserinfo = n => n.UserLoginId == Common.USERNAME;
         Action <UserInfo> action = n =>
         {
             n.UserLoginPwd = txtNewPwd.Text.Trim();
         };
         if (UserInfoDAL.Update(funUserinfo, action))
         {
             MessageBox.Show("密码修改成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("修改失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         Common.WriteTextLog("SetPassWord +update()" + ex.Message.ToString());
     }
 }
 /// <summary>
 /// 添加菜单方法
 /// </summary>
 private void btn_Add_Click()
 {
     try
     {
         if (Common.GetInt(TV_MenuInfo.SelectedNode.Tag.ToString()) < 0)
         {
             MessageBox.Show("请选中节点", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (string.IsNullOrEmpty(cob_Menu_Dictionary_ID.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "状态不能为空!", cob_Menu_Dictionary_ID, this);
             return;
         }
         if (string.IsNullOrEmpty(cob_Menu_ControlType.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "控件类型不能为空!", cob_Menu_ControlType, this);
             return;
         }
         //if (string.IsNullOrEmpty(txt_Menu_ControlText.Text))
         //{
         //    mf.ShowToolTip(ToolTipIcon.Info, "提示", "菜单名称不能为空!", txt_Menu_ControlText, this);
         //    return;
         //}
         if (string.IsNullOrEmpty(cob_Menu_Visible.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "是否可见不能为空!", cob_Menu_Visible, this);
             return;
         }
         if (string.IsNullOrEmpty(cob_Menu_Enabled.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "是否可见不能为空!", cob_Menu_Enabled, this);
             return;
         }
         var MenuInfoAdd = new MenuInfo
         {
             Menu_Dictionary_ID = Common.GetInt(cob_Menu_Dictionary_ID.SelectedValue.ToString()), //状态
             Menu_OtherID       = Common.GetInt(TV_MenuInfo.SelectedNode.Tag.ToString()),         //父级ID
         };
     }
     catch (Exception ex)
     {
         Common.WriteTextLog("MenuInfoADD.btn_Add_Click()" + ex.Message.ToString());
     }
     finally
     {
         InitMenu();//重新绑定控件
     }
 }
Beispiel #7
0
        /// <summary>
        /// 验证  字典表  Dictionary_Value 非空
        /// </summary>
        /// <returns></returns>
        private bool InputCheck()
        {
            // 保存字典值
            string strDictionaryValue = this.txtDictionary_Value.Text.Trim();

            // 开始验证
            if (string.IsNullOrEmpty(strDictionaryValue))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "保存提示", "请您输入字典值!", txtDictionary_Value, this);
                return(false);
            }

            // 如果已通过以上所有验证则返回真
            return(true);
        }
Beispiel #8
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("");
            }
        }
        private bool StrIsNullOrEmpty()
        {
            int           k     = 0;
            bool          rbool = true;
            StringBuilder sb    = new StringBuilder();

            if (string.IsNullOrEmpty(cobMOISTURE.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "水分仪串口号不能为空!", cobMOISTURE, this);
                rbool = false;
            }
            if (string.IsNullOrEmpty(cmbMOISTURENAME.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "水分仪编号不能为空!", cmbMOISTURENAME, this);
                rbool = false;
            }

            if (string.IsNullOrEmpty(cobWeight.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "小磅串口号不能为空!", cobWeight, this);
                rbool = false;
            }

            if (string.IsNullOrEmpty(txtLEDFromX.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "LED屏幕X坐标不能为空!", txtLEDFromX, this);
                rbool = false;
            }
            else
            {
                if (!int.TryParse(txtLEDFromX.Text, out k))
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "请在LED屏幕X坐标框中输入整数!", txtLEDFromX, this);
                    rbool = false;
                }
            }
            if (string.IsNullOrEmpty(txtLEDFromY.Text))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "LED屏幕Y坐标不能为空!", txtLEDFromY, this);
                rbool = false;
            }
            else
            {
                if (!int.TryParse(txtLEDFromY.Text, out k))
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "请在LED屏幕Y坐标框中输入整数!", txtLEDFromY, this);
                    rbool = false;
                }
            }
            if (!string.IsNullOrEmpty(txtLEDX.Text))
            {
                if (!int.TryParse(txtLEDX.Text, out k))
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "请在LED内容起X坐标框中输入整数!", txtLEDX, this);
                    rbool = false;
                }
            }
            if (!string.IsNullOrEmpty(txtLEDY.Text))
            {
                if (!int.TryParse(txtLEDY.Text, out k))
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "设置提示", "请在LED内容起Y坐标框中输入整数!", txtLEDY, this);
                    rbool = false;
                }
            }
            return(rbool);
        }
 /// <summary>
 /// 修改菜单信息
 /// </summary>
 private void UpdateMenuInfo()
 {
     try
     {
         if (Common.GetInt(tvMenuList.SelectedNode.Tag.ToString()) < 0)
         {
             MessageBox.Show("请选中节点 ", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (string.IsNullOrEmpty(cbDictionary.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "请选择菜单状态!", cbDictionary, this);
             return;
         }
         if (string.IsNullOrEmpty(cbControlType.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "请选择类型!", cbControlType, this);
             return;
         }
         if (string.IsNullOrEmpty(cbVisble.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "请选择是否可见!", cbVisble, this);
             return;
         }
         if (string.IsNullOrEmpty(cbEnabled.Text))
         {
             mf.ShowToolTip(ToolTipIcon.Info, "提示", "请选择是否可编辑!", cbEnabled, this);
             return;
         }
         bool enabled = false;
         bool Visible = false;
         if (cbEnabled.Text == "是")
         {
             enabled = true;
         }
         if (cbVisble.Text == "是")
         {
             Visible = true;
         }
         int nodes = Common.GetInt(tvMenuList.SelectedNode.Tag.ToString());
         Expression <Func <MenuInfo, bool> > fun = n => n.Menu_ID == Common.GetInt(tvMenuList.SelectedNode.Tag.ToString());
         Action <MenuInfo> action = null;
         if (cbControlType.SelectedIndex >= 5)
         {
             if (string.IsNullOrEmpty(tbControlText.Text))
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "请输入控件中文名称", tbControlText, this);
                 return;
             }
             if (string.IsNullOrEmpty(tbControlName.Text))
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "请输入控件名称", tbControlText, this);
                 return;
             }
             if (string.IsNullOrEmpty(tbFromName.Text))
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "请输入菜单名称", tbControlText, this);
                 return;
             }
             action = m =>
             {
                 m.Menu_Dictionary_ID = Common.GetInt(cbDictionary.SelectedIndex.ToString()) + 2;  //状态
                 m.Menu_ControlType   = Common.GetStr(cbControlType.SelectedIndex.ToString()) + 1; //类型
                 m.Menu_ControlName   = tbControlName.Text;                                        //控件名称
                 m.Menu_ControlText   = tbControlText.Text;                                        //控件中文名称
                 m.Menu_Enabled       = enabled;                                                   //是否可用
                 m.Menu_Visible       = Visible;                                                   //是否可见
                 m.Menu_FromName      = tbFromName.Text;                                           //菜单名称
                 m.Menu_FromText      = tbFromText.Text;                                           //菜单中文名称
             };
         }
         else
         {
             if (string.IsNullOrEmpty(tbFromText.Text))
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "请输入菜单中文名称", tbControlText, this);
                 return;
             }
             if (string.IsNullOrEmpty(tbFromName.Text))
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "请输入菜单名称", tbControlText, this);
                 return;
             }
             if (string.IsNullOrEmpty(tbControlText.Text))
             {
                 mf.ShowToolTip(ToolTipIcon.Info, "提示", "请输入控件中文名称", tbControlText, this);
                 return;
             }
             action = m =>
             {
                 m.Menu_Dictionary_ID = Common.GetInt(cbDictionary.SelectedIndex.ToString()) + 2;  //状态
                 m.Menu_MenuType_ID   = Common.GetInt(cbControlType.SelectedIndex.ToString()) + 1; //类型s
                 m.Menu_ControlName   = tbControlName.Text;                                        //控件名称
                 m.Menu_ControlText   = tbControlText.Text;                                        //控件中文名称
                 m.Menu_Enabled       = enabled;                                                   //是否可用
                 m.Menu_Visible       = Visible;                                                   //是否可见
                 m.Menu_FromName      = tbFromName.Text;                                           //菜单名称
                 m.Menu_FromText      = tbFromText.Text;                                           //菜单中文名称
             };
         }
         if (!MenuInfoDAL.Update(fun, action))//是否修改失败
         {
             MessageBox.Show(" 修改失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("修改成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         Common.WriteTextLog("UpdateMenuInfo()" + ex.Message.ToString());//记录异常信息
     }
     finally
     {
         tvMenuList.Nodes.Clear();
         MenuInfoLoad();//重新加载数据
     }
 }
Beispiel #11
0
        /// <summary>
        /// 查重方法
        /// </summary>
        /// <returns></returns>
        private bool btnCheck()
        {
            bool rbool = true;

            try
            {
                //定义一个字段用以保存预置皮重名称
                var PresetTradeName = this.txtPresetTare_Name.Text.Trim();
                //判断名称是否为空
                if (PresetTradeName == "")
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "预置皮重名称不能为空!", txtPresetTare_Name, this);
                    txtPresetTare_Name.Text = "";
                    txtPresetTare_Name.Focus();
                    rbool = false;
                }
                Expression <Func <View_PresetTare_Dictionary, bool> > funview_PresetTredeinfo = n => n.PresetTare_NAME == PresetTradeName;
                if (PresetTareDAL.Query(funview_PresetTredeinfo).Count() > 0)
                {
                    mf.ShowToolTip(ToolTipIcon.Info, "提示", "该预置皮重名称已存在", txtPresetTare_Name, this);
                    txtPresetTare_Name.Focus();
                    rbool = false;;
                }
                return(rbool);
            }
            catch (Exception ex)
            {
                Common.WriteTextLog("用户管理 btnCheck()" + ex.Message.ToString());
                rbool = false;
            }
            return(rbool);
        }