public DataTable GetDataTable(string query) { SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(query).Data; return(dt); }
public DataTable UserProfile_GetList(string UserName) { string _selectQuery = "EXECUTE usp_UserProfile_GetList '" + UserName + "'"; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; return(dt); }
public DataTable GlobalDataInit() { _selectQuery = "SELECT * from GlobalSetup"; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; return(dt); }
public DataTable GetShopList() { _selectQuery = "SELECT * from ShopList"; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; return(dt); }
public DataTable GetDistinctValue(string coloumName, string tableName) { _selectQuery = "SELECT Distinct " + coloumName + " FROM " + tableName; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; return(dt); }
public string GetMaxId(string coloumName, string rightStringLength, string initialValue, string tableName) { string maxId = ""; _selectQuery = "SELECT ISNULL(MAX(RIGHT(" + coloumName + ", " + rightStringLength + ")) + 1, " + initialValue + ") AS maxID " + " FROM " + tableName + " "; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; if (dt != null && dt.Rows.Count > 0) { maxId = dt.Rows[0][coloumName].ToString(); } return(maxId); }
public string GetSalesOrder() { string maxId = ""; string query = "select top 1 SalesOrderId from SalesOrder order by id desc"; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(query).Data; if (dt != null && dt.Rows.Count > 0) { maxId = dt.Rows[0]["SalesOrderId"].ToString(); if (!string.IsNullOrEmpty(maxId)) { try { maxId = maxId.Split('-')[1].ToString(); } catch (Exception) { try { maxId = maxId.Split('-')[2].ToString(); } catch (Exception ex) { ErrorLogger.ErrorWritter(ex); } } try { maxId = (Convert.ToInt32(maxId) + 1).ToString(); } catch (Exception ex) { ErrorLogger.ErrorWritter(ex); } } } if (string.IsNullOrEmpty(maxId)) { return("1"); } return(maxId); }
public string GetMaxIdByWhereVarChallan(string coloumName, string tableName, string whereCol, string WhereVal) { string maxId = ""; _selectQuery = "SELECT MAX(" + coloumName + ") +1 AS " + coloumName + " FROM " + tableName + " where left(Chln,3) <> 'rIN' and " + whereCol + "='" + WhereVal + "'"; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; if (dt != null && dt.Rows.Count > 0) { maxId = dt.Rows[0][coloumName].ToString(); } if (string.IsNullOrEmpty(maxId)) { return("1"); } return(maxId); }
public string GetCurrentMaxId(string coloumName, string tableName) { string maxId = ""; _selectQuery = "SELECT MAX(" + coloumName + ") AS " + coloumName + " FROM " + tableName; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; if (dt != null && dt.Rows.Count > 0) { maxId = dt.Rows[0][coloumName].ToString(); } if (string.IsNullOrEmpty(maxId)) { return("1"); } return(maxId); }
public string GetInvoiceNo(string coloumName, string tableName) { string maxId = ""; //_selectQuery = "SELECT MAX(CONVERT(numeric,(" + coloumName + "))) +1+(select max(id) from TempSalesMaster) AS " + coloumName + " FROM " + tableName; _selectQuery = "SELECT MAX(CONVERT(numeric,(Id)))+4109 AS Id FROM TempSalesMaster"; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; if (dt != null && dt.Rows.Count > 0) { maxId = dt.Rows[0][coloumName].ToString(); } if (string.IsNullOrEmpty(maxId)) { return("1"); } return(maxId); }
public string GetEmployeeCode(string coloumName, string tableName) { int maxId = 1; _selectQuery = "SELECT MAX(CONVERT(numeric,(" + coloumName + "))) +1 as " + coloumName + " FROM " + tableName; SQLDALService dal = new SQLDALService(); DataTable dt = dal.Select(_selectQuery).Data; try { if (dt != null && dt.Rows.Count > 0) { maxId = Convert.ToInt32(dt.Rows[0][coloumName]); } } catch (Exception ex) { } return(DateTime.Now.Year + "" + DateTime.Now.Month.ToString("D2") + maxId.ToString("D4")); }