protected void btnSaveRefresh_Click(object sender, EventArgs e) { if (Request.QueryString["Type"] == "1") { //编辑保存 zlzw.Model.EnterpriseServiceInfoListModel enterpriseServiceInfoListModel = new zlzw.Model.EnterpriseServiceInfoListModel(); enterpriseServiceInfoListModel.EnterpriseServiceTypeGUID = new Guid(drpEnterpriseServiceTypeGUID.SelectedValue);//所属企业服务类型 enterpriseServiceInfoListModel.EnterpriseServiceInfoTitle = txbEnterpriseServiceInfoTitle.Text;//企业内名称 enterpriseServiceInfoListModel.EnterpriseServiceInfointroduction = txbEnterpriseServiceInfointroduction.Text;//内容简介 enterpriseServiceInfoListModel.EnterpriseServiceInfoContent = FCKeditor1.Value;//内容正文 enterpriseServiceInfoListModel.IsEnable = 1; enterpriseServiceInfoListModel.PublishID = new Guid(Request.Cookies["UserID"].Value);//发布人ID enterpriseServiceInfoListModel.PublishDate = DateTime.Parse(ViewState["PublishDate"].ToString()); enterpriseServiceInfoListModel.EnterpriseServiceInfoGUID = new Guid(ViewState["EnterpriseServiceInfoGUID"].ToString()); zlzw.BLL.EnterpriseServiceInfoListBLL enterpriseServiceInfoListBLL = new zlzw.BLL.EnterpriseServiceInfoListBLL(); enterpriseServiceInfoListModel.EnterpriseServiceInfoID = int.Parse(Get_ID(enterpriseServiceInfoListBLL, Request.QueryString["value"])); enterpriseServiceInfoListBLL.Update(enterpriseServiceInfoListModel); } else { //添加保存 zlzw.Model.EnterpriseServiceInfoListModel enterpriseServiceInfoListModel = new zlzw.Model.EnterpriseServiceInfoListModel(); enterpriseServiceInfoListModel.EnterpriseServiceTypeGUID = new Guid(drpEnterpriseServiceTypeGUID.SelectedValue);//所属企业服务类型 enterpriseServiceInfoListModel.EnterpriseServiceInfoTitle = txbEnterpriseServiceInfoTitle.Text;//企业内名称 enterpriseServiceInfoListModel.EnterpriseServiceInfointroduction = txbEnterpriseServiceInfointroduction.Text;//内容简介 enterpriseServiceInfoListModel.EnterpriseServiceInfoContent = FCKeditor1.Value;//内容正文 enterpriseServiceInfoListModel.IsEnable = 1; enterpriseServiceInfoListModel.PublishID = new Guid(Request.Cookies["UserID"].Value);//发布人ID enterpriseServiceInfoListModel.PublishDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); zlzw.BLL.EnterpriseServiceInfoListBLL enterpriseServiceInfoListBLL = new zlzw.BLL.EnterpriseServiceInfoListBLL(); enterpriseServiceInfoListBLL.Add(enterpriseServiceInfoListModel); } // 2. Close this window and Refresh parent window PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <summary> /// 得到一个对象实体 /// </summary> public zlzw.Model.EnterpriseServiceInfoListModel DataRowToModel(DataRow row) { zlzw.Model.EnterpriseServiceInfoListModel model = new zlzw.Model.EnterpriseServiceInfoListModel(); if (row != null) { if (row["EnterpriseServiceInfoID"] != null && row["EnterpriseServiceInfoID"].ToString() != "") { model.EnterpriseServiceInfoID = int.Parse(row["EnterpriseServiceInfoID"].ToString()); } if (row["EnterpriseServiceTypeGUID"] != null && row["EnterpriseServiceTypeGUID"].ToString() != "") { model.EnterpriseServiceTypeGUID = new Guid(row["EnterpriseServiceTypeGUID"].ToString()); } if (row["EnterpriseServiceInfoGUID"] != null && row["EnterpriseServiceInfoGUID"].ToString() != "") { model.EnterpriseServiceInfoGUID = new Guid(row["EnterpriseServiceInfoGUID"].ToString()); } if (row["EnterpriseServiceInfoTitle"] != null) { model.EnterpriseServiceInfoTitle = row["EnterpriseServiceInfoTitle"].ToString(); } if (row["EnterpriseServiceInfointroduction"] != null) { model.EnterpriseServiceInfointroduction = row["EnterpriseServiceInfointroduction"].ToString(); } if (row["EnterpriseServiceInfoContent"] != null) { model.EnterpriseServiceInfoContent = row["EnterpriseServiceInfoContent"].ToString(); } if (row["PublishID"] != null && row["PublishID"].ToString() != "") { model.PublishID = new Guid(row["PublishID"].ToString()); } if (row["PublishDate"] != null && row["PublishDate"].ToString() != "") { model.PublishDate = DateTime.Parse(row["PublishDate"].ToString()); } if (row["IsEnable"] != null && row["IsEnable"].ToString() != "") { model.IsEnable = int.Parse(row["IsEnable"].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.EnterpriseServiceInfoListModel GetModel(int EnterpriseServiceInfoID) { SqlParameter[] parameters = { new SqlParameter("@EnterpriseServiceInfoID", SqlDbType.Int,4) }; parameters[0].Value = EnterpriseServiceInfoID; zlzw.Model.EnterpriseServiceInfoListModel model = new zlzw.Model.EnterpriseServiceInfoListModel(); DataSet ds = DbHelperSQL.RunProcedure("EnterpriseServiceInfoList_GetModel", parameters, "ds"); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }