protected void gvwDvs_RowDeleting(object sender, GridViewDeleteEventArgs e) { string id = gvwDvs.DataKeys[e.RowIndex].Value.ToString(); // SelectCameras sc = new SelectCameras(); IList<Cameras> c = sc.GetCameras(Session["userid"].ToString(), Session["cityid"].ToString(), id); if (c.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "失败", "<script>alert('不能删除,请先删除摄像头!')</script>"); return; } DvsManager dm = new DvsManager(); dm.DeleteDvs(id, Session["userid"].ToString()); Query(); }
protected void gvwDvs_RowDeleting(object sender, GridViewDeleteEventArgs e) { string id = gvwDvs.DataKeys[e.RowIndex].Value.ToString(); // SelectCameras sc = new SelectCameras(); IList <Cameras> c = sc.GetCameras(Session["userid"].ToString(), Session["cityid"].ToString(), id); if (c.Count > 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), "失败", "<script>alert('不能删除,请先删除摄像头!')</script>"); return; } DvsManager dm = new DvsManager(); dm.DeleteDvs(id, Session["userid"].ToString()); Query(); }
protected void btnExport_Click(object sender, EventArgs e) { DataSet ds = DoQuery(); DvsManager dm = new DvsManager(); if (dm.Export(ds.Tables[0], Server.MapPath("~/Tmp/") + hlkExportFile.Text)) { Response.Clear(); Response.Charset = "GB2312"; Response.Buffer = true; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.AppendHeader("Content-Disposition", "attachment;filename=" + hlkExportFile.Text); Response.ContentType = "application/ms-excel"; Response.WriteFile(Server.MapPath("~/Tmp/") + hlkExportFile.Text); Response.Flush(); Response.Close(); Response.End(); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "失败", "<script>alert('查询结果导出失败,请联系管理员!')</script>"); } }
protected void btnModify_Click(object sender, EventArgs e) { Dvs dvs = new Dvs(); dvs.Assertno = txtAssertNo.Text; dvs.Broadbandaccessno = txtBroadbandAccessNo.Text; dvs.Customeraddress = txtCustomerAddress.Text; dvs.Customermanager = txtCustomerManager.Text; dvs.Customermanager_phone = txtCustomerManagerPhone.Text; dvs.Customername = txtCustomerName.Text; dvs.Dialupaccount = txtDialupAccount.Text; dvs.Dialuppassword = txtDialupPassword.Text; dvs.Dvsno = txtDvsNo.Text; dvs.Gateway = txtGateway.Text; dvs.Installdate = txtInstalldate.Text.Trim() == "" ? DateTime.Now :Convert.ToDateTime(txtInstalldate.Text.Trim()); txtInstalldate.Text = DateTime.Now.ToShortDateString(); dvs.Installplace = txtInstallPlace.Text; dvs.Ip = txtIP.Text; dvs.Junctionboxno = txtJunctionBoxNo.Text; dvs.Lanno = txtLanNo.Text; dvs.Latitude = txtLatitude.Text.Trim() == "" ? 0 :Convert.ToDouble(txtLatitude.Text.Trim()); dvs.Linkman = txtLinkman.Text; dvs.Linkman_phone = txtLinkmanPhone.Text; dvs.Longitude = txtLongitude.Text.Trim() == "" ? 0 :Convert.ToDouble(txtLongitude.Text.Trim()); dvs.Portnum = txtPortNum.Text; dvs.Servicedesc = txtServiceDesc.Text; dvs.Storagetime = txtStorageTime.Text; dvs.Subnetmask = txtSubnetMask.Text; dvs.Surfaceman = txtSurfaceMan.Text; dvs.Surfaceman_phone = txtSurfaceManPhone.Text; dvs.Customertype = ddlCustomerType.SelectedValue; dvs.Devicelevel = ddlDeviceLevel.SelectedValue; dvs.Devicemanu = ddlDeviceManu.SelectedValue; dvs.Devicepropertyright = ddlDevicePropertyRight.SelectedValue; dvs.Devicestate = ddlDeviceState.SelectedValue; dvs.Dvskind = ddlDvsKind.SelectedValue; dvs.Dvstype = ddlDvsType.SelectedValue; dvs.Paymenttype = ddlPaymentType.SelectedValue; dvs.Powertype = ddlPowerType.SelectedValue; dvs.Powervoltage = ddlPowerVoltage.SelectedValue; dvs.Servicetype = ddlServiceType.SelectedValue; dvs.Storagetype = ddlStorageType.SelectedValue; dvs.Switchinmode = ddlSwitchinMode.SelectedValue; dvs.Switchinplace = ddlSwitchinPlace.SelectedValue; dvs.Suburb = hdfSuburb.Value; if (hdfDvsID.Value == "0" || hdfDvsID.Value == "") //新增 { DvsManager dm = new DvsManager(); dm.NewDvs(dvs, Session["userid"].ToString()); hdfDvsID.Value = dvs.Id.ToString(); btnModify.Text = "确定修改"; mPortNum = Convert.ToInt32(txtPortNum.Text); LoadCameras(); } else { dvs.Id = Convert.ToInt32(hdfDvsID.Value); DvsManager dm = new DvsManager(); dm.ModifyDvs(dvs, Session["userid"].ToString()); } }
protected void btnModify_Click(object sender, EventArgs e) { Dvs dvs = new Dvs(); dvs.Assertno = txtAssertNo.Text; dvs.Broadbandaccessno = txtBroadbandAccessNo.Text; dvs.Customeraddress = txtCustomerAddress.Text; dvs.Customermanager = txtCustomerManager.Text ; dvs.Customermanager_phone = txtCustomerManagerPhone.Text ; dvs.Customername = txtCustomerName.Text ; dvs.Dialupaccount = txtDialupAccount.Text ; dvs.Dialuppassword = txtDialupPassword.Text ; dvs.Dvsno = txtDvsNo.Text ; dvs.Gateway = txtGateway.Text ; dvs.Installdate = txtInstalldate.Text.Trim() == "" ? DateTime.Now :Convert.ToDateTime(txtInstalldate.Text.Trim()) ; txtInstalldate.Text = DateTime.Now.ToShortDateString(); dvs.Installplace = txtInstallPlace.Text ; dvs.Ip = txtIP.Text ; dvs.Junctionboxno = txtJunctionBoxNo.Text ; dvs.Lanno = txtLanNo.Text ; dvs.Latitude = txtLatitude.Text.Trim() == "" ? 0 :Convert.ToDouble(txtLatitude.Text.Trim()) ; dvs.Linkman = txtLinkman.Text ; dvs.Linkman_phone = txtLinkmanPhone.Text ; dvs.Longitude = txtLongitude.Text.Trim() == "" ? 0 :Convert.ToDouble(txtLongitude.Text.Trim()) ; dvs.Portnum = txtPortNum.Text ; dvs.Servicedesc = txtServiceDesc.Text ; dvs.Storagetime = txtStorageTime.Text ; dvs.Subnetmask = txtSubnetMask.Text ; dvs.Surfaceman = txtSurfaceMan.Text ; dvs.Surfaceman_phone = txtSurfaceManPhone.Text ; dvs.Customertype = ddlCustomerType.SelectedValue ; dvs.Devicelevel = ddlDeviceLevel.SelectedValue ; dvs.Devicemanu = ddlDeviceManu.SelectedValue ; dvs.Devicepropertyright = ddlDevicePropertyRight.SelectedValue ; dvs.Devicestate = ddlDeviceState.SelectedValue ; dvs.Dvskind = ddlDvsKind.SelectedValue ; dvs.Dvstype = ddlDvsType.SelectedValue ; dvs.Paymenttype = ddlPaymentType.SelectedValue ; dvs.Powertype = ddlPowerType.SelectedValue ; dvs.Powervoltage = ddlPowerVoltage.SelectedValue ; dvs.Servicetype = ddlServiceType.SelectedValue ; dvs.Storagetype = ddlStorageType.SelectedValue ; dvs.Switchinmode = ddlSwitchinMode.SelectedValue ; dvs.Switchinplace = ddlSwitchinPlace.SelectedValue ; dvs.Suburb = hdfSuburb.Value; if (hdfDvsID.Value == "0" || hdfDvsID.Value == "") //新增 { DvsManager dm = new DvsManager(); dm.NewDvs(dvs, Session["userid"].ToString()); hdfDvsID.Value = dvs.Id.ToString(); btnModify.Text = "确定修改"; mPortNum = Convert.ToInt32(txtPortNum.Text); LoadCameras(); } else { dvs.Id = Convert.ToInt32(hdfDvsID.Value); DvsManager dm = new DvsManager(); dm.ModifyDvs(dvs, Session["userid"].ToString()); } }