public static Model.T_Dictionary FillModelByRow(DataRow row) { Model.T_Dictionary model = new Model.T_Dictionary(); if (row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } model.dNum = row["dNum"].ToString (); model.dName = row["dName"].ToString (); model.dType = row["dType"].ToString (); if (row["dLevel"].ToString() != "") { model.dLevel = int.Parse(row["dLevel"].ToString()); } model.dMark = row["dMark"].ToString (); if (row["dSortNum"].ToString() != "") { model.dSortNum = int.Parse(row["dSortNum"].ToString()); } model.dRemark = row["dRemark"].ToString (); return(model); }
private void ShowInfo(int _id) { Model.T_Dictionary model = bll.GetModel(_id); ddlParentId.SelectedValue = model.dType.ToString(); txtSortId.Text = model.dSortNum.ToString(); txtName.Text = model.dName; txtNum.Text = model.dNum; }
protected void btnSure_Click(object sender, EventArgs e) { #region model赋值 Model.T_Dictionary model = new Model.T_Dictionary(); model.dType = ddlParentId.SelectedValue; model.dNum = txtNum.Text.Trim(); model.dName = txtName.Text.Trim(); model.dSortNum = Convert.ToInt32(txtSortId.Text); if (model.dType == "00") { model.dLevel = 1; } else { model.dLevel = 2; } if (bll.GetCount(" and dNum='" + model.dNum + "' and dType='" + model.dType + "' and ID!=" + id) > 0 || model.dNum == "00") { JscriptMsg("相同父级下的菜单标号不能重复!", "", "Error"); return; } #endregion if (action == MXEnums.ActionEnum.Edit.ToString()) //修改 { model.ID = id; ChkAdminLevel(levelName, MXEnums.ActionEnum.Edit.ToString()); //检查权限 if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误!", "", "Error"); return; } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), GetAdminInfo().real_name + " 修改数据字典:" + model.dName); //记录日志 JscriptMsg("修改信息成功!", backUrl, "Success"); } else //添加 { ChkAdminLevel(levelName, MXEnums.ActionEnum.Add.ToString()); //检查权限 if (bll.Insert(model) <= 0) { JscriptMsg("保存过程中发生错误!", "", "Error"); return; } AddAdminLog(MXEnums.ActionEnum.Add.ToString(), GetAdminInfo().real_name + " 添加数据字典:" + model.dName); //记录日志 JscriptMsg("添加信息成功!", backUrl, "Success"); } }
private void DdlBind() { //绑定客户类型 BLL.T_Dictionary B_Dic = new BLL.T_Dictionary(); List <Model.T_Dictionary> L_Dic = B_Dic.GetList(" and dType='D01'"); ddlType.DataSource = L_Dic; ddlType.DataTextField = "dName"; ddlType.DataValueField = "ID"; ddlType.DataBind(); //绑定一级区域 BLL.T_Regional B_Reg = new BLL.T_Regional(); List <Model.T_Regional> L_Reg = B_Reg.GetList(" and ParentID=0 order by SortNum asc,ID asc"); Model.T_Regional M_Reg = new Model.T_Regional(); M_Reg.ID = 0; M_Reg.RName = "无"; M_Reg.SortNum = 0; L_Reg.Add(M_Reg); L_Reg = L_Reg.OrderBy(o => o.SortNum).ToList(); ddlOneArea.DataSource = L_Reg; ddlOneArea.DataTextField = "RName"; ddlOneArea.DataValueField = "ID"; ddlOneArea.DataBind(); //绑定二级区域 List <Model.T_Regional> L_RegTwo = new List <Model.T_Regional>(); L_RegTwo.Add(M_Reg); ddlTwoArea.DataSource = L_RegTwo; ddlTwoArea.DataTextField = "RName"; ddlTwoArea.DataValueField = "ID"; ddlTwoArea.DataBind(); //绑定银行 List <Model.T_Dictionary> L_DicBank = B_Dic.GetList(" and dType='D03'"); Model.T_Dictionary M_Dic = new Model.T_Dictionary(); M_Dic.ID = 0; M_Dic.dName = "无"; M_Dic.dSortNum = 0; L_DicBank.Add(M_Dic); L_DicBank = L_DicBank.OrderBy(o => o.dSortNum).ToList(); ddlBank.DataSource = L_DicBank; ddlBank.DataTextField = "dName"; ddlBank.DataValueField = "ID"; ddlBank.DataBind(); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel(LevelName, MXEnums.ActionEnum.Edit.ToString()); //检查权限 Model.T_Dictionary model = new Model.T_Dictionary(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } model.ID = id; model.dSortNum = sortId; bll.Update(model); } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存数据字典排序"); //记录日志 JscriptMsg("保存排序成功!", ThisUrl, "Success"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.T_Dictionary model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Model.T_Dictionary model) { return(dal.Insert(model)); }