private void ModifyUser_Click()
 {
     try
     {
         Expression <Func <RoleInfo, bool> > p = n => n.Role_Id == Convert.ToInt32(lblId.Text);
         Action <RoleInfo> ap = n =>
         {
             n.Role_Name   = txtRoleName.Text.Trim();
             n.Role_State  = comboxState.Text.Trim();
             n.Role_Remark = txtRemark.Text.Trim();
         };
         if (!RoleInfoAdd.UpdateOneRoleInfo(p, ap))//用户是否修改失败
         {
             MessageBox.Show(" 修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             string Log_Content = String.Format("用户名称:{0} ", lblId.Text.Trim());
             CommonalityEntity.WriteLogData("修改", "修改" + Log_Content + "的信息", CommonalityEntity.USERNAME);
         }
     }
     catch
     {
         CommonalityEntity.WriteTextLog("用户管理 bntUpUser_Click()");
     }
     finally
     {
         page = new PageControl();
         LoadData();
         userContext();
     }
 }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                if (NullHandleMethod())
                {
                    if (intCarTypeID > 0)
                    {
                        OthCarAttribute("", cbxCarAttribute.Text.Trim());
                        ssy = 0;
                        Expression <Func <CarType, bool> > funCartype = n => n.CarType_ID == intCarTypeID;
                        Action <CarType> action = n =>
                        {
                            n.CarType_UserId            = CommonalityEntity.GetInt(CommonalityEntity.USERID);
                            n.CarType_Name              = txt_CarTypeNmae.Text.Trim();
                            n.CarType_Content           = txt_CarTypeContent.Text.Trim();
                            n.CarType_State             = cob_CarTypeState.Text.Trim();
                            n.CarType_Property          = cbxCarAttribute.Text.Trim();
                            n.CarType_Remark            = txt_CarTypeRemarks.Text.Trim();
                            n.CarType_Validity          = cob_CarTypeEffective.Text.Trim();
                            n.CarType_ValidityTemporary = cob_CarTypeTemporary.Text.Trim();
                            n.CarType_OtherProperty     = butname.Trim();
                            if (!string.IsNullOrEmpty(txt_CarTemporaryValue.Text.Trim()))
                            {
                                n.CarType_ValidityValue = CommonalityEntity.GetInt(txt_CarTemporaryValue.Text.Trim());
                            }
                            if (!string.IsNullOrEmpty(txtInOutTime.Text.Trim()))
                            {
                                n.CarType_InOutTime = CommonalityEntity.GetInt(txtInOutTime.Text.Trim());
                            }
                            n.CarType_Value    = txt_CarTypeValue.Text.Trim();
                            n.CarType_DriSName = cmbDriSta.Text;
                            n.CarType_BusType  = txtBusType.Text.Trim();
                        };
                        if ((CarTypeDAL.Update(funCartype, action)))
                        {
                            //查出通行策略ID、通道ID

                            updateDri(cmbDriSta.Text);
                            btn_Empty_Click(btn_Empty, null);                                                                        //调用清空按钮事件
                            CommonalityEntity.WriteLogData("修改", "车辆类型:" + txt_CarTypeNmae.Text.Trim(), CommonalityEntity.USERNAME); //添加操作日志
                            btn_Empty.Text = "清 空";
                            MessageBox.Show(this, "修改成功");
                        }
                    }
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("CarTypeForm.btnUpdate_Click()");
                MessageBox.Show(this, "修改失败");
            }
            finally
            {
                btn_Save.Enabled  = true;
                btnUpdate.Enabled = false;
                BingMethod();
            }
        }
        /// <summary>
        /// 修改事件
        /// </summary>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtRoleName.Text))
            {
                MessageBox.Show(this, "角色名称不能为空!");
                return;
            }
            if (comboxState.SelectedIndex < 0)
            {
                MessageBox.Show(this, "请选择状态!");
                return;
            }
            string            name   = txtRoleName.Text;                    //姓名
            string            remark = txtRemark.Text;                      //备注
            string            state  = comboxState.SelectedItem.ToString(); //状态
            string            id     = lblId.Text;                          //id
            int               j      = 0;
            Action <RoleInfo> action = n =>
            {
                n.Role_Name       = name;
                n.Role_Remark     = remark;
                n.Role_State      = state;
                n.Role_Permission = "";
            };

            try
            {
                Expression <Func <RoleInfo, bool> > funroleinfo = n => n.Role_Id.ToString() == id;
                if (!RoleInfoAdd.UpdateOneRoleInfo(funroleinfo, action))//角色是否修改失败
                {
                    j++;
                }
                if (j == 0)
                {
                    MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    string Log_Content = String.Format("角色名称:{0}", name);
                    CommonalityEntity.WriteLogData("修改", "修改" + Log_Content + "的信息", CommonalityEntity.USERNAME);
                }
                else
                {
                    MessageBox.Show(" 修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("角色管理 btnUpdate_Click");
            }
            finally
            {
                page = new PageControl();
                LoadData();
                userContext();
                lblId.Text       = "";
                txtRemark.Text   = "";
                txtRoleName.Text = "";
                comboxState.Text = "";
            }
        }
 /// <summary>
 /// 删除选中行数据的方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tbtnDelDictionary()
 {
     try
     {
         string str    = "";
         string strdel = "";
         if (this.dgvDictioanry.SelectedRows.Count > 0)//选中删除
         {
             if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 //选中数量
                 int count = dgvDictioanry.SelectedRows.Count;
                 //string id = "";
                 //遍历
                 for (int i = 0; i < count; i++)
                 {
                     int dictionary_id = int.Parse(this.dgvDictioanry.SelectedRows[i].Cells["Dictionary_ID"].Value.ToString());
                     Expression <Func <Dictionary, bool> > funuserinfo = n => n.Dictionary_ID == dictionary_id;
                     DataTable dt      = LinQBaseDao.Query("select Dictionary_Name,Dictionary_IsSystem from Dictionary where Dictionary_ID=" + dictionary_id).Tables[0];
                     string    strname = dt.Rows[0]["Dictionary_Name"].ToString();
                     if (Convert.ToBoolean(dt.Rows[0]["Dictionary_IsSystem"].ToString()))
                     {
                         str += strname + ",";
                         continue;
                     }
                     if (DictionaryDAL.DeleteToMany(funuserinfo))
                     {
                         strdel += strname + ",";
                         CommonalityEntity.WriteLogData("删除", "删除字典名称为:" + strname + " 的信息", CommonalityEntity.USERNAME);//添加日志
                     }
                 }
                 if (!string.IsNullOrEmpty(str))
                 {
                     str = "字典名称:" + str + "为系统数据,不能删除\r\n";
                 }
                 if (!string.IsNullOrEmpty(strdel))
                 {
                     strdel = "字典名称:" + strdel + "删除成功";
                 }
                 ShowToolTip(ToolTipIcon.Info, "提示", str + strdel, txtDictionary_Remark, this);
             }
         }
         else//没有选中
         {
             MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch
     {
         CommonalityEntity.WriteTextLog("字典管理 tbtnDelDictionary() 异常!+");
     }
     finally
     {
         LogInfoLoad("");
     }
 }
Beispiel #5
0
        private void btnEditPwd_Click(object sender, EventArgs e)
        {
            if (txtPwd1.Text.Trim().ToLower() != txtpwd2.Text.Trim().ToLower())
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "新密码不一致!", txtPwd1, this);
                txtPwd1.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txtpwd2.Text.Trim()))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "新密码不能为空", txtpwd2, this);
                txtOlePwd.Focus();
                return;
            }

            if (string.IsNullOrEmpty(txtOlePwd.Text.Trim()))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码不能为空", txtOlePwd, this);
                txtOlePwd.Focus();
                return;
            }

            if (LinQBaseDao.Query("select * from UserInfo where userid=" + CommonalityEntity.USERID + "").Tables[0].Rows.Count <= 0)
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "登录信息有误,请重新登录!", txtOlePwd, this);
                GC.Collect();
                Application.ExitThread();
                Application.Exit();
                Process.GetCurrentProcess().Kill();
                System.Environment.Exit(System.Environment.ExitCode);
                Application.ExitThread();
                return;
            }

            if ((LinQBaseDao.Query("select * from UserInfo where userid=" + CommonalityEntity.USERID + " and UserLoginId='" + CommonalityEntity.USERNAME + "' and UserLoginPwd='" + CommonalityEntity.EncryptDES(txtOlePwd.Text.Trim()) + "'").Tables[0].Rows.Count <= 0))
            {
                mf.ShowToolTip(ToolTipIcon.Info, "提示", "旧密码有误!", txtOlePwd, this);
                txtOlePwd.Focus();
                return;
            }

            Action <UserInfo> action = n =>
            {
                n.UserLoginPwd = CommonalityEntity.EncryptDES(txtpwd2.Text.Trim());
            };
            Expression <Func <UserInfo, bool> > funuser = n => n.UserId == CommonalityEntity.USERID;

            if (UserInfoDAL.Update(funuser, action) == true)//角色是否修改失败
            {
                MessageBox.Show("密码修改成功!");
                txtOlePwd.Text = "";
                txtPwd1.Text   = "";
                txtpwd2.Text   = "";
                CommonalityEntity.WriteLogData("修改", "用户" + CommonalityEntity.USERNAME + "修改密码", CommonalityEntity.USERNAME);//添加日志
            }
        }
        /// <summary>
        /// 删除选中行数据的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbtnDelICCardType()
        {
            try
            {
                int j = 0;
                if (this.dgvICCardType.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgvICCardType.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            int iccardtype_id = int.Parse(this.dgvICCardType.SelectedRows[i].Cells["ICCardType_ID"].Value.ToString());
                            Expression <Func <ICCardType, bool> > funuserinfo = n => n.ICCardType_ID == iccardtype_id;
                            string strContent = LinQBaseDao.Query("select ICCardType_Name from ICCardType where ICCardType_ID=" + iccardtype_id).Tables[0].Rows[0][0].ToString();

                            DataTable dt = LinQBaseDao.Query("select * from ICCard where ICCard_ICCardType_ID =" + iccardtype_id).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                MessageBox.Show(strContent + "存在关联信息不能删除!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                break;
                            }
                            if (ICCardTypeDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                                CommonalityEntity.WriteLogData("删除", "删除IC卡类型名称为:" + strContent + "的信息", CommonalityEntity.USERNAME);//添加操作日志
                            }
                        }
                        if (j == count)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("IC卡类型信息管理 tbtnDelICCardType() 异常!+");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        private void btn_Update_Click(object sender, EventArgs e)
        {
            try
            {
                if (TV_MenuInfo.SelectedNode.Tag.ToString() != null)
                {
                    int menuID = Convert.ToInt32(TV_MenuInfo.SelectedNode.Tag.ToString());
                    if (menuID <= 0)
                    {
                        MessageBox.Show("请先修改的节点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    //1.修改数据不会修改Menu_MenuType_ID

                    //修改MenuInfo信息
                    Action <MenuInfo> action = n =>
                    {
                        n.Menu_ControlType = cob_Menu_ControlType.SelectedValue.ToString();  //控件类型
                        if (cob_Menu_ControlType.SelectedText.ToString() == "一级菜单")
                        {
                            n.Menu_OtherID = 0;
                        }
                        n.Menu_ControlText = txt_Menu_ControlText.Text.Trim();
                        n.Menu_ControlName = txt_Menu_ControlName.Text.ToString();
                        n.Menu_FromName    = txt_Menu_FromName.Text.ToString();
                        n.Menu_FromText    = txt_Menu_FromText.Text;
                        n.Menu_Enabled     = radioButtons.Checked == true ? true : false;        //控件是否启用
                        n.Menu_Visible     = radioButton2.Checked == true ? true : false;        //控件是否是否可见
                    };
                    Expression <Func <MenuInfo, bool> > menuinfo = n => n.Menu_ID.ToString() == menuID.ToString();
                    if (MenuInfoDAL.Update(menuinfo, action) == true)//角色是否修改失败
                    {
                        MessageBox.Show("修改成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        clean(this);
                    }
                    else
                    {
                        MessageBox.Show(" 修改失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    string Log_Contents = String.Format("角色名称:{0}", Name);
                    CommonalityEntity.WriteLogData("修改", Log_Contents, CommonalityEntity.USERNAME);//添加日志}
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("菜单管理MenuInfoManager btnUpdate_Click");
            }
            finally
            {
                PageControl page = new PageControl();
                TV_MenuInfo.Nodes.Clear();
                InitMenu();
            }
        }
Beispiel #8
0
 /// <summary>
 /// 单击保存按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(txtWeighInfo_Name.Text.Trim()))
         {
             MessageBox.Show("请输入地磅房名称");
             return;
         }
         if (string.IsNullOrEmpty(cobWeighInfo_State.Text.Trim()))
         {
             MessageBox.Show("请选择启动状态");
             return;
         }
         if (txtRemark.Text.Trim().Length > 200)
         {
             MessageBox.Show("超过最大字符,限制200字内");
             return;
         }
         //查重
         DataSet ds = LinQBaseDao.Query("select COUNT(1) from WeighInfo where WeighInfo_Name='" + txtWeighInfo_Name.Text.Trim() + "'");
         if (Convert.ToInt32(ds.Tables[0].Rows[0][0]) > 0)
         {
             MessageBox.Show("该磅房名称已存在");
             return;
         }
         //进行新增操作
         WeighInfo info = new WeighInfo();
         info.WeighInfo_Name       = txtWeighInfo_Name.Text.Trim();
         info.WeighInfo_Phone      = txtWeighInfo_Phone.Text.Trim();
         info.WeighInfo_State      = cobWeighInfo_State.Text.Trim();
         info.WeighInfo_CreateTime = CommonalityEntity.GetServersTime();
         info.WeighInfo_Remark     = txtRemark.Text.Trim();
         if (WeighInfoDAL.InsertOneCamera(info))
         {
             MessageBox.Show("保存成功");
             CommonalityEntity.WriteLogData("新增", "新增过磅基础信息:" + txtWeighInfo_Name.Text.Trim(), CommonalityEntity.USERNAME);//添加操作日志
             Empty();
         }
         else
         {
             MessageBox.Show("保存失败");
         }
     }
     catch
     {
         Console.WriteLine("");
     }
     finally
     {
         LogInfoLoad("");
     }
 }
Beispiel #9
0
        /// <summary>
        /// 删除选中行数据的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbtnDelPosition()
        {
            try
            {
                int j = 0;
                if (dgvPositionList.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgvPositionList.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            int position_id = int.Parse(this.dgvPositionList.SelectedRows[i].Cells["Position_ID"].Value.ToString());
                            Expression <Func <Position, bool> > funuserinfo = n => n.Position_ID == position_id;
                            string strContent = LinQBaseDao.GetSingle("select Position_Name from Position where Position_ID=" + position_id).ToString();
                            if (PositionDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                                CommonalityEntity.WriteLogData("删除", "删除门岗名称为:" + strContent + " 的信息", common.USERNAME);//添加日志
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        else
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            //重新查询门岗值的最大值
                            countID = PositionDAL.MaxID("select MAX(Position_Value) from Position");
                            txtPosition_Value.Text = "0" + (countID + 1);
                        }
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                common.WriteTextLog("门岗管理 tbtnDelPosition()+");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
        /// <summary>
        /// 删除 选中行数据的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tbtnDelPosition()
        {
            try
            {
                int j = 0;
                if (dgvDrivewayList.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgvDrivewayList.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            //-----------------------------------------------------------------------------------------
                            int drid = int.Parse(this.dgvDrivewayList.SelectedRows[i].Cells["Driveway_ID"].Value.ToString());
                            Expression <Func <Driveway, bool> > funuserinfo = n => n.Driveway_ID == drid;
                            string strContent = LinQBaseDao.Query("Select (Position_Name+Driveway_Name) as DrivewayPosition from View_DrivewayPosition where Driveway_ID=" + drid).Tables[0].Rows[0][0].ToString();
                            if (DrivewayDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                                CommonalityEntity.WriteLogData("删除", "删除通道名称为:" + strContent + " 的信息", common.USERNAME);//添加日志
                            }
                        }
                        if (j == count)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            //重新绑定通道值
                            tongdaoZ();
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("通道管理 tbtnDelPosition()+");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
        /// <summary>
        ///删除用户信息
        /// </summary>
        private void tbtnDelUser_delete()
        {
            try
            {
                int j = 0;
                UserIDSearch = lvwUserList.SelectedRows.Count;
                if (UserIDSearch > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        //遍历
                        for (int i = 0; i < UserIDSearch; i++)
                        {
                            Expression <Func <RoleInfo, bool> > funuserinfo = n => n.Role_Id == Convert.ToInt32(lvwUserList.SelectedRows[i].Cells["Role_Id"].Value);;

                            if (!RoleInfoAdd.DeleteToMany(funuserinfo))
                            {
                                j++;
                            }
                            else
                            {
                                CommonalityEntity.WriteLogData("删除", "删除角色名称为:" + lvwUserList.SelectedRows[i].Cells["Role_Name"].Value + "的信息", CommonalityEntity.USERNAME);
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("用户管理 tbtnDelUser_delete()+");
            }
            finally
            {
                page = new PageControl();
                //page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();//更新
            }
        }
Beispiel #12
0
        /// <summary>
        /// 删除按钮双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_delete_Click(object sender, EventArgs e)
        {
            try
            {
                string strmessagebox = "";
                string strlog        = "";
                if (btn_delete.Enabled)
                {
                    btn_delete.Enabled = false;
                }

                if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (JudgeCarTypeUseMethod())//判断要删除的管控信息是否正在使用
                    {
                        Expression <Func <ControlInfo, bool> > fun = n => list.Contains(common.GetInt(n.ControlInfo_ID));
                        if (ControlInfoDAL.DeleteToMany(fun))
                        {
                            strmessagebox = "成功删除管控信息";
                            list.Clear();
                            strlog = String.Format("删除管控信息:{0}", strControlInfo_Name);
                            CommonalityEntity.WriteLogData("删除", strlog, CommonalityEntity.USERNAME);
                        }
                        else
                        {
                            strmessagebox = "删除管控信息失败";
                        }
                    }
                    else
                    {
                        strmessagebox = "该管控信息正在使用不能删除";
                    }
                }

                if (strmessagebox != "")
                {
                    MessageBox.Show(strmessagebox, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("ControlInfoForm.btn_delete_Click()");
            }
            finally
            {
                btn_delete.Enabled = true;

                InitMenu();//更新
            }
        }
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (NullHandleMethod())
                {
                    OthCarAttribute("", cbxCarAttribute.Text.Trim());
                    ssy = 0;
                    CarType ct = new CarType();
                    ct.CarType_UserId            = CommonalityEntity.GetInt(CommonalityEntity.USERID);
                    ct.CarType_Name              = txt_CarTypeNmae.Text.Trim();
                    ct.CarType_Content           = txt_CarTypeContent.Text.Trim();
                    ct.CarType_State             = cob_CarTypeState.Text.Trim();
                    ct.CarType_Property          = cbxCarAttribute.Text.Trim();
                    ct.CarType_Remark            = txt_CarTypeRemarks.Text.Trim();
                    ct.CarType_Validity          = cob_CarTypeEffective.Text.Trim();
                    ct.CarType_ValidityTemporary = cob_CarTypeTemporary.Text.Trim();
                    ct.CarType_OtherProperty     = butname.Trim();
                    if (!string.IsNullOrEmpty(txtInOutTime.Text.Trim()))
                    {
                        ct.CarType_InOutTime = CommonalityEntity.GetInt(txtInOutTime.Text.Trim());
                    }

                    if (!string.IsNullOrEmpty(txt_CarTemporaryValue.Text.Trim()))
                    {
                        ct.CarType_ValidityValue = CommonalityEntity.GetInt(txt_CarTemporaryValue.Text.Trim());
                    }
                    ct.CarType_Value     = txt_CarTypeValue.Text.Trim();
                    ct.CarType_CreatTime = CommonalityEntity.GetServersTime();
                    ct.CarType_UserId    = CommonalityEntity.USERID;
                    ct.CarType_DriSName  = cmbDriSta.Text;
                    ct.CarType_BusType   = txtBusType.Text.Trim();
                    if ((CarTypeDAL.InsertOneQCRecord(ct)))
                    {
                        btn_Empty_Click(btn_Empty, null);                                                                          //调用清空按钮事件
                        CommonalityEntity.WriteLogData("新增", "新增车辆类型:" + txt_CarTypeNmae.Text.Trim(), CommonalityEntity.USERNAME); //添加操作日志
                        MessageBox.Show(this, "添加成功");
                    }
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("CarTypeForm.JudgeCarTypeUseMethod()");
                MessageBox.Show(this, "添加失败");
            }
            finally
            {
                BingMethod();
            }
        }
        int LowerID; // 定义一个下级编号的变量
        /// <summary>
        /// “保存” 按钮的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtCarAttribute_Name.Text == "")
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "车辆属性名称不能为空!", txtCarAttribute_Name, this);
                    return;
                }
                if (this.comboxCarAttribute_HeightID.Text != "")
                {
                    LowerID = int.Parse(this.comboxCarAttribute_HeightID.SelectedValue.ToString());
                }
                else
                {
                    LowerID = 0;
                }
                if (!btnCheck())
                {
                    return;              // 去重复
                }
                var CarAttributeadd = new CarAttribute
                {
                    CarAttribute_Name     = this.txtCarAttribute_Name.Text.Trim(),
                    CarAttribute_State    = this.cbxCarAttribute_State.Text,
                    CarAttribute_HeightID = LowerID
                };

                if (CarAttributeDAL.InsertOneCarAttribute(CarAttributeadd))
                {
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                string strContent1 = "车辆属性名称为:" + this.txtCarAttribute_Name.Text.Trim();;
                CommonalityEntity.WriteLogData("添加", strContent1, CommonalityEntity.USERNAME);//添加操作日志
            }
            catch
            {
                CommonalityEntity.WriteTextLog("车辆属性管理 btnSave_Click()");
            }
            finally
            {
                LogInfoLoad("");
                BindHeightIDAttribute();
                Empty(); // 调用清空的方法
            }
        }
        /// <summary>
        ///删除选中数据信息的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tslDelCarAttribute()
        {
            try
            {
                int j = 0;
                if (dgvCarAttribute.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgvCarAttribute.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <CarAttribute, bool> > funuserinfo = n => n.CarAttribute_ID == int.Parse(this.dgvCarAttribute.SelectedRows[i].Cells["CarAttribute_ID"].Value.ToString());

                            if (!CarAttributeDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                            }
                        }
                        if (j == 0)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            BindHeightIDAttribute(); // 刷新绑定上级编号
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        string strContent = "车辆属性编号为:" + this.dgvCarAttribute.SelectedRows[0].Cells["CarAttribute_ID"].Value.ToString();
                        CommonalityEntity.WriteLogData("删除", strContent, CommonalityEntity.USERNAME);//添加操作日志
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("车辆属性管理 tslDelCarAttribute()+");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
 /// <summary>
 ///删除选中数据信息的方法
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tslDelCamera()
 {
     try
     {
         int j = 0;
         if (dgvCamera.SelectedRows.Count > 0)//选中删除
         {
             if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 //选中数量
                 int    count = dgvCamera.SelectedRows.Count;
                 string id    = "";
                 //遍历
                 for (int i = 0; i < count; i++)
                 {
                     int cameraid = int.Parse(this.dgvCamera.SelectedRows[i].Cells["Camera_ID"].Value.ToString());
                     Expression <Func <Camera, bool> > funuserinfo = n => n.Camera_ID == cameraid;
                     string strContent = LinQBaseDao.Query("select Camera_Name from Camera where Camera_ID=" + cameraid).Tables[0].Rows[0][0].ToString();
                     if (CameraDAL.DeleteToMany(funuserinfo))
                     {
                         j++;
                         CommonalityEntity.WriteLogData("删除", "删除摄像头名称为:" + strContent + "的信息", CommonalityEntity.USERNAME);//添加操作日志
                     }
                 }
                 if (j == count)
                 {
                     MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
         else//没有选中
         {
             MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch
     {
         CommonalityEntity.WriteTextLog("摄像头管理 tslDelCamera()+");
     }
     finally
     {
         LogInfoLoad("");
     }
 }
 /// <summary>
 /// 删除事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsbtnDel_Click()
 {
     try
     {
         int j = 0;
         if (gdvUnLoadCarMange.SelectedRows.Count > 0)//选中删除
         {
             if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 //选中数量
                 int    count = gdvUnLoadCarMange.SelectedRows.Count;
                 string id    = "";
                 //遍历
                 for (int i = 0; i < count; i++)
                 {
                     int busid = int.Parse(this.gdvUnLoadCarMange.SelectedRows[i].Cells["BusinessRecord_ID"].Value.ToString());
                     Expression <Func <BusinessRecord, bool> > funuserinfo = n => n.BusinessRecord_ID == busid;
                     string strContent = LinQBaseDao.GetSingle("select smallTicket_Serialnumber from View_BusinessRecord_CarInfo where BusinessRecord_ID=" + busid).ToString();
                     if (BusinessRecordDAL.DeleteToMany(funuserinfo))
                     {
                         j++;
                         CommonalityEntity.WriteLogData("删除", "删除车牌号为:" + strContent + ",流水号为:" + strContent + "的过磅信息", CommonalityEntity.USERNAME);//添加操作日志
                     }
                 }
                 if (j == count)
                 {
                     MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
         }
         else//没有选中
         {
             MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch
     {
         CommonalityEntity.WriteTextLog("卸货点管理 tsbtnDel_Click()+" + "".ToString());
     }
     finally
     {
         LogInfoLoad("");
     }
 }
        private void btnAdd_Click()
        {
            try
            {
                if (cmbUserState.SelectedItem == null)
                {
                    MessageBox.Show("请选择状态!");
                    return;
                }
                int j    = 0;
                int rint = 0;
                if (!btnCheck())
                {
                    return;
                }
                var useradd = new UserInfo
                {
                    UserLoginId    = txtUserLoginID.Text.Trim(),                            //登陆ID
                    UserLoginPwd   = CommonalityEntity.EncryptDES(txtPassword.Text.Trim()), //登陆密码 加密
                    UserName       = txtName.Text.Trim(),                                   //姓名
                    UserPhone      = txtPhone.Text.Trim(),                                  //电话
                    UserAddress    = txtAddress.Text.Trim(),                                //地址
                    UserCreateTime = DateTime.Now,                                          //创建时间
                    UserCreateName = CommonalityEntity.USERNAME,                            //创建人
                    UserRemark     = txtRemark.Text.Trim(),                                 //备注信息
                    UserSate       = cmbUserState.SelectedItem.ToString(),
                    UserRoleID     = Convert.ToInt32(cmbRoleUser.SelectedValue),
                };

                if (UserInfoDAL.InsertOneQCRecord(useradd, out rint))
                {
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                string Log_Content = String.Format("用户名称:{0} ", txtUserLoginID.Text.Trim());
                CommonalityEntity.WriteLogData("新增", "新增" + Log_Content + "的权限", CommonalityEntity.USERNAME);//添加日志
            }
            catch
            {
                CommonalityEntity.WriteTextLog("用户管理 btnAdd_Click()" + "".ToString());
                MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                page = new PageControl();
                //page.PageMaxCount = tscbxPageSize2.SelectedItem.ToString();
                LoadData();
            }
        }
        /// <summary>
        /// 删除选中数据信息的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tslDelBusinessType()
        {
            try
            {
                int j = 0;
                if (this.dgvBusinessType.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int    count = dgvBusinessType.SelectedRows.Count;
                        string id    = "";
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            Expression <Func <BusinessType, bool> > funuserinfo = n => n.BusinessType_ID == int.Parse(this.dgvBusinessType.SelectedRows[i].Cells["BusinessType_ID"].Value.ToString());

                            if (BusinessTypeDAL.DeleteToMany(funuserinfo))
                            {
                                j++;
                                string strContent = "业务类别编号为:" + this.dgvBusinessType.SelectedRows[0].Cells["BusinessType_ID"].Value.ToString();
                                CommonalityEntity.WriteLogData("删除", "删除 " + strContent + " 的信息", common.USERNAME);//添加日志
                            }
                        }
                    }
                    if (j != 0)
                    {
                        MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception err)
            {
                CommonalityEntity.WriteTextLog("业务类别管理 tslDelBusinessType()+");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
        /// <summary>
        /// 保存过磅信息
        /// </summary>
        /// <param name="carinoutid">车辆通行总记录ID</param>
        /// <param name="content">送货车辆EBELN(PO号)、成品车辆WTD_ID(委托单)、三废车辆VBELN(交货单号)</param>
        /// <param name="type">业务类型(进门地磅、出门地磅、装货第一次过磅、卸货第一次过磅、装货第二次过磅、卸货第二次过磅)</param>
        /// <param name="wie">过磅重量</param>
        private void save(string carinoutid, string content, string type, string wie)
        {
            BusinessRecord busin = new BusinessRecord();

            busin.BusinessRecord_CarInOutRecord_ID = Convert.ToInt32(carinoutid);
            busin.BusinessRecord_Content           = content;
            busin.BusinessRecord_State             = "启动";
            busin.BusinessRecord_Type         = type;
            busin.BusinessRecord_Weight       = Convert.ToDouble(wie);
            busin.BusinessRecord_WeightTime   = CommonalityEntity.GetServersTime();
            busin.BusinessRecord_WeightPerson = CommonalityEntity.USERNAME;
            if (LinQBaseDao.InsertOne <BusinessRecord>(new DCCarManagementDataContext(), busin))
            {
                CommonalityEntity.WriteLogData("新增", "记录IC卡(小票)号为:" + txtSerialnumber.Text.Trim() + "的" + type + "信息", CommonalityEntity.USERNAME);//添加操作日志
            }
        }
Beispiel #21
0
        /// <summary>
        /// 注销排队车辆
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCancellation_Click(object sender, EventArgs e)
        {
            if (this.lvwUserList.SelectedRows.Count <= 0)
            {
                MessageBox.Show("请选择要注销排队的车辆信息");
                return;
            }
            DialogResult dr = MessageBox.Show("是否注销" + this.lvwUserList.SelectedRows[0].Cells["QueueCarNumber"].Value.ToString(), "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.OK)
            {
                //得到排队信息表编号,修改排队状态
                LinQBaseDao.Query("update SortNumberInfo set SortNumberInfo_TongXing='已注销' where SortNumberInfo_ID=" + this.lvwUserList.SelectedRows[0].Cells["sortNumberInfo_ID"].Value.ToString());
                CommonalityEntity.WriteLogData("修改", "注销了排队车辆:" + this.lvwUserList.SelectedRows[0].Cells["QueueCarNumber"].Value.ToString(), CommonalityEntity.USERNAME);//添加操作日志
            }
        }
Beispiel #22
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.lvwUserList.SelectedRows.Count <= 0)
         {
             MessageBox.Show("请选择要删除的项!");
             return;
         }
         if (this.lvwUserList.SelectedRows[0].Cells["PositionSMS_ID"].Value.ToString() == "")
         {
             MessageBox.Show("请选择要删除的项!");
             return;
         }
         if (this.lvwUserList.SelectedRows[0].Cells["PositionSMS_State"].Value.ToString() == "启动")
         {
             MessageBox.Show("启用状态的打印设置不能删除!");
             return;
         }
         DialogResult dlgResult = MessageBox.Show("确定删除选中的数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (dlgResult == DialogResult.Cancel)
         {
             return;
         }
         //删除条件
         int smsid = int.Parse(this.lvwUserList.SelectedRows[0].Cells["PositionSMS_ID"].Value.ToString());
         Expression <Func <PositionSMS, bool> > fun = n => n.PositionSMS_ID == smsid;
         if (PositionSMSDAL.DeletePositionSMS(fun))
         {
             MessageBox.Show("删除成功");
             CommonalityEntity.WriteLogData("删除", "删除短信编号为: " + smsid + "的信息", CommonalityEntity.USERNAME);//添加操作日志
         }
         else
         {
             MessageBox.Show("删除失败!");
         }
     }
     catch
     {
         CommonalityEntity.WriteTextLog("SMSSetForm btnDelete_Click()" + "");
     }
     finally
     {
         GetGriddataviewLoad("");//加载
         Cler();
     }
 }
        /// <summary>
        /// “保存” 按钮的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtBusinessType_Name.Text == "")
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "业务类别名称不能为空!", txtBusinessType_Name, this);
                    return;
                }
                if (!btnCheck())
                {
                    return;              // 去重复
                }
                var BusinessTypeadd = new BusinessType
                {
                    BusinessType_UserId     = int.Parse(common.USERID),
                    BusinessType_Name       = this.txtBusinessType_Name.Text.Trim(),
                    BusinessType_Content    = this.txtBusinessType_Content.Text.Trim(),
                    BusinessType_CreatTime  = Convert.ToDateTime(CommonalityEntity.GetServersTime().ToString()),
                    BusinessType_Remark     = this.txtBusinessType_Remark.Text.Trim(),
                    BusinessType_Use        = this.txtBusinessType_Use.Text.Trim(),
                    BusinessType_State      = this.cbxBusinessType_State.Text,
                    BusinessType_Loaded     = this.cbxBusinessType_Loaded.Text,
                    BusinessType_CarType_ID = Convert.ToInt32(cmbCarType.SelectedValue.ToString())
                };

                if (BusinessTypeDAL.InsertOneBusinessType(BusinessTypeadd))
                {
                    string strContent1 = "业务类别名称为:" + this.txtBusinessType_Name.Text.Trim();;
                    CommonalityEntity.WriteLogData("新增", "新增 " + strContent1 + " 的信息", common.USERNAME);//添加日志
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("业务类别管理 btnAdd_Click()");
            }
            finally
            {
                LogInfoLoad("");
                Empty(); // 调用清空的方法
            }
        }
        /// <summary>
        /// 删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsbtnDel_Click()
        {
            try
            {
                int j = 0;
                if (lvwUserList.SelectedRows.Count > 0)//选中删除
                {
                    if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        //选中数量
                        int count = lvwUserList.SelectedRows.Count;
                        //遍历
                        for (int i = 0; i < count; i++)
                        {
                            int CarInOutInfoRecord_ID = int.Parse(this.lvwUserList.SelectedRows[i].Cells["CarInOutInfoRecord_ID"].Value.ToString());

                            Expression <Func <CarInOutInfoRecord, bool> > cirFN = n => n.CarInOutInfoRecord_ID == CarInOutInfoRecord_ID;
                            if (CarInOutInfoRecordDAL.DeleteToMany(cirFN))
                            {
                                j++;
                                CommonalityEntity.WriteLogData("删除", "删除通行详细记录编号为:" + CarInOutInfoRecord_ID + " 的通行详细记录", CommonalityEntity.USERNAME);//添加操作日志
                            }
                        }
                        if (j == count)
                        {
                            MessageBox.Show("成功删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("删除失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else//没有选中
                {
                    MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("车辆进出厂统计 tsbtnDel_Click()+");
            }
            finally
            {
                BingMethod();
            }
        }
        /// <summary>
        /// 车辆授权
        /// </summary>
        /// <param name="strID"></param>
        /// <param name="carName"></param>
        private void saveAuthorization(string strID, string carName)
        {
            Expression <Func <BusinessRecord, bool> > p = n => n.BusinessRecord_CarInOutRecord_ID == int.Parse(strID) && n.BusinessRecord_Type == CommonalityEntity.outWeight;
            Action <BusinessRecord> ap = s =>
            {
                s.BusinessRecord_UnloadEmpowerPerson = CommonalityEntity.USERNAME;
                s.BusinessRecord_UnloadEmpowerTime   = CommonalityEntity.GetServersTime();
                s.BusinessRecord_PrintinvoiceTime    = CommonalityEntity.GetServersTime();
                s.BusinessRecord_UnloadEmpower       = 1;
                s.BusinessRecord_Remark = txtRemark.Text.ToString().Trim();
            };

            BusinessRecordDAL.Update(p, ap);
            LinQBaseDao.Query("update CarInOutRecord set CarInOutRecord_OutCheck='是',CarInOutRecord_OutCheckUser='******',CarInOutRecord_OutCheckTime='" + CommonalityEntity.GetServersTime() + "' where CarInOutRecord_ID =" + strID);
            CommonalityEntity.WriteLogData("地磅房授权", "地磅房:车辆" + carName + "出门授权", CommonalityEntity.USERNAME);//添加操作日志
            MessageBox.Show("授权成功");
        }
Beispiel #26
0
        /// <summary>
        /// “保 存” 按钮的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtCustomerInfo_Name.Text == "")
                {
                    PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "公司名称不能为空!", txtCustomerInfo_Name, this);
                    return;
                }
                if (!btnCheck())
                {
                    return;              // 去重复
                }
                var CustomerInfoadd = new CustomerInfo
                {
                    CustomerInfo_Name    = this.txtCustomerInfo_Name.Text.Trim(),
                    CustomerInfo_State   = this.comboxCustomerInfo_State.Text.Trim(),
                    CustomerInfo_Type    = this.txtCustomerInfo_Type.Text.Trim(),
                    CustomerInfo_Email   = this.txtCustomerInfo_Email.Text.Trim(),
                    CustomerInfo_Contact = this.txtCustomerInfo_Contact.Text.Trim(),
                    CustomerInfo_ADD     = this.txtCustomerInfo_ADD.Text.Trim(),
                    CustomerInfo_Remark  = this.txtCustomerInfo_Remark.Text.Trim()
                };

                if (CustomerInfoDAL.InsertOneQCRecord(CustomerInfoadd))
                {
                    MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    string strContent1 = "公司名称为:" + this.txtCustomerInfo_Name.Text.Trim();
                    CommonalityEntity.WriteLogData("新增", "新增 " + strContent1 + " 的信息", CommonalityEntity.USERNAME);//添加日志
                }
                else
                {
                    MessageBox.Show("添加失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch
            {
                CommonalityEntity.WriteTextLog("公司信息管理 btnSave_Click()");
            }
            finally
            {
                LogInfoLoad("");
            }
        }
Beispiel #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSet_Click(object sender, EventArgs e)
 {
     try
     {
         string     Sql = "select max(Dictionary_Value),MAX(Dictionary_Sort) from Dictionary where Dictionary_OtherID=(select Dictionary_ID from Dictionary where Dictionary_Value='09')";
         DataSet    ds  = LinQBaseDao.Query(Sql);
         string     Dictionary_Value = ds.Tables[0].Rows[0][0].ToString();
         string     Dictionary_Sort  = ds.Tables[0].Rows[0][1].ToString();
         Dictionary dic = new Dictionary();
         dic.Dictionary_Value        = (Convert.ToInt32("0" + Dictionary_Value) + 1).ToString();
         dic.Dictionary_Sort         = Convert.ToInt32(Dictionary_Sort) + 1;
         dic.Dictionary_Name         = txtBackContext.Text;
         dic.Dictionary_OtherID      = 15;
         dic.Dictionary_State        = true;
         dic.Dictionary_Remark       = null;
         dic.Dictionary_ISLower      = false;
         dic.Dictionary_IsSystem     = false;
         dic.Dictionary_Spare_int1   = Convert.ToInt32(txtDictionary_Spare_int1.Text.Trim());
         dic.Dictionary_Spare_int2   = Convert.ToInt32(txtDictionary_Spare_int2.Text.Trim());
         dic.Dictionary_Spare_vchar1 = null;
         dic.Dictionary_Spare_vchar2 = null;
         if (DictionaryDAL.InsertOneDictionary(dic))
         {
             MessageBox.Show("新增成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             treeViewPositionlist(tv_BackList.Nodes, "0");
             Dictionary_Cler();
             button4.Enabled = false;
             button1.Enabled = false;
         }
         else
         {
             MessageBox.Show("新增失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch
     {
     }
     finally
     {
         string strContent1 = "新增黑名单状态为: " + this.txtBackContext.Text.Trim();
         CommonalityEntity.WriteLogData("添加", strContent1, CommonalityEntity.USERNAME);//添加操作日志
     }
 }
 /// <summary>
 /// 门岗 --> “保 存” 事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     StrIsNullOrEmpty();                                  // 调用判断系统初始化设置的各个文本框值是否为空的方法
     Save();                                              // 调用保存系统初始化设置的方法
     common.WriteLogData("修改", "初始化设置", common.USERNAME); //操作日志
     try
     {
         if (MessageBox.Show("是否退出系统重新读取配置信息?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK)
         {
             System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
             Application.Restart();
         }
         CommonalityEntity.WriteLogData("修改", "初始化设置", common.NAME); //操作日志
     }
     catch
     {
         Process.GetCurrentProcess().Kill();
     }
 }
        /// <summary>
        /// 记录车辆通行详细
        /// </summary>
        /// <param name="CarInOutRecord_ID">车辆通行编号</param>
        /// <param name="DrivewayStrategy_ID">通行策略编号</param>
        /// <param name="Remark">车辆通行详细备注</param>
        /// <param name="Abnormal">是否通行异常</param>
        /// <param name="DrivewayID">当前通道编号</param>
        /// <param name="DrivewayStrategy_Sort">通行策略顺序号</param>
        private void SaveCarInOutInfoRecord(int carinoutrecord_id, int drivewaystrategy_id, string state, string remark, string abnor, int drivewayid, int drivewaystrategy_sort)
        {
            CarInOutInfoRecord carinout = new CarInOutInfoRecord();

            carinout.CarInOutInfoRecord_CarInOutRecord_ID   = carinoutrecord_id;
            carinout.CarInOutInfoRecord_DrivewayStrategy_ID = drivewaystrategy_id;
            carinout.CarInOutInfoRecord_State      = state;
            carinout.CarInOutInfoRecord_Remark     = remark;
            carinout.CarInOutInfoRecord_Abnormal   = abnor;
            carinout.CarInOutInfoRecord_DrivewayID = drivewayid;
            //carinout.CarInOutInfoRecord_DrivewayStrategy_Sort = drivewaystrategy_sort;
            carinout.CarInOutInfoRecord_Time = CommonalityEntity.GetServersTime();
            if (LinQBaseDao.InsertOne <CarInOutInfoRecord>(new DCCarManagementDataContext(), carinout))
            {
                string carinfoid   = LinQBaseDao.Query("select CarInOutRecord_CarInfo_ID from CarInOutRecord where CarInOutRecord_ID =" + carinoutrecord_id + "").Tables[0].Rows[0][0].ToString();
                string carinfoname = LinQBaseDao.Query("select CarInfo_Name from CarInfo where CarInfo_ID =" + carinfoid + "").Tables[0].Rows[0][0].ToString();
                CommonalityEntity.WriteLogData("新增", "记录车牌号为:" + carinfoname + "的车辆通行信息", CommonalityEntity.USERNAME);//添加操作日志
            }
        }
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.lvwUserList.SelectedRows.Count <= 0)
         {
             MessageBox.Show("请选择要删除的项!");
             return;
         }
         if (this.lvwUserList.SelectedRows[0].Cells["PositionVoice_ID"].Value.ToString() == "")
         {
             MessageBox.Show("请选择要删除的项!");
             return;
         }
         if (this.lvwUserList.SelectedRows[0].Cells["PositionVoice_State"].Value.ToString() == "启动")
         {
             MessageBox.Show("启用状态的打印设置不能删除!");
             return;
         }
         DialogResult dlgResult = MessageBox.Show("确定删除选中的数据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (dlgResult == DialogResult.Cancel)
         {
             return;
         }
         //删除条件
         int ii = int.Parse(this.lvwUserList.SelectedRows[0].Cells["PositionVoice_ID"].Value.ToString());
         Expression <Func <PositionVoice, bool> > fun = n => n.PositionVoice_ID == ii;
         PositionVoiceDAL.DeletePositionVoice(fun);
         CommonalityEntity.WriteLogData("删除", "删除编号为" + ii + "的语音呼叫信息", CommonalityEntity.USERNAME);//添加操作日志
         MessageBox.Show("删除成功!");
     }
     catch
     {
         CommonalityEntity.WriteTextLog("VoiceSetForm btnDelete_Click()" + "");
     }
     finally
     {
         btnSelect_Click(sender, e);
         //GetGriddataviewLoad("");//加载
     }
 }