Ejemplo n.º 1
0
        internal int AddEditProducts()
        {
            SqlCommand commandObject = null;
            KSDB dataObject = null;
            int Ret = 0;

            try
            {
                commandObject = new SqlCommand();
                commandObject.CommandType = CommandType.StoredProcedure;
                commandObject.CommandText = "ks_AddEditProducts";
                commandObject.Parameters.Add("@ProductID", SqlDbType.Int).Value = ProductID;
                commandObject.Parameters.Add("@ProductTypeID", SqlDbType.Int).Value = ProductTypeID;
                commandObject.Parameters.Add("@ProductName", SqlDbType.NVarChar).Value = ProductName;
                commandObject.Parameters.Add("@ProductDesc", SqlDbType.NVarChar).Value = ProductDesc;
                commandObject.Parameters.Add("@Quantity", SqlDbType.BigInt).Value = Quantity;
                commandObject.Parameters.Add("@Createdby", SqlDbType.BigInt).Value = Createdby;
                SqlParameter outputParameter = null;

                outputParameter = new SqlParameter();
                outputParameter.ParameterName = "@SuccessID";
                outputParameter.Direction = ParameterDirection.Output;
                outputParameter.SqlDbType = SqlDbType.Int;
                commandObject.Parameters.Add(outputParameter);

                dataObject = new KSDB();
                dataObject.ExecuteNonQuery(commandObject);
                Ret = CleanAndFormat.CleanInteger(outputParameter.Value);

            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex, "clsProduct-AddEditProducts", KarrStyleException.ExceptionLevel.Error);
            }

            finally
            {

            }

            return Ret;
        }
Ejemplo n.º 2
0
        internal clsUsers ValidateUser()
        {
            DataSet userDetails = null;
            SqlCommand commandObject = null;
            KSDB dataObject = null;

            try
            {
                commandObject = new SqlCommand();
                commandObject.CommandType = CommandType.StoredProcedure;
                commandObject.CommandText = "ks_ValidateUser";
                commandObject.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = UserName;
                commandObject.Parameters.Add("@Password", SqlDbType.NVarChar).Value = Password;

                dataObject = new KSDB();
                userDetails = dataObject.GetDataSet(commandObject);
            }

            finally
            {
                if (commandObject != null)
                {
                    commandObject.Dispose();
                    commandObject = null;
                }
                dataObject = null;
            }

            return GetUserProfile(userDetails, UserName, Password);
        }
Ejemplo n.º 3
0
        internal DataTable GetProcutTypes(int _typeid = 0)
        {
            DataSet ds = null;
            SqlCommand commandObject = null;
            KSDB dataObject = null;

            try
            {
                commandObject = new SqlCommand();
                commandObject.CommandType = CommandType.StoredProcedure;
                commandObject.CommandText = "ks_GetProductTypes";
                commandObject.Parameters.Add("@ProductTypeID", SqlDbType.Int).Value = _typeid;

                dataObject = new KSDB();
                ds = dataObject.GetDataSet(commandObject);

            }

            finally
            {
                if (commandObject != null)
                {
                    commandObject.Dispose();
                }
                commandObject = null;
                dataObject = null;
            }
            return ds.Tables[0];
        }
Ejemplo n.º 4
0
        internal DataTable GetProducts(string ShortOrder, string ShortBy, int CurrentPage, int RecsPerPage, out int NoOfPages, out int NoOfRecords)
        {
            DataSet ds = null;
            SqlCommand commandObject = null;
            KSDB dataObject = null;
            SqlParameter outputParameter = null;
            SqlParameter outputParameter2 = null;

            try
            {
                commandObject = new SqlCommand();
                commandObject.CommandType = CommandType.StoredProcedure;
                commandObject.CommandText = "ks_GetAllProducts";
                commandObject.Parameters.Add("@Page", SqlDbType.Int).Value = CurrentPage;
                commandObject.Parameters.Add("@RecsPerPage", SqlDbType.Int).Value = RecsPerPage;
                commandObject.Parameters.Add("@ProductID", SqlDbType.Int).Value = ProductID;
                commandObject.Parameters.Add("@ShortOrder", SqlDbType.NVarChar).Value = ShortOrder;
                commandObject.Parameters.Add("@ShortBy", SqlDbType.NVarChar).Value = ShortBy;

                outputParameter = new SqlParameter();
                outputParameter.ParameterName = "@NoOfPages";
                outputParameter.Direction = ParameterDirection.Output;
                outputParameter.SqlDbType = SqlDbType.Int;
                commandObject.Parameters.Add(outputParameter);

                outputParameter2 = new SqlParameter();
                outputParameter2.ParameterName = "@NoofRec";
                outputParameter2.Direction = ParameterDirection.Output;
                outputParameter2.SqlDbType = SqlDbType.Int;
                commandObject.Parameters.Add(outputParameter2);

                dataObject = new KSDB();
                ds = dataObject.GetDataSet(commandObject);

                NoOfPages = CleanAndFormat.CleanInteger(outputParameter.Value);
                NoOfRecords = CleanAndFormat.CleanInteger(outputParameter2.Value);

            }
            catch (Exception er)
            {
                NoOfPages = 0;
                NoOfRecords = 0;
            }

            finally
            {
                if (commandObject != null)
                {
                    commandObject.Dispose();
                }
                commandObject = null;
                dataObject = null;
            }
            return ds.Tables[0];
        }
Ejemplo n.º 5
0
        public void AddUserUsageLog(string loggedInUserName, int siteId, string visitedPage, string comments)
        {
            SqlCommand sc = null;
            KSDB d = null;

            try
            {
                sc = new SqlCommand("UsageLogAdd");
                sc.Parameters.Add("@OrganizationId", SqlDbType.Int).Value = OrganizationID;
                sc.Parameters.Add("@LoggedInUserId", SqlDbType.Int).Value = LoggedInUserID;
                sc.Parameters.Add("@UserName", SqlDbType.NVarChar).Value = loggedInUserName;
                sc.Parameters.Add("@SiteId", SqlDbType.Int).Value = siteId;
                sc.Parameters.Add("@VisitedPage", SqlDbType.NVarChar).Value = visitedPage;
                sc.Parameters.Add("@Comments", SqlDbType.NVarChar).Value = comments;
                sc.CommandType = CommandType.StoredProcedure;
                d = new KSDB();
                d.ExecuteNonQuery(sc);
            }
            finally
            {
                if (sc != null)
                {
                    sc.Dispose();
                    sc = null;
                }
                d = null;
            }
        }