protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.Model.MerchantsJoinListModel merchantsJoinListModel = new zlzw.Model.MerchantsJoinListModel(); merchantsJoinListModel.PublishName = Get_UserName(Request.Cookies["UserID"].Value); merchantsJoinListModel.MerchantsJoinConetnt = txbContent.Text; merchantsJoinListModel.IsEnable = 1; merchantsJoinListModel.PublisDate = DateTime.Parse(ViewState["PublishDate"].ToString()); merchantsJoinListModel.MerchantsJoinGUID = new Guid(ViewState["MerchantsJoinGUID"].ToString()); zlzw.BLL.MerchantsJoinListBLL merchantsJoinListBLL = new zlzw.BLL.MerchantsJoinListBLL(); merchantsJoinListModel.MerchantsJoinID = int.Parse(Get_ID(merchantsJoinListBLL, Request.QueryString["value"])); merchantsJoinListBLL.Update(merchantsJoinListModel); } else { //添加保存 zlzw.Model.MerchantsJoinListModel merchantsJoinListModel = new zlzw.Model.MerchantsJoinListModel(); merchantsJoinListModel.PublishName = Get_UserName(Request.Cookies["UserID"].Value); merchantsJoinListModel.MerchantsJoinConetnt = txbContent.Text; merchantsJoinListModel.IsEnable = 1; merchantsJoinListModel.PublisDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); zlzw.BLL.MerchantsJoinListBLL merchantsJoinListBLL = new zlzw.BLL.MerchantsJoinListBLL(); merchantsJoinListBLL.Add(merchantsJoinListModel); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.MerchantsJoinListModel DataRowToModel(DataRow row) { zlzw.Model.MerchantsJoinListModel model=new zlzw.Model.MerchantsJoinListModel(); if (row != null) { if(row["MerchantsJoinID"]!=null && row["MerchantsJoinID"].ToString()!="") { model.MerchantsJoinID=int.Parse(row["MerchantsJoinID"].ToString()); } if(row["MerchantsJoinGUID"]!=null && row["MerchantsJoinGUID"].ToString()!="") { model.MerchantsJoinGUID= new Guid(row["MerchantsJoinGUID"].ToString()); } if(row["MerchantsJoinConetnt"]!=null) { model.MerchantsJoinConetnt=row["MerchantsJoinConetnt"].ToString(); } if(row["IsEnable"]!=null && row["IsEnable"].ToString()!="") { model.IsEnable=int.Parse(row["IsEnable"].ToString()); } if(row["PublisDate"]!=null && row["PublisDate"].ToString()!="") { model.PublisDate=DateTime.Parse(row["PublisDate"].ToString()); } if(row["PublishName"]!=null) { model.PublishName=row["PublishName"].ToString(); } if(row["Other01"]!=null) { model.Other01=row["Other01"].ToString(); } if(row["Other02"]!=null) { model.Other02=row["Other02"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.MerchantsJoinListModel GetModel(int MerchantsJoinID) { SqlParameter[] parameters = { new SqlParameter("@MerchantsJoinID", SqlDbType.Int,4) }; parameters[0].Value = MerchantsJoinID; zlzw.Model.MerchantsJoinListModel model=new zlzw.Model.MerchantsJoinListModel(); DataSet ds= DbHelperSQL.RunProcedure("MerchantsJoinList_GetModel",parameters,"ds"); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }