protected void editBtn_Click(object sender, EventArgs e) { DateTime start = DataConvert.CDate(StartDate.Text.Trim()); DateTime end = DataConvert.CDate(EndDate.Text.Trim()); if (start > end || start == end) { function.WriteErrMsg("日期格式错误"); } else { siteModel = siteBll.SelBySiteID(iis.Sites[siteName].Id.ToString()); siteModel.CreateDate = start; siteModel.EndDate = end; siteBll.UpdateModel(siteModel); string remind = "管理员将日期更改为" + start.ToString("yyyy年M月dd日") + "--" + end.ToString("yyyy年M月dd日"); SqlParameter[] sp = new SqlParameter[] { new SqlParameter("SiteID", siteModel.SiteID), new SqlParameter("Type", 1), new SqlParameter("Remind", remind), new SqlParameter("CreateDate", DateTime.Now) }; SqlHelper.ExecuteScalar(CommandType.Text, "Insert Into ZL_IDC_Log ([siteID],[Type],[Remind],[CreateDate]) Values(@SiteID,@Type,@Remind,@CreateDate)", sp); TextBind(); DataBind(); } }
//Save Site(基础设置) protected void BasicSaveBtn_Click(object sender, EventArgs e) { IPDeal(); M_UserInfo mu = buser.GetUserIDByUserName(manageName.Text.Trim()); if (!string.IsNullOrEmpty(manageName.Text.Trim()))//保存时检测用户名 { if (mu.IsNull) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('用户不存在');", true); return; } } iisHelper.ChangeNetVersion(appName, netVersion.SelectedValue); iisHelper.ChangeMode(appName, runMode.SelectedValue); //-----Error Page,etc.. //403 (禁止) 服务器拒绝请求。 //404 (未找到) 服务器找不到请求的网页。 //500 (服务器内部错误) 服务器遇到错误,无法完成请求。 //503 (服务不可用) //enHelper.UpdateCustomError(webPath, 403, errorPage1.Text.Trim()); //enHelper.UpdateCustomError(webPath, 404, errorPage2.Text.Trim()); //enHelper.UpdateCustomError(webPath, 500, errorPage3.Text.Trim()); //enHelper.UpdateCustomError(webPath, 503, errorPage4.Text.Trim()); //Name change must be the last if (!siteName.Equals(Name.Text.Trim()))//名字最后改,不能为空不能小于三位,前台正则 { iisHelper.ChangeSiteName(siteName, Name.Text.Trim()); } //先检测目标SiteID是否存在,如果存在则更新,不存在则插入 siteM = siteBll.SelBySiteID(siteID); if (siteM == null) { //Insert siteM = new M_Site_SiteList(); siteM.SiteID = Convert.ToInt16(siteID); siteM.SiteManager = mu.UserID == 0 ? "" : mu.UserID.ToString(); siteM.Remind = mu.UserName; siteM.SiteName = siteName; siteM.CreateDate = DateTime.Now; siteM.EndDate = DateTime.Now; siteBll.Insert(siteM); } else { //Update siteM.SiteManager = mu.UserID == 0 ? "" : mu.UserID.ToString(); siteM.Remind = mu.UserName; siteBll.UpdateModel(siteM); } //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改成功');location='SiteDetail.aspx?siteName="+Server.UrlEncode(Name.Text.Trim())+"';", true); Response.Redirect(CustomerPageAction.customPath + "Site/SiteDetail.aspx" + Request.Url.Query); }
protected void Update(int rowNum, string id)//Update WebSite with index=0,Name,Port,PPath,Domain { IISWebSite site = new IISWebSite(); GridViewRow gr = EGV.Rows[rowNum]; site.SiteName = ((TextBox)gr.FindControl("EditSiteName")).Text.Trim(); site.Port = ((TextBox)gr.FindControl("EditPort")).Text.Trim(); //site.PhysicalPath = ((TextBox)gr.FindControl("EditPhySicalPath")).Text.Trim(); //site.DomainName = ((TextBox)gr.FindControl("EditDomain")).Text.Trim(); IISHelper iisM = new IISHelper(); DataTable dt = iisM.GetWebSiteList(); dt.DefaultView.RowFilter = "SiteID=" + id; DataRow dr = dt.DefaultView.ToTable().Rows[0]; //-----有更改才更新,先更新域名 if (!(dr["SiteName"] as string).Equals(site.SiteName)) { iisHelper.ChangeSiteName(dr["SiteName"] as string, site.SiteName); } if (!(dr["SitePort"] as string).Equals(site.Port)) { iisHelper.ChangeSitePort(site.SiteName, site.Port); } //if (!(dr["PhysicalPath"] as string).Equals(site.PhysicalPath)) // iisHelper.ChangeSitePath(site.SiteName, site.PhysicalPath); //if (!(dr["Domain"] as string).Equals(site.DomainName)) // iisHelper.ChangeSiteDomain(site.SiteName, site.DomainName); B_Site_SiteList siteBll = new B_Site_SiteList(); M_Site_SiteList siteModel = new M_Site_SiteList(); siteModel = siteBll.SelBySiteID(id); siteModel.EndDate = DataConvert.CDate(((TextBox)gr.FindControl("EditEndDate")).Text.Trim()); siteBll.UpdateModel(siteModel); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改完成');location=location;", true); }
protected void EGV_RowCommand(object sender, GridViewCommandEventArgs e) { string url = "SiteDetail.aspx?siteName=" + Request.QueryString["siteName"]; M_Site_SiteList msite = siteBll.SelectByName(Request.QueryString["siteName"]); string[] orders = msite.OrderNum.Split(','); switch (e.CommandName) { case "select": if (siteBll.CheckOrderNum(e.CommandArgument.ToString()).Rows.Count == 0) { int k = 0; if (msite.OrderNum == "") { msite.OrderNum = e.CommandArgument.ToString(); } else { for (int i = 0; i < orders.Length; i++, k++) { if (orders[i] == e.CommandArgument.ToString()) { break; } } if (k == orders.Length) { msite.OrderNum += "," + e.CommandArgument.ToString(); } } siteBll.UpdateModel(msite); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改成功');", true); Response.Write(" <script>window.parent.window.location.href = '" + url + "' </script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('该订单已被绑定,请选择其他订单!');", true); } break; case "delete1": string str = ""; if (msite.OrderNum != "") { if (siteBll.CheckOrderNum(Request.QueryString["siteName"], e.CommandArgument.ToString()).Rows.Count == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('站点未绑定该订单');", true); } else { for (int i = 0; i < orders.Length; i++) { if (orders[i] != e.CommandArgument.ToString()) { str += orders[i] + ","; } } str = str.TrimEnd(','); msite.OrderNum = str; siteBll.UpdateModel(msite); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('修改成功');", true); Response.Write(" <script>window.parent.window.location.href = '" + url + "' </script>"); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('站点未绑定任何订单');", true); } break; default: break; } }