コード例 #1
0
ファイル: HomeBLL.cs プロジェクト: citycash/BaseMVCNoEntity
 public string InsertOrUpdateUser(UserModel Model)
 {
     try
     {
         dbTrans.DbExecute("USP_Insert_Or_Update_User", new {
             Option = Model.Option,
             ID     = Model.ID,
             Nama   = Model.Nama,
             Email  = Model.Email,
         }, true);
         return("Sukses");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
コード例 #2
0
        public bool PostCheckout(TR_Checkout_Request param)
        {
            bool RetVal = false;

            try
            {
                DataTable CartID = new DataTable();

                using (CartID)
                {
                    CartID.Columns.Add("CartID", typeof(int));
                    foreach (var i in param.Cart)
                    {
                        int item = Convert.ToInt32(i.CartID_PK);
                        CartID.Rows.Add(item);
                    }
                }
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    List <SqlParameter> Parameter = new List <SqlParameter>();

                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pListCartID", SqlDbType = SqlDbType.Structured
                    });
                    Parameter[0].TypeName = "[dbo].[CARTLIST]";
                    Parameter[0].Value    = CartID;
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pShippingAddress", SqlDbType = SqlDbType.VarChar, Value = param.ShippingAddress ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pPaymentTypeID", SqlDbType = SqlDbType.Int, Value = param.PaymentTypeID.HasValue ? param.PaymentTypeID :0
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pCreatedBy", SqlDbType = SqlDbType.VarChar, Value = param.CreatedBy ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pCreatedDate", SqlDbType = SqlDbType.DateTime, Value = param.CreatedDate.HasValue ? param.CreatedDate : DateTime.Now
                    });

                    DBtran.DbExecute("USP_POST_CHECKOUT", Parameter, true, out SqlParameterCollection outParameter);
                    transactionScope.Complete();

                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
            }

            return(RetVal);
        }
コード例 #3
0
        public bool PostCart(TR_Cart_Request param)
        {
            bool RetVal;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                List <SqlParameter> Parameter = new List <SqlParameter>();

                //param
                //Parameter.Add(new SqlParameter() { ParameterName = "@pPostType", SqlDbType = SqlDbType.VarChar, Value = req.PostType.ToString() ?? "" });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pPostType", SqlDbType = SqlDbType.VarChar, Value = param.PostType ?? ""
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pCartID", SqlDbType = SqlDbType.VarChar, Value = param.CartID_PK.HasValue ? param.CartID_PK : 0
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pUserID", SqlDbType = SqlDbType.Int, Value = param.UserID_FK.HasValue ? param.UserID_FK : 0
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pProductID", SqlDbType = SqlDbType.Int, Value = param.ProductID_FK.HasValue ? param.ProductID_FK : 0
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pQuantity", SqlDbType = SqlDbType.Int, Value = param.Quantity.HasValue ? param.Quantity : -1
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pUserName", SqlDbType = SqlDbType.VarChar, Value = param.UserName ?? ""
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pDate", SqlDbType = SqlDbType.DateTime, Value = param.Date.HasValue ? param.Date : DateTime.Today
                });

                DBtran.DbExecute("USP_POST_CART", Parameter, true, out SqlParameterCollection outParameter);

                transactionScope.Complete();

                RetVal = true;
            }
            return(RetVal);
        }
コード例 #4
0
ファイル: DAL_Login.cs プロジェクト: farishadyann/Store
        public bool RegisterNewAccount(MS_UserInfo_Request req)
        {
            bool Retval;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                try
                {
                    List <SqlParameter> Parameter = new List <SqlParameter>();

                    //param
                    //Parameter.Add(new SqlParameter() { ParameterName = "@pPostType", SqlDbType = SqlDbType.VarChar, Value = req.PostType.ToString() ?? "" });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pEmail", SqlDbType = SqlDbType.VarChar, Value = req.Email ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pUserName", SqlDbType = SqlDbType.VarChar, Value = req.UserName ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pPassword", SqlDbType = SqlDbType.VarChar, Value = req.Password ?? ""
                    });
                    Parameter.Add(new SqlParameter()
                    {
                        ParameterName = "@pCreatedDate", SqlDbType = SqlDbType.DateTime, Value = req.CreatedDate.HasValue ? req.CreatedDate : DateTime.Today
                    });

                    DBtran.DbExecute("USP_REGISTER_USER", Parameter, true, out SqlParameterCollection outParameter);

                    transactionScope.Complete();

                    Retval = true;
                }
                catch (Exception ex)
                {
                    transactionScope.Dispose();

                    throw new Exception("DAL error : " + ex.Message);
                }
            }

            return(Retval);
        }
コード例 #5
0
ファイル: DAL_ActivityLog.cs プロジェクト: farishadyann/Store
        public bool ActivityLog(MS_ActivityLog param)
        {
            bool RetVal;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                List <SqlParameter> Parameter = new List <SqlParameter>();

                //param
                //Parameter.Add(new SqlParameter() { ParameterName = "@pPostType", SqlDbType = SqlDbType.VarChar, Value = req.PostType.ToString() ?? "" });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pActionName", SqlDbType = SqlDbType.VarChar, Value = param.ActionName ?? ""
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pUserID", SqlDbType = SqlDbType.Int, Value = param.UserID_FK.HasValue ? param.UserID_FK : 0
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pController", SqlDbType = SqlDbType.VarChar, Value = param.ControllerName ?? ""
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pDescription", SqlDbType = SqlDbType.VarChar, Value = param.Description ?? ""
                });
                Parameter.Add(new SqlParameter()
                {
                    ParameterName = "@pActivityDate", SqlDbType = SqlDbType.DateTime, Value = param.ActivityDate.HasValue ? param.ActivityDate : DateTime.Today
                });

                DBtran.DbExecute("USP_POST_ACTIVITY_LOG", Parameter, true, out SqlParameterCollection outParameter);

                transactionScope.Complete();

                RetVal = true;
            }
            return(RetVal);
        }