public String getSelection(string fieldName, string filterValue) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("{rs:["); using (SqlDB db = new SqlDB(ConfigurationManager.ConnectionStrings["dbconn"].ToString())) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "[sp_HubInventoryDetail_getSelectItems]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@objectField", fieldName); cmd.Parameters.AddWithValue("@keyword", filterValue); DataTable dt = db.getDataTableWithCmd(ref cmd); cmd.Dispose(); if (dt.Rows.Count > 0) { sb.Append("\"" + urlString(dt.Rows[0][0].ToString()) + "\""); for (int i = 1; i < dt.Rows.Count; i++) { sb.Append(",\"" + urlString(dt.Rows[i][0].ToString()) + "\""); } } } sb.Append("]}"); return sb.ToString(); }
public static DataTable getDbUser(string uid, string domain) { DataTable dt = new DataTable(); using (SqlDB sqldb = new SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("sp_GAM_UsersGet"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", uid); cmd.Parameters.AddWithValue("@domain", domain); dt = sqldb.getDataTableWithCmd(ref cmd); cmd.Dispose(); } return dt; }
private void set_nUser(string user_id, string domainName) { domain = "asia"; if (domainName != "") domain = domainName; LDAP ldap = new LDAP(@"LDAP://DC=" + domain + ",DC=ad,DC=flextronics,DC=com"); if (ldap.findUser(user_id, domain)) { _isLdapUser = true; _uid = ldap.uid; using (SqlDB sqldb = new SqlDB(__conn)) { SqlCommand cmd = new SqlCommand("[sp_GAM_UsersGet]"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@uid", _uid); cmd.Parameters.AddWithValue("@domain", domain); DataTable dt = sqldb.getDataTableWithCmd(ref cmd); cmd.Dispose(); if (dt.Rows.Count == 1) { DataRow row = dt.Rows[0]; isActive = (bool)row["isActive"]; isAdmin = (bool)row["isAdmin"]; if (row["uGroup"].ToString().ToLower() == "admin") isAdmin = true; managerId = (int)row["managerId"]; isSale = (bool)row["isSales"]; isReportViewer = (bool)row["isReportViewer"]; sysUserId = (int)row["sysUserId"]; _isDbUser = true; } } userName = ldap.name; emailAddress = ldap.email; jobTitle = ldap.title; fax = ldap.fax; tel = ldap.tel; department = ldap.department; } else { _uid = ""; msg = "User not found."; } ldap.Dispose(); }
private DataTable loadDT() { DataTable dt = new DataTable(); using (SqlDB db = new SqlDB(ConfigurationManager.ConnectionStrings["dbconn"].ToString())) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from hubInventoryOEMPolicy order by warehouseId,billingPolicy,transit"; cmd.CommandType = CommandType.Text; dt = db.getDataTableWithCmd(ref cmd); cmd.Dispose(); } return dt; }
private DataTable getData() { DataTable dt = new DataTable(); using (SqlDB sqldb = new SqlDB(ConfigurationManager.ConnectionStrings["biconn"].ToString())) { int start = 0; int end = 0; if (startDate.Text.Trim() != "") start = Convert.ToInt32(DateTime.ParseExact(startDate.Text.Trim(), @"M/d/yyyy", null).ToString("yyyyMMdd")); if (endDate.Text.Trim() != "") end = Convert.ToInt32(DateTime.ParseExact(endDate.Text.Trim(), @"M/d/yyyy", null).ToString("yyyyMMdd")); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "[sp_MKTRPT_projectDetail]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@oem", OEM.Text.Trim()); cmd.Parameters.AddWithValue("@plant", Plant.Text.Trim()); cmd.Parameters.AddWithValue("@project ", project.Text.Trim()); cmd.Parameters.AddWithValue("@layer", layer.Text.Trim()); cmd.Parameters.AddWithValue("@tech", tech.Text.Trim()); cmd.Parameters.AddWithValue("@surf", surf.Text.Trim()); cmd.Parameters.AddWithValue("@startDate", start); cmd.Parameters.AddWithValue("@endDate", end); dt = sqldb.getDataTableWithCmd(ref cmd); cmd.Dispose(); } return dt; }
private DataTable loadDT() { DataTable dt = new DataTable(); using (SqlDB db = new SqlDB(ConfigurationManager.ConnectionStrings["dbconn"].ToString())) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "select * from hubInventoryCEMLocation order by customer_code"; cmd.CommandType = CommandType.Text; dt = db.getDataTableWithCmd(ref cmd); cmd.Dispose(); } return dt; }