/// <summary> /// 增加一条数据 /// </summary> public int Add(zlzw.Model.DictionaryListModel model) { int rowsAffected; SqlParameter[] parameters = { new SqlParameter("@DictionaryListID", SqlDbType.Int, 4), new SqlParameter("@DictionaryKey", SqlDbType.NVarChar, 50), new SqlParameter("@DictionaryValue", SqlDbType.NVarChar, 200), new SqlParameter("@DictionaryCategory", SqlDbType.NVarChar, 50), new SqlParameter("@DictionaryDesc", SqlDbType.NVarChar), new SqlParameter("@OrderNumber", SqlDbType.Int, 4), new SqlParameter("@IsInner", SqlDbType.Int, 4), new SqlParameter("@IsEnable", SqlDbType.Int, 4), new SqlParameter("@PublishDate", SqlDbType.DateTime) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.DictionaryKey; parameters[2].Value = model.DictionaryValue; parameters[3].Value = model.DictionaryCategory; parameters[4].Value = model.DictionaryDesc; parameters[5].Value = model.OrderNumber; parameters[6].Value = model.IsInner; parameters[7].Value = model.IsEnable; parameters[8].Value = model.PublishDate; DbHelperSQL.RunProcedure("DictionaryList_ADD", parameters, out rowsAffected); return((int)parameters[0].Value); }
protected void btnDel_Click(object sender, EventArgs e) { if (grid1.SelectedRowIndexArray != null && grid1.SelectedRowIndexArray.Length > 0) { string strSelectID = "0"; for (int i = 0, count = grid1.SelectedRowIndexArray.Length; i < count; i++) { int rowIndex = grid1.SelectedRowIndexArray[i]; foreach (object key in grid1.DataKeys[rowIndex]) { strSelectID = key.ToString(); } } #region 除逻辑 zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); zlzw.Model.DictionaryListModel dictionaryListModel = dictionaryListBLL.GetModel(int.Parse(strSelectID)); dictionaryListModel.IsEnable = 0; dictionaryListBLL.Update(dictionaryListModel); RegionList_BindGrid(); #endregion } else { return; } }
private string Get_BaseKey(string strID) { zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); zlzw.Model.DictionaryListModel dictionaryListModel = dictionaryListBLL.GetModel(int.Parse(strID)); return(dictionaryListModel.DictionaryKey); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.DictionaryListModel GetModel(int DictionaryListID) { SqlParameter[] parameters = { new SqlParameter("@DictionaryListID", SqlDbType.Int, 4) }; parameters[0].Value = DictionaryListID; zlzw.Model.DictionaryListModel model = new zlzw.Model.DictionaryListModel(); DataSet ds = DbHelperSQL.RunProcedure("DictionaryList_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["DictionaryListID"] != null && ds.Tables[0].Rows[0]["DictionaryListID"].ToString() != "") { model.DictionaryListID = int.Parse(ds.Tables[0].Rows[0]["DictionaryListID"].ToString()); } if (ds.Tables[0].Rows[0]["DictionaryKey"] != null && ds.Tables[0].Rows[0]["DictionaryKey"].ToString() != "") { model.DictionaryKey = ds.Tables[0].Rows[0]["DictionaryKey"].ToString(); } if (ds.Tables[0].Rows[0]["DictionaryValue"] != null && ds.Tables[0].Rows[0]["DictionaryValue"].ToString() != "") { model.DictionaryValue = ds.Tables[0].Rows[0]["DictionaryValue"].ToString(); } if (ds.Tables[0].Rows[0]["DictionaryCategory"] != null && ds.Tables[0].Rows[0]["DictionaryCategory"].ToString() != "") { model.DictionaryCategory = ds.Tables[0].Rows[0]["DictionaryCategory"].ToString(); } if (ds.Tables[0].Rows[0]["DictionaryDesc"] != null && ds.Tables[0].Rows[0]["DictionaryDesc"].ToString() != "") { model.DictionaryDesc = ds.Tables[0].Rows[0]["DictionaryDesc"].ToString(); } if (ds.Tables[0].Rows[0]["OrderNumber"] != null && ds.Tables[0].Rows[0]["OrderNumber"].ToString() != "") { model.OrderNumber = int.Parse(ds.Tables[0].Rows[0]["OrderNumber"].ToString()); } if (ds.Tables[0].Rows[0]["IsInner"] != null && ds.Tables[0].Rows[0]["IsInner"].ToString() != "") { model.IsInner = int.Parse(ds.Tables[0].Rows[0]["IsInner"].ToString()); } if (ds.Tables[0].Rows[0]["IsEnable"] != null && ds.Tables[0].Rows[0]["IsEnable"].ToString() != "") { model.IsEnable = int.Parse(ds.Tables[0].Rows[0]["IsEnable"].ToString()); } if (ds.Tables[0].Rows[0]["PublishDate"] != null && ds.Tables[0].Rows[0]["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(ds.Tables[0].Rows[0]["PublishDate"].ToString()); } return(model); } else { return(null); } }
private string Get_RegionName(string strDictionaryListID) { zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); zlzw.Model.DictionaryListModel dictionaryListModel = dictionaryListBLL.GetModel(int.Parse(strDictionaryListID)); if (dictionaryListModel != null) { return(dictionaryListModel.DictionaryValue); } else { return("未知"); } }
private void LoadData(string strType) { if (strType == "1") { string strID = Request.QueryString["value"];//操作ID zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); zlzw.Model.DictionaryListModel dictionaryListModel = dictionaryListBLL.GetModel(int.Parse(strID)); txbRegionName.Text = dictionaryListModel.DictionaryValue; //地区名称 txbIndexRegion.Text = dictionaryListModel.DictionaryKey; //地区索引 txbRegionDesc.Text = dictionaryListModel.DictionaryDesc; //地区简介 ViewState["PublishDate"] = dictionaryListModel.PublishDate.ToString(); ToolbarText2.Text = "编辑一个地区信息"; } btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference(); }
private void LoadData(string strType) { if (strType == "1") { string strID = Request.QueryString["value"];//操作ID zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); zlzw.Model.DictionaryListModel dictionaryListModel = dictionaryListBLL.GetModel(int.Parse(strID)); txbNewsTypeIndex.Text = dictionaryListModel.DictionaryKey; //新闻类型索引 txbNewsTypeName.Text = dictionaryListModel.DictionaryValue; //新闻类型名称 txbOrderNumber.Text = dictionaryListModel.OrderNumber.ToString(); txbDictionaryDesc.Text = dictionaryListModel.DictionaryDesc; ViewState["PublishDate"] = dictionaryListModel.PublishDate.ToString(); ToolbarText2.Text = "编辑一个新闻类型"; } btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference(); }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.Model.DictionaryListModel dictionaryListModel = new zlzw.Model.DictionaryListModel(); dictionaryListModel.IsInner = int.Parse(drpRegionStoreList.SelectedValue); dictionaryListModel.DictionaryValue = txbNewsTypeName.Text; dictionaryListModel.DictionaryKey = txbNewsTypeIndex.Text; dictionaryListModel.OrderNumber = int.Parse(txbOrderNumber.Text); dictionaryListModel.DictionaryDesc = txbDictionaryDesc.Text; dictionaryListModel.DictionaryCategory = "StoreItem"; dictionaryListModel.IsEnable = 1; dictionaryListModel.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString()); dictionaryListModel.DictionaryListID = int.Parse(Request.QueryString["value"]); zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); dictionaryListBLL.Update(dictionaryListModel); } else { //添加保存 zlzw.Model.DictionaryListModel dictionaryListModel = new zlzw.Model.DictionaryListModel(); dictionaryListModel.IsInner = int.Parse(drpRegionStoreList.SelectedValue); dictionaryListModel.DictionaryValue = txbNewsTypeName.Text; dictionaryListModel.DictionaryKey = txbNewsTypeIndex.Text; dictionaryListModel.OrderNumber = int.Parse(txbOrderNumber.Text); dictionaryListModel.DictionaryDesc = txbDictionaryDesc.Text; dictionaryListModel.IsEnable = 1; dictionaryListModel.DictionaryCategory = "StoreItem"; dictionaryListModel.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); zlzw.BLL.DictionaryListBLL dictionaryListBLL = new zlzw.BLL.DictionaryListBLL(); dictionaryListBLL.Add(dictionaryListModel); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(zlzw.Model.DictionaryListModel model) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@DictionaryListID", SqlDbType.Int, 4), new SqlParameter("@DictionaryKey", SqlDbType.NVarChar, 50), new SqlParameter("@DictionaryValue", SqlDbType.NVarChar, 200), new SqlParameter("@DictionaryCategory", SqlDbType.NVarChar, 50), new SqlParameter("@DictionaryDesc", SqlDbType.NVarChar), new SqlParameter("@OrderNumber", SqlDbType.Int, 4), new SqlParameter("@IsInner", SqlDbType.Int, 4), new SqlParameter("@IsEnable", SqlDbType.Int, 4), new SqlParameter("@PublishDate", SqlDbType.DateTime) }; parameters[0].Value = model.DictionaryListID; parameters[1].Value = model.DictionaryKey; parameters[2].Value = model.DictionaryValue; parameters[3].Value = model.DictionaryCategory; parameters[4].Value = model.DictionaryDesc; parameters[5].Value = model.OrderNumber; parameters[6].Value = model.IsInner; parameters[7].Value = model.IsEnable; parameters[8].Value = model.PublishDate; DbHelperSQL.RunProcedure("DictionaryList_Update", parameters, out rowsAffected); if (rowsAffected > 0) { return(true); } else { return(false); } }