public ActionResult FindByTypeList(IEnumerable <string> dictype) { DictionaryDAL ddal = new DictionaryDAL(); var diclist = ddal.FindByParentList(dictype); return(Json(diclist, JsonRequestBehavior.AllowGet)); }
public ActionResult EditDictionary(string id) { DictionaryDAL ddal = new DictionaryDAL(); var dic = new DictionaryViewModel().CastModel(ddal.Get(id)); return(View(dic)); }
/// <summary> /// 状态绑定 /// </summary> private void StateMethos() { var p = DictionaryDAL.GetValueStateDictionary("01"); int intcount = p.Count(); if (p != null && p.Count() > 0) { cob_TypeState.DataSource = p; cob_TypeState.DisplayMember = "Dictionary_Name"; cob_TypeState.ValueMember = "Dictionary_Value"; cob_TypeState.SelectedIndex = intcount - 1; } var Pcob_CarTypeState = p.Where(n => n.Dictionary_Name != "全部").Select(n => n).ToList(); if (Pcob_CarTypeState != null && Pcob_CarTypeState.Count() > 0) { cob_CarTypeState.DataSource = Pcob_CarTypeState; cob_CarTypeState.DisplayMember = "Dictionary_Name"; cob_CarTypeState.ValueMember = "Dictionary_Value"; cob_CarTypeState.SelectedIndex = 0; } p = DictionaryDAL.GetValueStateDictionary("13"); intcount = p.Count(); var Pcob_CarTypeEffective = p.Where(n => n.Dictionary_Name != "全部").Select(n => n).ToList(); if (Pcob_CarTypeEffective != null && Pcob_CarTypeEffective.Count() > 0) { cob_CarTypeEffective.DataSource = Pcob_CarTypeEffective; cob_CarTypeEffective.DisplayMember = "Dictionary_Name"; cob_CarTypeEffective.ValueMember = "Dictionary_Value"; cob_CarTypeEffective.SelectedIndex = 0; } }
/// <summary> /// 状态绑定 /// </summary> private void StetaBingMethod() { try { var p = DictionaryDAL.GetValueStateDictionary("01"); int intcount = p.Count(); if (p != null && intcount > 0) { //cob_DrivewayStrategy_State1.DataSource = p; //this.cob_DrivewayStrategy_State1.DisplayMember = "Dictionary_Name"; //cob_DrivewayStrategy_State1.ValueMember = "Dictionary_Value"; //cob_DrivewayStrategy_State1.SelectedIndex = intcount - 1; } var Pcob_DrivewayStrategy_State = p.Where(n => n.Dictionary_Name != "全部").ToList(); if (Pcob_DrivewayStrategy_State != null && Pcob_DrivewayStrategy_State.Count() > 0) { txt_carState.DataSource = Pcob_DrivewayStrategy_State; this.txt_carState.DisplayMember = "Dictionary_Name"; txt_carState.ValueMember = "Dictionary_Value"; txt_carState.SelectedIndex = 0; } } catch { CommonalityEntity.WriteTextLog("DrivewayStrategyRecordForm.StetaBingMethod()" + "".ToString()); } }
/// <summary> /// 绑定(重量、水分)检测状态下拉列表框数据 /// </summary> private void BindCboxState() { List <EMEWEEntity.Dictionary> list = DictionaryDAL.GetValueStateDictionary("状态"); EMEWEEntity.Dictionary d = list[0]; list[0] = list[list.Count - 1]; list[list.Count - 1] = d; List <EMEWEEntity.Dictionary> list2 = list; cboxState.DataSource = list; this.cboxState.DisplayMember = "Dictionary_Name"; cboxState.ValueMember = "Dictionary_ID"; if (cboxState.DataSource != null) { cboxState.SelectedValue = 0; //cboxState.SelectedIndex = 0; } cboxState1.DataSource = list2; this.cboxState1.DisplayMember = "Dictionary_Name"; cboxState1.ValueMember = "Dictionary_ID"; if (cboxState1.DataSource != null) { cboxState1.SelectedValue = 0; //cboxState1.SelectedIndex = -1; } }
/// <summary> /// 绑定状态 /// </summary> public void PositionLED_StateLoad() { chkboxLEDState.DataSource = DictionaryDAL.GetValueStateDictionary("01").Where(n => n.Dictionary_Name != "全部").Select(n => n).ToList(); chkboxLEDState.ValueMember = "Dictionary_Value"; chkboxLEDState.DisplayMember = "Dictionary_Name"; }
/// <summary> /// 获取单条数据 /// </summary> /// <param name="predicate"></param> /// <returns></returns> public HrDictionary GetOne(Expression <Func <HR_DICTIONARY, bool> > predicate = null) { using (DictionaryDAL dal = new DictionaryDAL()) { return(EntityToModel(dal.GetOne(predicate))); } }
/// <summary> /// 绑定所属字典 /// </summary> private void BindDictionaryOther() { try { List <Dictionary> list = DictionaryDAL.GetStateDictionaryOther(); if (list.Count > 0) { this.comboxDictionary_OtherID.DataSource = list; this.comboxDictionary_OtherID.DisplayMember = "Dictionary_Name"; comboxDictionary_OtherID.ValueMember = "Dictionary_ID"; if (comboxDictionary_OtherID.SelectedValue == null) { comboxDictionary_OtherID.SelectedValue = -1; } } List <Dictionary> list1 = DictionaryDAL.GetStateDictionaryOther(); this.cbxDicname.DataSource = list1; this.cbxDicname.DisplayMember = "Dictionary_Name"; if (list1.Count > 0) { this.cbxDicname.ValueMember = "Dictionary_ID"; if (cbxDicname.SelectedValue == null) { cbxDicname.SelectedValue = -1; } cbxDicname.SelectedIndex = -1; } } catch { CommonalityEntity.WriteTextLog("DictionaryForm.BindDictionaryOther():"); return; } }
/// <summary> /// 状态绑定 /// </summary> private void StetaBingMethod() { try { var p = DictionaryDAL.GetValueStateDictionary("01"); int intcount = p.Count(); var Pcob_DrivewayStrategy_State = p.Where(n => n.Dictionary_Name != "全部").ToList(); if (Pcob_DrivewayStrategy_State != null && Pcob_DrivewayStrategy_State.Count() > 0) { cobWeighInfo_State.DataSource = Pcob_DrivewayStrategy_State; this.cobWeighInfo_State.DisplayMember = "Dictionary_Name"; cobWeighInfo_State.ValueMember = "Dictionary_ID"; cobWeighInfo_State.SelectedIndex = 0; cobseekSate.DataSource = Pcob_DrivewayStrategy_State; this.cobseekSate.DisplayMember = "Dictionary_Name"; cobseekSate.ValueMember = "Dictionary_ID"; cobseekSate.SelectedIndex = 0; } } catch { CommonalityEntity.WriteTextLog("DrivewayStrategyForm.StetaBingMethod()" + "".ToString()); } }
public IEnumerable <SelectListItem> GetDicList(string key, string parentkey) { DictionaryDAL dal = new DictionaryDAL(); var viewList = new List <SelectListItem>(); var list = dal.GetAll().Where(t => t.State).OrderBy(t => t.Desc); foreach (var vi in list) { if ((vi.ParentKey == key || vi.Key == key) && (key != null)) { continue; } SelectListItem se = new SelectListItem(); se.Text = vi.Text; se.Value = vi.Path; if (key == vi.Path) { se.Selected = true;; } viewList.Add(se); } viewList.Insert(0, new SelectListItem() { Text = "最高级", Value = string.Empty }); return(viewList); }
public ActionResult FindByType(string dictype) { DictionaryDAL ddal = new DictionaryDAL(); var modellist = ddal.FindByParentKey(dictype); return(Json(modellist.ToString(), JsonRequestBehavior.AllowGet)); }
/// <summary> /// 验证客户端是否存在 /// </summary> /// <returns></returns> private bool ISClient() { bool rbool = false; try { if (Common.CLIENTID > 0) { ClientInfo client = ClientDAL.GetClientInfo(Common.CLIENTID); if (client != null) { int idictionaryId = DictionaryDAL.GetDictionaryID("启动"); if (client.Client_Dictionary_ID == idictionaryId) { Common.CLIENT_NAME = client.Client_NAME; rbool = true; } } } } catch (Exception ex) { Common.WriteTextLog("验证客户端是否存在Login.ISClient异常:" + ex.Message); } return(rbool); }
/// <summary> /// 保存字典信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { bool rbool = true; StringBuilder sbMessage = new StringBuilder(); InputCheck(); // 字典值不能为空 Dictionary dic = new Dictionary(); dic.Dictionary_Name = txtDictionary_Name.Text.Trim(); dic.Dictionary_Value = txtDictionary_Value.Text.Trim(); // dic.Dictionary_OtherID = Converter.ToInt(cbxDictionary_OtherID.Text.Trim(), 0); dic.Dictionary_OtherID = int.Parse(this.cbxDictionary_OtherID.SelectedValue.ToString()); if (cbxDictionary_State.Text.Trim() == "启动") { dic.Dictionary_State = true; // Converter.ToInt(cbxDictionary_State.Text.Trim(),0); } if (cbxDictionary_State.Text.Trim() == "注销") { dic.Dictionary_State = false; } dic.Dictionary_Remark = txtDictionary_Remark.Text.Trim(); sbMessage.Append("保存"); //新增字典 rbool = DictionaryDAL.InsertOneDictionary(dic); #region 注释 //if (InputCheck()) //{ // Dictionary dic = new Dictionary(); // dic.Dictionary_Name = txtDictionary_Name.Text.Trim(); // dic.Dictionary_Value = txtDictionary_Value.Text.Trim(); // dic.Dictionary_OtherID = Converter.ToInt(cbxDictionary_OtherID.Text.Trim(), 0); // if (cbxDictionary_State.Text.Trim() == "启动") // { dic.Dictionary_State = true; }// Converter.ToInt(cbxDictionary_State.Text.Trim(),0); // if (cbxDictionary_State.Text.Trim() == "注销") // { dic.Dictionary_State = false; } // dic.Dictionary_Remark = txtDictionary_Remark.Text.Trim(); // if (dictionaryID != 0)//修改字典 // { // sbMessage.Append("修改"); // rbool = DictionaryDAL.Update(dic); // } // else // { // sbMessage.Append("新增"); //新增字典 // rbool = DictionaryDAL.Insert(dic); // } //} #endregion if (rbool) { MessageBox.Show( sbMessage.ToString() + "字典信息成功!", sbMessage.ToString() + "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { MessageBox.Show(sbMessage.ToString() + "字典信息信息失败!", sbMessage.ToString() + "失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <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); }
public ActionResult EditDictionary(DictionaryViewModel model) { DictionaryDAL ddal = new DictionaryDAL(); ddal.Update(model.CastDB(model)); ddal.AcceptAllChange(); return(Content("Success")); }
/// <summary> /// 获取数据列表 /// </summary> /// <param name="predicate"></param> /// <returns></returns> public IEnumerable <HrDictionary> GetList(Expression <Func <HR_DICTIONARY, bool> > predicate = null) { using (DictionaryDAL dal = new DictionaryDAL()) { var list = dal.Get(predicate); return(list.Select(EntityToModel).ToList()); } }
public CollateralAuditViewModel CastModel(CollateralAudit model) { var coll = new CollateralAuditViewModel(); var dicdal = new DictionaryDAL(); Com.HSJF.Infrastructure.ExtendTools.ObjectExtend.CopyTo(model, coll); coll.CollateralTypeText = dicdal.GetText(model.CollateralType); return(coll); }
public ActionResult DeleteDictionary(string id) { DictionaryDAL ddal = new DictionaryDAL(); var model = ddal.Get(id); ddal.Delete(model); ddal.AcceptAllChange(); return(Content("Success")); }
public HouseDetailViewModel CastModel(HouseDetail model) { var house = new HouseDetailViewModel(); var dicdal = new DictionaryDAL(); Com.HSJF.Infrastructure.ExtendTools.ObjectExtend.CopyTo(model, house); house.HouseTypeText = dicdal.GetText(model.HouseType); return(house); }
/// <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> private void bindState() { List <Dictionary> list = DictionaryDAL.GetValueStateDictionary("状态"); list.RemoveAt(list.Count - 1); list.RemoveAt(list.Count - 1); cbxState.DataSource = list; cbxState.DisplayMember = "Dictionary_Name"; cbxState.ValueMember = "Dictionary_ID"; }
/// <summary> /// 绑定质检状态的comboBox值 /// </summary> private void BindCheckState() { cbxQCInfoState.DataSource = DictionaryDAL.GetValueStateDictionary("质检状态"); this.cbxQCInfoState.DisplayMember = "Dictionary_Name"; cbxQCInfoState.ValueMember = "Dictionary_ID"; if (cbxQCInfoState.DataSource != null) { cbxQCInfoState.SelectedIndex = cbxQCInfoState.Items.Count - 1; } }
private void Beonduty_Dictionary_NameBing() { cob_Beonduty_Dictionary_Name.DataSource = DictionaryDAL.GetValueStateDictionary("状态"); this.cob_Beonduty_Dictionary_Name.DisplayMember = "Dictionary_Name"; cob_Beonduty_Dictionary_Name.ValueMember = "Dictionary_ID"; if (cob_Beonduty_Dictionary_Name.DataSource != null) { cob_Beonduty_Dictionary_Name.SelectedIndex = -1; } }
/// <summary> /// 绑定菜单状态 /// </summary> private void Menu_Dictionary_ID() { cob_Menu_Dictionary_ID.DataSource = DictionaryDAL.GetValueStateDictionary("状态"); cob_Menu_Dictionary_ID.DisplayMember = "Dictionary_Name"; cob_Menu_Dictionary_ID.ValueMember = "Dictionary_ID"; if (cob_Menu_Dictionary_ID.DataSource != null) { cob_Menu_Dictionary_ID.SelectedIndex = -1; } }
/// <summary> /// 绑定菜单状态 /// </summary> private void DictionaryDataBind() { cbDictionary.DataSource = DictionaryDAL.GetValueStateDictionary("状态"); cbDictionary.DisplayMember = "Dictionary_Name"; cbDictionary.ValueMember = "Dictionary_ID"; if (cbDictionary.DataSource != null) { cbDictionary.SelectedIndex = -1; } }
/// <summary> /// 绑定预置皮重状态(搜索按钮的状态) /// </summary> private void BindCboxSearchState() { this.cbxSeachState.DataSource = DictionaryDAL.GetValueStateDictionary("状态"); this.cbxSeachState.DisplayMember = "Dictionary_Name"; cbxSeachState.ValueMember = "Dictionary_ID"; if (cbxSeachState.DataSource != null) { cbxSeachState.SelectedIndex = 0; } }
private void typeBing() { cmb_type.DataSource = DictionaryDAL.GetValueStateDictionary("日志类型"); cmb_type.DisplayMember = "Dictionary_Name"; cmb_type.ValueMember = "Dictionary_ID"; if (cmb_type.DataSource != null) { cmb_type.SelectedIndex = -1; } }
public DictionaryListViewModel CastModel(Dictionary db) { DictionaryListViewModel model = new DictionaryListViewModel(); Com.HSJF.Infrastructure.ExtendTools.ObjectExtend.CopyTo(db, model); DictionaryDAL dal = new DictionaryDAL(); var parent = dal.Get(db.ParentKey); model.ParentKeyDisplay = parent == null ? "" : parent.Text; return(model); }
/// <summary> /// 绑定预置皮重状态(添加或修改时显示状态) /// </summary> private void BindCboxState() { //PresetTare_Dictionary_ID 预置皮重的状态字段 this.cbxPresetTareState.DataSource = DictionaryDAL.GetValueStateDictionary("状态"); this.cbxPresetTareState.DisplayMember = "Dictionary_Name"; cbxPresetTareState.ValueMember = "Dictionary_ID"; if (cbxPresetTareState.DataSource != null) { cbxPresetTareState.SelectedIndex = 0; } }
/// <summary> /// 绑定操作界面检测项目的值 /// </summary> private void BindcbxTestItemsState() { // TestItems_Dictionary_ID 检测项目的状态(操作界面绑定) this.cbxTestItemsState.DataSource = DictionaryDAL.GetValueStateDictionary("状态"); this.cbxTestItemsState.DisplayMember = "Dictionary_Name"; cbxTestItemsState.ValueMember = "Dictionary_ID"; if (cbxTestItemsState.DataSource != null) { cbxTestItemsState.SelectedIndex = 0; } }