/// <summary> /// 查重方法 /// </summary> /// <returns></returns> private bool btnCheck() { bool rbool = true; bool isdic = false; try { string Name = this.txtDictionary_Name.Text.ToString(); string Value = this.txtDictionary_Value.Text; //判断名称是否已存在 Expression <Func <Dictionary, bool> > funDictionary = n => n.Dictionary_Name == Name; IEnumerable <Dictionary> dict = DictionaryDAL.Query(funDictionary); if (dict.Count() > 0) { isdic = false; foreach (var item in dict) { if (item.Dictionary_ID == dictionaryID) { isdic = true; break; } } if (!isdic) { MessageBox.Show("该字典名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtDictionary_Name.Focus(); return(rbool = false); } } Expression <Func <Dictionary, bool> > funDictionary1 = n => n.Dictionary_Value == Value; IEnumerable <Dictionary> diction = DictionaryDAL.Query(funDictionary1); if (diction.Count() > 0) { isdic = false; foreach (var item in diction) { if (item.Dictionary_ID == dictionaryID) { isdic = true; break; } } if (!isdic) { MessageBox.Show("该字典值已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtDictionary_Value.Focus(); return(rbool = false); } } return(rbool); } catch { CommonalityEntity.WriteTextLog("字典管理 btnCheck()"); rbool = false; } return(rbool); }
private void CarState_Load(object sender, EventArgs e) { txtSQBeginTime.Value = CommonalityEntity.GetServersTime(); txtSQEndTime.Value = CommonalityEntity.GetServersTime(); cmbType.SelectedIndex = 0; tscbxPageSize.SelectedIndex = 2; userContext(); }
/// <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="operateContent">操作内容</param> public static void AddUpdateLog(string operateContent) { string operateUser = common.NAME; string operateTime = CommonalityEntity.GetServersTime().ToString(); string operateIP = ""; string sqlLog = string.Format("insert into eh_Operate(Operate_Content,Operate_User,Operate_Time,Operate_IP) values('{0}','{1}','{2}','{3}')", operateContent, operateUser, operateTime, operateIP); LinQBaseDao.ExecuteSql(sqlLog); }
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 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(""); } }
/// <summary> /// 获取图片的存放位置 /// </summary> /// <param name="strfileName">存放图片文件路径</param> /// <param name="strPosition">门岗序号</param> /// <param name="strDriveway">通道序号</param> /// <param name="ilChannel">摄像机序号</param> /// <returns>图片存储路径和图片名称图片格式</returns> public static string GetPicFileName(string strfileName, string strPosition, string strDriveway, Int32 ilChannel) { StringBuilder sb = new StringBuilder(); string sPicFileName = CommonalityEntity.GetServersTime().ToString("yyMMddHHmmss") + strPosition + strDriveway + ilChannel.ToString();//图片名称 sb.Append(strfileName + "\\"); sb.Append(sPicFileName); sb.Append(".jpg"); return(sb.ToString()); }
/// <summary> /// 打印预览及打印模版 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLEDShow_Click(object sender, EventArgs e) { //获取选择的打印设置行,得到选择的打印的预览信息 try { if (this.lvwUserList.SelectedRows.Count <= 0) { MessageBox.Show("请选择要预览的设置!"); return; } if (this.lvwUserList.SelectedRows[0].Cells["Print_ID"].Value.ToString() == "") { MessageBox.Show("请选择要预览的设置!"); return; } else { CommonalityEntity.Car_Type_ID = this.lvwUserList.SelectedRows[0].Cells["Print_CarType_Id"].Value.ToString(); string sql = "select * from PrintInfo where Print_ID='" + this.lvwUserList.SelectedRows[0].Cells["Print_ID"].Value.ToString() + "'"; PrintInfo pInfo = PrintInfoDAL.GetPrint(sql); DataSet dataset = new DataSet(); string sqlContent = "Select top 1 "; if (pInfo.Print_Content != "") { string[] str = pInfo.Print_Content.Split(','); foreach (var item in str) { sqlContent += item + ","; } sqlContent = sqlContent.Substring(0, sqlContent.Length - 1); } string strsqlContent = sqlContent + " from View_LEDShow_zj where CarType_ID=" + CommonalityEntity.Car_Type_ID; dataset = LinQBaseDao.Query(strsqlContent); if (dataset.Tables[0].Rows.Count > 0) { CommonalityEntity.Serialnumber = dataset.Tables[0].Rows[0]["小票号"].ToString(); PrintInfoForm pi = new PrintInfoForm(dataset); pi.Show(); } else { strsqlContent = sqlContent + " from View_LEDShow_zj"; dataset = LinQBaseDao.Query(strsqlContent); CommonalityEntity.Serialnumber = "130808000001"; PrintInfoForm pi = new PrintInfoForm(dataset); pi.Show(); } } } catch { CommonalityEntity.WriteTextLog("PrintSetForm btnLEDShow_Click()");//记录异常日志 } }
/// <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(""); } }
private void lvwUserList_DoubleClick(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; } else { isUpdate = true; string sql = "select * from PositionVoice where PositionVoice_ID='" + this.lvwUserList.SelectedRows[0].Cells["PositionVoice_ID"].Value.ToString() + "'"; PositionVoice pv = PositionVoiceDAL.GetVoice(sql); txtPositionVoice_Count.Text = pv.PositionVoice_Count.ToString(); txtPositionVoice_Remark.Text = pv.PositionVoice_Remark.ToString(); cmbtxtPositionVoice_Type.Text = pv.PositionVoice_PassageState; chkPositionVoice_Position_Id.SelectedValue = int.Parse(pv.PositionVoice_Position_ID.ToString()); combokPositionVoice_State.Text = pv.PositionVoice_State.ToString(); string[] content = pv.PositionVoice_Content.Split(','); chkCarNumber.Checked = false; chkSerialnumber.Checked = false; chkCarType.Checked = false; foreach (var item in content) { if (item == chkCarNumber.Text) { chkCarNumber.Checked = true; } if (item == chkSerialnumber.Text) { chkSerialnumber.Checked = true; } if (item == chkCarType.Text) { chkCarType.Checked = true; } } } btnAdd.Enabled = false; btnUpdate.Enabled = true; } catch { CommonalityEntity.WriteTextLog("VoiceSetForm lvwUserList_DoubleClick()" + "");//记录异常日志 } }
/// <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(); } }
/// <summary> /// 搜索的方法 /// </summary> private void GetLogInfoSeach() { try { sqlwhere = " 1=1"; string beginTime = this.txtbeginTime.Value.ToString(); string endTime = this.txtendTime.Value.ToString(); string name = this.txtLog_Name.Text.Trim(); string type = this.comboxType.Text.Trim(); if (!string.IsNullOrEmpty(type))//日志操作类型 { if (type == "全部") { sqlwhere = " 1=1"; } else { sqlwhere += String.Format(" and Dictionary_Name like '%{0}%'", type); } } if (!string.IsNullOrEmpty(name))//日志操作人名称 { sqlwhere += String.Format(" and Log_Name like '%{0}%'", name); } if (beginTime != "")//开始时间 { sqlwhere += String.Format(" and Log_Time >= '{0}'", beginTime); } if (endTime != "")//结束时间 { sqlwhere += String.Format(" and Log_Time <= '{0}'", endTime); } if (beginTime != "" && endTime != "") { if (CommonalityEntity.GetDateTime(beginTime) > CommonalityEntity.GetDateTime(endTime)) { MessageBox.Show("查询开始时间不能大于结束时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtbeginTime.Text = ""; txtendTime.Text = ""; return; } } } catch { CommonalityEntity.WriteTextLog("LogInfoForm.GetLogInfoSeach()异常:"); } finally { LogInfoLoad(""); } }
/// <summary> /// 显示列表绑定数据 /// </summary> private void BingMethod() { try { pc.BindBoundControl(dgv_Information, strClickedItemName, tstbPageCurrent, tslPageCount, tslNMax, tscbxPageSize, "View_DrivewayStrategyRecord_Driveway_Position_CarInfo", "*", "DrivewayStrategyRecord_ID", "DrivewayStrategyRecord_ID", 1, sqlwhere, true); } catch { CommonalityEntity.WriteTextLog("DrivewayStrategyRecordForm.BingMethod()" + "".ToString()); } }
/// <summary> /// 取消双击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Cancel_Click(object sender, EventArgs e) { try { panel2.Visible = false; } catch { CommonalityEntity.WriteTextLog("DrivewayStrategyRecordForm.btn_Cancel_Click()" + "".ToString()); } }
/// <summary> /// 显示列表绑定数据 /// </summary> private void BingMethod() { try { pc.BindBoundControl(lvwUserList, strClickedItemName, tstbPageCurrent, tslPageCount, tslNMax, tscbxPageSize, "View_carInOutSatistics", "*", "CarInOutInfoRecord_ID", "CarInOutInfoRecord_ID", 0, sqlwhere, true); } catch { CommonalityEntity.WriteTextLog("carInOutSatistics.BingMethod()"); } }
///搜索按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSerch_Click(object sender, EventArgs e) { try { sqlwhere = " ( BusinessRecord_Type = '" + CommonalityEntity.unloadFirstWeight + "' or BusinessRecord_Type = '" + CommonalityEntity.unloadSecondWeight + "' ) and CarInOutRecord_ID=BusinessRecord_CarInOutRecord_ID "; string type = this.cobCarType.Text.ToString(); string carNum = this.txtCarNum.Text.Trim(); string customerName = this.txtCustomerName.Text.Trim(); string businessRecord_Type = this.txtBusinessRecordType.Text.Trim(); string serialnumber = this.txtSerialnumber.Text.Trim(); string sort = this.txtSort.Text.Trim(); if (!string.IsNullOrEmpty(type)) { sqlwhere += String.Format(" and CarType_Name = '{0}' ", type); } if (!string.IsNullOrEmpty(carNum)) { sqlwhere += String.Format(" and CarInfo_Name like '%{0}%'", carNum); } if (!string.IsNullOrEmpty(customerName)) { sqlwhere += String.Format(" and CustomerInfo_Name like '%{0}%'", customerName); } if (!string.IsNullOrEmpty(businessRecord_Type)) { sqlwhere += String.Format(" and BusinessRecord_Type like '%{0}%'", businessRecord_Type); } if (!string.IsNullOrEmpty(serialnumber)) { sqlwhere += String.Format(" and SmallTicket_Serialnumber like '%{0}%'", serialnumber); } if (!string.IsNullOrEmpty(sort)) { sqlwhere += String.Format(" and SmallTicket_SortNumber like '%{0}%'", sort); } if (!string.IsNullOrEmpty(this.txtName.Text.Trim())) { sqlwhere += String.Format(" and StaffInfo_Name like '%{0}%'", this.txtName.Text.Trim()); } if (!string.IsNullOrEmpty(this.txtIndes.Text.Trim())) { sqlwhere += String.Format(" and StaffInfo_Identity like '%{0}%'", this.txtIndes.Text.Trim()); } } catch { CommonalityEntity.WriteTextLog("ICCardForm.btnSearch_Click异常:" + "".ToString()); } finally { LogInfoLoad(""); } }
/// <summary> /// 把地感状态置为:0 /// </summary> private void fvnState() { try { LinQBaseDao.Query("update DeviceControl set DeviceControl_FanSate=0 where DeviceControl_PositionValue='" + SystemClass.PosistionValue + "'"); } catch { CommonalityEntity.WriteTextLog("Login.fvnState"); } }
private void btnEditPwd_Click(object sender, EventArgs e) { try { if (txtPwd1.Text.Trim().ToLower() != txtpwd2.Text.Trim().ToLower()) { MessageBox.Show(this, "新密码不一致!"); return; } if (string.IsNullOrEmpty(txtpwd2.Text.Trim())) { MessageBox.Show(this, "新密码不能为空"); return; } if (string.IsNullOrEmpty(txtOlePwd.Text.Trim())) { MessageBox.Show(this, "旧密码不能为空"); return; } string controlpwd = txtpwd2.Text.Trim(); string oldpwd = ""; string filepath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\SystemSet.xml"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filepath); XmlNode xn = xmlDoc.SelectSingleNode("param");//查找<bookstore> XmlNodeList xnl = xn.ChildNodes; if (xnl.Count > 0) { foreach (XmlNode xnf in xnl) { XmlElement xe = (XmlElement)xnf; oldpwd = xe.GetAttribute("ControlPWD").ToString(); if (oldpwd == txtOlePwd.Text.Trim()) { xe.SetAttribute("ControlPWD", controlpwd);// } else { MessageBox.Show(this, "旧密码输入错误"); return; } } xmlDoc.Save(filepath); MessageBox.Show(this, "修改成功!"); } SystemClass.ControlPWD = controlpwd; } catch { CommonalityEntity.WriteTextLog("手动控制密码修改 btnEditPwd_Click()"); } }
/// <summary> /// 显示列表绑定数据 /// </summary> private void BingMethod() { try { pc.BindBoundControl(dgv_Information, strClickedItemName, tstbPageCurrent, tslPageCount, tslNMax, tscbxPageSize, "View_CarType_User", "*", "CarType_ID", "CarType_ID", 0, sqlwhere, true); CarTypeValueBind(); } catch { CommonalityEntity.WriteTextLog("CarTypeForm.BingMethod()"); } }
/// <summary> /// 菜单栏加载数据 /// </summary> private void LoadData() { try { this.dgvDictioanry.DataSource = null; LogInfoLoad(""); } catch { CommonalityEntity.WriteTextLog("DictionaryForm.LoadData():"); } }
private void carInOutSatistics_Load(object sender, EventArgs e) { userContext(); LoadCarType(); LoadPosition(); groupBox2.Visible = false; isload = true; txtBeginTime.Text = CommonalityEntity.GetServersTime().ToString(); txtEndTime.Text = CommonalityEntity.GetServersTime().AddDays(1).ToString(); tscbxPageSize.SelectedIndex = 3; isload = false; }
/// <summary> /// 菜单栏加载数据 /// </summary> private void LoadData() { try { this.dgvLogInfo.DataSource = null; LogInfoLoad(""); } catch { CommonalityEntity.WriteTextLog("日记管理 LoadData()"); } }
/// <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(""); } }
/// <summary> /// 菜单栏加载数据 /// </summary> private void LoadData() { try { this.lvwUserList.DataSource = null; LogInfoLoad(""); } catch { CommonalityEntity.WriteTextLog("用户管理 LoadData()"); } }
/// <summary> /// 条件搜索方法 /// </summary> private void SelectMethod(object obj) { try { Control.CheckForIllegalCrossThreadCalls = false; sqlwhere = " 1=1"; //车辆类型 if (cbxCarType.Text.Trim() != "") { sqlwhere += " and CarType_ID =" + cbxCarType.SelectedValue; } //进出类型 if (cbxInOutType.Text.Trim() != "") { sqlwhere += " and Driveway_Type ='" + cbxInOutType.Text + "'"; } //门岗 if (cbxPosion.Text.Trim() != "") { sqlwhere += " and Position_ID=" + cbxPosion.SelectedValue; } string BeginTime = Convert.ToDateTime(txtBeginTime.Value).ToString("yyyy-MM-dd"); string EndTime = Convert.ToDateTime(txtEndTime.Value).ToString("yyyy-MM-dd"); if (BeginTime != EndTime) { sqlwhere += " and CarInOutInfoRecord_Time between '" + BeginTime + "' and '" + EndTime + "'"; } if (txtStaffName.Text.Trim() != "") { sqlwhere += " and StaffInfo_Name like '%" + txtStaffName.Text.Trim() + "%'"; } if (txtCustomerInfo.Text.Trim() != "") { sqlwhere += " and CustomerInfo_Name like '%" + txtCustomerInfo.Text.Trim() + "%'"; } if (txtCarName.Text != "") { sqlwhere += " and CarInfo_Name like '%" + txtCarName.Text.Trim() + "%' "; } } catch { CommonalityEntity.WriteTextLog("carInOutSatistics.SelectMethod()"); } finally { BingMethod();//绑定数据 } }
/// <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> /// <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> private void LoadData() { try { this.dgvCarAttribute.AutoGenerateColumns = false;//设置只显示列表控件绑定的列 this.dgvCarAttribute.DataSource = null; LogInfoLoad(""); } catch { CommonalityEntity.WriteTextLog("日记管理 LoadData()"); } }
/// <summary> ///设置分页控件每页显示的最大条数事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tscbxPageSize_SelectedIndexChanged(object sender, EventArgs e) { try { pc = new PageControl(); pc.pageSize = CommonalityEntity.GetInt(tscbxPageSize.SelectedItem.ToString()); SelectMethod(); } catch { CommonalityEntity.WriteTextLog("CarTypeForm.tscbxPageSize_SelectedIndexChanged()"); } }
/// <summary> /// 菜单栏加载数据 /// </summary> private void LoadData() { try { this.lvwUserList.AutoGenerateColumns = false;//设置只显示列表控件绑定的列 this.lvwUserList.DataSource = null; LogInfoLoad(""); } catch { CommonalityEntity.WriteTextLog("用户管理 LoadData()"); } }