Esempio 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;
        }
Esempio n. 2
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;
            }
        }