protected void Page_Load(object sender, EventArgs e) { domID = Request.QueryString["id"]; if (!IsPostBack) { Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='Default.aspx'>站群管理</a></li><li class='active'>DNS管理</li>"); if (string.IsNullOrEmpty(Request.QueryString["id"])) { DataBindUser(); } else //修改 { string id = Request.QueryString["id"]; dnsModel = dnsBll.SelByID(id); domNameT.Text = dnsModel.Domain; dom_ipT.Text = dnsModel.IP; userNameT.Text = dnsModel.User_ID.ToString(); userID.Value = dnsModel.User_ID.ToString(); sub_dom_numT.Text = dnsModel.Max_sub_domain.ToString(); url_forwardT.Text = dnsModel.Max_url_forward.ToString(); saveBtn.Text = "修改"; SubDataBind(); tab3.Visible = false; addDiv.Visible = true; subDiv.Visible = true; } } }
private void TextToModel(M_IDC_DNSTable model) { dnsModel.User_ID = DataConverter.CLng(userID.Value); dnsModel.Domain = B_IDC_DomainPrice.RemoveW(domNameT.Text); dnsModel.IP = dom_ipT.Text.Trim(); //dnsModel.MX = dom_mailT.Text.Trim(); dnsModel.Max_sub_domain = DataConverter.CLng(sub_dom_numT.Text.Trim()); dnsModel.Max_url_forward = DataConverter.CLng(url_forwardT.Text.Trim()); dnsModel.State = dom_status.Checked ? 1 : 0; }
protected void saveBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["id"]))//添加 { TextToModel(dnsModel); int id = dnsBll.Insert(dnsModel);//默认插入三条子域名,Ftp与Mail,PoP等子域名 subDomBll.InitInsert(id, dnsModel.IP, badmin.GetAdminLogin().AdminId); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('添加成功!!');", true); Response.Redirect("DnsManage.aspx"); } else//修改 { dnsModel = dnsBll.SelByID(domID); TextToModel(dnsModel); dnsBll.UpdateModel(dnsModel); userNameT.Text = "admin"; userID.Value = dnsModel.User_ID.ToString(); remindSpan.Visible = true; remindSpan.InnerText = "操作DNS成功!!!"; } }
//-----------------Insert public int Insert(M_IDC_DNSTable model) { return(Sql.insert(strTableName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model))); }
//-----------------Update /// <summary> /// 更新信息 /// </summary> public bool UpdateModel(M_IDC_DNSTable model) { return(Sql.UpdateByIDs(strTableName, PK, model.ID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters())); }