示例#1
0
        public DataTable GetDataTable(string query)
        {
            SQLDALService dal = new SQLDALService();
            DataTable     dt  = dal.Select(query).Data;

            return(dt);
        }
示例#2
0
        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);
        }
示例#3
0
        public DataTable GlobalDataInit()
        {
            _selectQuery = "SELECT * from GlobalSetup";
            SQLDALService dal = new SQLDALService();
            DataTable     dt  = dal.Select(_selectQuery).Data;

            return(dt);
        }
示例#4
0
        public DataTable GetShopList()
        {
            _selectQuery = "SELECT * from ShopList";
            SQLDALService dal = new SQLDALService();
            DataTable     dt  = dal.Select(_selectQuery).Data;

            return(dt);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
示例#11
0
        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"));
        }