public string GetCompanyGroup(string ownCompany) { string msg = ""; if (string.IsNullOrEmpty(ownCompany)) { ownCompany = HttpContext.Current.Session["Company"].ToString().Trim(); } try { string query = @"SELECT ITEM_GROUP_ID,ITEM_GROUP_NAME FROM T_ITEM_GROUP WHERE COMPANY_ID='" + ownCompany + "'"; DataSet ds = new DataSet(); ds = CommonDBSvc.GetDataSet(query); int c = ds.Tables[0].Rows.Count; if (c > 0) { return(JsonConvert.SerializeObject(ds.Tables[0])); } else { msg = "NotExist"; } } catch (Exception ex) { msg = ex.ToString(); } return(msg); }
public static string CheckUserData(string uid, string pwd) { string msg = ""; try { DataSet ds = new DataSet(); string queryString = @"SELECT USER_ID,USER_NAME,USER_TYPE FROM T_USER WHERE USER_ID='" + uid + "' AND USER_PWD='" + pwd + "'"; ds = CommonDBSvc.GetDataSet(queryString); int i = ds.Tables[0].Rows.Count; if (i > 0) { msg = ds.Tables[0].Rows[0]["USER_TYPE"].ToString(); HttpContext.Current.Session["user_type"] = msg; //HttpContext.Current.Session["item_group"] = ds.Tables[0].Rows[0]["ITEM_GROUP_ID"].ToString(); HttpContext.Current.Session["user_name"] = ds.Tables[0].Rows[0]["USER_NAME"].ToString(); HttpContext.Current.Session["userid"] = ds.Tables[0].Rows[0]["USER_ID"].ToString(); //string qr = @"INSERT INTO T_USER_LOG(USER_ID,USER_NAME,LOGIN_DATE,LOGIN_TIME,LOGIN_VIA)" + // "VALUES('" + uid + "','" + HttpContext.Current.Session["user_name"].ToString() + "',TO_DATE(SYSDATE),SYSDATE,'WEB')"; //OracleCommand cmdU = new OracleCommand(qr, conn); //int k = cmdU.ExecuteNonQuery(); } else { msg = "You are not permitted"; } } catch (Exception ex) { msg = ex.ToString(); } return(msg); }