private void ShowInfo(int WebSiteID) { WebSiteData.WebSite bll = new WebSiteData.WebSite(); WebSiteModel.WebSite model = bll.GetModel(WebSiteID); this.lblWebSiteID.Text = model.WebSiteID.ToString(); this.txtWebSiteName.Text = model.WebSiteName; ddlWebStatus.SelectedValue = model.WebStatusID.ToString(); ddlPartner.SelectedValue = model.PartnerID.ToString(); ddlWebSiteType.SelectedValue = model.WebSiteType; this.txtBackground.Text = model.Background; ddBrands.SelectedValue = model.BrandsID.ToString(); this.txtTemplate.Text = model.Template; this.txtTemplatePic.Text = model.TemplatePic; this.txtLanguage.Text = model.Language; //设置radio的值 this.txtOwner.SelectedValue = model.Owner.ToString(); this.txtServer.Text = model.Server; this.txtIPAddress.Text = model.IPAddress; this.txtPayment.Value = model.Payment; //this.txtIseffective.Text = model.Iseffective.ToString(); this.txtProgramsType.Text = model.ProgramsType; //this.txtSortIndex.Text = model.SortIndex.ToString(); //this.txtIshidden.Text = model.Ishidden.ToString(); this.txtAddDate.Text = model.AddDate.ToString(); this.txtOfflineDate.Text = model.OfflineDate.ToString(); this.txtRemark.Value = model.Remark; }
/// <summary> /// 组合查询的条件 /// </summary> /// <param name="_strWhere">组合条件</param> /// <param name="_orderby"></param> private void RptBind(int id, string _strWhere, string _orderby) { //得到第几页数据 this.page = DTRequest.GetQueryInt("page", 1); if (this.WebStatusID > 0) { this.ddlWebStatus.SelectedValue = this.WebStatusID.ToString(); } if (this.PartnerID > 0) { this.ddlPartner.SelectedValue = this.PartnerID.ToString(); } if (this.BrandsID > 0) { this.ddBrands.SelectedValue = this.BrandsID.ToString(); } this.ddlWebSiteType.SelectedValue = this.WebSiteType; //绑定多选的属性 this.ddlProperty.SelectedValue = this.property; //绑定关键字 this.txtKeywords.Text = this.keywords; WebSiteData.WebSite webSite = new WebSiteData.WebSite(); //参数分别是:每页条数 第几页 查询条件 排序条件 数据总数 this.rptList.DataSource = webSite.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("WebSiteList.aspx", urlParamsPage, this.id.ToString(), this.WebStatusID.ToString(), this.keywords, this.property, "__id__", this.PartnerID.ToString(), this.BrandsID.ToString(), this.WebSiteType); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); PageContent2.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); litCount.Text = this.totalCount.ToString(); }
protected void btnSaveSort_Click(object sender, EventArgs e) { WebSiteData.WebSite bll = new WebSiteData.WebSite(); //在图文展示的情况下 rptList.Items.Count 数量为0 所以 不成功 for (int i = 0; i < this.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; } bll.UpdateField(id, "SortIndex=" + sortId.ToString()); } JscriptMsg("保存排序成功啦!", Utils.CombUrlTxt("WebSiteList.aspx", urlParams, txtKeywords.Text), "Success"); }
protected void btnDelete_Click(object sender, EventArgs e) { bool bl = true;//标记变量 WebSiteData.WebSite bll = new WebSiteData.WebSite(); //遍历提交过来的对象集合 for (int i = 0; i < this.rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { //将捕获代码的程序 放置在最底层 bl = true; } else { //表示其中有一个选项没有删除成功 bl = false; Response.Write("出错的ID为" + id.ToString()); break; } } } if (bl) { JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("WebSiteList.aspx", urlParams, this.keywords), "Success"); } else { JscriptMsg("批量删除操作中...有一个没有删除成功!", "back", "Error"); } }
private bool DoEdit(int id) { bool result = true; WebSiteData.WebSite bll = new WebSiteData.WebSite(); //先获取在修改,这样就会覆盖掉model本身的默认字段值,因为有些字段值在编辑页面没有显示 WebSiteModel.WebSite model = bll.GetModel(id); int WebSiteID = id; string WebSiteName = this.txtWebSiteName.Text; int WebStatusID = int.Parse(ddlWebStatus.SelectedValue); int PartnerID = int.Parse(ddlPartner.SelectedValue); string WebSiteType = ddlWebSiteType.SelectedValue; string Background = this.txtBackground.Text; int BrandsID = int.Parse(ddBrands.SelectedValue); string Template = this.txtTemplate.Text; string TemplatePic = this.txtTemplatePic.Text; string Language = this.txtLanguage.Text; int Owner = 0; if (this.txtOwner.SelectedValue == "1") { Owner = 1; } string Server = this.txtServer.Text; string IPAddress = this.txtIPAddress.Text; string Payment = this.txtPayment.Value; //int Iseffective = int.Parse(this.txtIseffective.Text); string ProgramsType = this.txtProgramsType.Text; //int SortIndex = int.Parse(this.txtSortIndex.Text); //int Ishidden = int.Parse(this.txtIshidden.Text); DateTime AddDate; if (Maticsoft.Common.PageValidate.IsDateTime(this.txtAddDate.Text)) { AddDate = DateTime.Parse(this.txtAddDate.Text); } else { AddDate = DateTime.Now; } DateTime OfflineDate; if (Maticsoft.Common.PageValidate.IsDateTime(this.txtOfflineDate.Text)) { OfflineDate = DateTime.Parse(this.txtOfflineDate.Text); } else { OfflineDate = DateTime.Now; } string Remark = this.txtRemark.Value; model.WebSiteID = WebSiteID; model.WebSiteName = WebSiteName; model.WebStatusID = WebStatusID; model.PartnerID = PartnerID; model.WebSiteType = WebSiteType; model.Background = Background; model.BrandsID = BrandsID; model.Template = Template; model.TemplatePic = TemplatePic; model.Language = Language; model.Owner = Owner; model.Server = Server; model.IPAddress = IPAddress; model.Payment = Payment; //model.Iseffective = Iseffective; model.ProgramsType = ProgramsType; //model.SortIndex = SortIndex; //model.Ishidden = Ishidden; model.AddDate = AddDate; model.OfflineDate = OfflineDate; model.Remark = Remark; if (!bll.Update(model)) { result = false; } return(result); }