public void FillDeviceGrid() { DataTable dt = objDevice.GetDeviceMaster(Session["CompId"].ToString()); dt = new DataView(dt, "Brand_Id='" + Session["BrandId"].ToString() + "' and Location_Id='" + Session["LocId"].ToString() + "'", "", DataViewRowState.CurrentRows).ToTable(); gvDevice.DataSource = dt; gvDevice.DataBind(); Session["dtFilter"] = dt; Session["Device"] = dt; }
public static string[] GetCompletionListIpAddress(string prefixText, int count, string contextKey) { Att_DeviceMaster objDevice = new Att_DeviceMaster(); DataTable dt = new DataView(objDevice.GetDeviceMaster(HttpContext.Current.Session["CompId"].ToString()), "IP_Address like '" + prefixText.ToString() + "%'", "", DataViewRowState.CurrentRows).ToTable(); string[] txt = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { txt[i] = dt.Rows[i]["IP_Address"].ToString(); } return(txt); }
protected void txtDeviceName_OnTextChanged(object sender, EventArgs e) { if (editid.Value == "") { DataTable dt = objDevice.GetDeviceMasterByDeviceName(Session["CompId"].ToString().ToString(), txtDeviceName.Text.Trim()); if (dt.Rows.Count > 0) { txtDeviceName.Text = ""; DisplayMessage("Device Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtDeviceName); return; } DataTable dt1 = objDevice.GetDeviceMasterInactive(Session["CompId"].ToString().ToString()); dt1 = new DataView(dt1, "Device_Name='" + txtDeviceName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtDeviceName.Text = ""; DisplayMessage("Device Name Already Exists - Go to Bin Tab"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtDeviceName); return; } txtDeviceNameL.Focus(); } else { DataTable dtTemp = objDevice.GetDeviceMasterById(Session["CompId"].ToString().ToString(), editid.Value); if (dtTemp.Rows.Count > 0) { if (dtTemp.Rows[0]["Device_Name"].ToString() != txtDeviceName.Text) { DataTable dt = objDevice.GetDeviceMaster(Session["CompId"].ToString().ToString()); dt = new DataView(dt, "Device_Name='" + txtDeviceName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt.Rows.Count > 0) { txtDeviceName.Text = ""; DisplayMessage("Device Name Already Exists"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtDeviceName); return; } DataTable dt1 = objDevice.GetDeviceMaster(Session["CompId"].ToString().ToString()); dt1 = new DataView(dt1, "Device_Name='" + txtDeviceName.Text + "'", "", DataViewRowState.CurrentRows).ToTable(); if (dt1.Rows.Count > 0) { txtDeviceName.Text = ""; DisplayMessage("Device Name Already Exists - Go to Bin Tab"); System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtDeviceName); return; } } } txtDeviceNameL.Focus(); } }