コード例 #1
0
        public static void AddOrderByRequest(OrderByRequest orderByRequest)
        {
            using (var db = new SQLDataAccess())
            {
                db.cmd.CommandText = " INSERT INTO [Order].[OrderByRequest] " +
                                     " ([ProductID], [ProductName], [ArtNo], [Quantity], [UserName], [Email], [Phone], [Comment], [IsComplete], [RequestDate], [OfferID] ) " +
                                     " VALUES (@ProductID, @ProductName, @ArtNo, @Quantity, @UserName, @Email, @Phone, @Comment, @IsComplete, @RequestDate, @OfferID); SELECT SCOPE_IDENTITY();";
                db.cmd.CommandType = CommandType.Text;
                db.cmd.Parameters.Clear();

                db.cmd.Parameters.AddWithValue("@ProductID", orderByRequest.ProductId);
                db.cmd.Parameters.AddWithValue("@ProductName", orderByRequest.ProductName);
                db.cmd.Parameters.AddWithValue("@ArtNo", orderByRequest.ArtNo);
                db.cmd.Parameters.AddWithValue("@Quantity", orderByRequest.Quantity);
                db.cmd.Parameters.AddWithValue("@UserName", orderByRequest.UserName);
                db.cmd.Parameters.AddWithValue("@Email", orderByRequest.Email);
                db.cmd.Parameters.AddWithValue("@Phone", orderByRequest.Phone);
                db.cmd.Parameters.AddWithValue("@Comment", orderByRequest.Comment);
                db.cmd.Parameters.AddWithValue("@IsComplete", orderByRequest.IsComplete);
                db.cmd.Parameters.AddWithValue("@RequestDate", orderByRequest.RequestDate);
                db.cmd.Parameters.AddWithValue("@OfferID", orderByRequest.OfferId);

                db.cnOpen();
                orderByRequest.OrderByRequestId = SQLDataHelper.GetInt(db.cmd.ExecuteScalar());
                db.cnClose();
            }
        }
コード例 #2
0
        public static void UpdateOrderByRequest(OrderByRequest orderByRequest)
        {
            using (var db = new SQLDataAccess())
            {
                db.cmd.CommandText = " UPDATE [Order].[OrderByRequest] SET [ProductID] = @ProductID, [ProductName] = @ProductName, [ArtNo] = @ArtNo, [Quantity] = @Quantity, [UserName] = @UserName, [Email] = @Email, [Phone] = @Phone, [Comment] = @Comment, [IsComplete] = @IsComplete, [RequestDate] = @RequestDate, [OfferID] = @OfferID, LetterComment=@LetterComment, Options=@Options " +
                                     " WHERE OrderByRequestId = @OrderByRequestId";
                db.cmd.CommandType = CommandType.Text;
                db.cmd.Parameters.Clear();

                db.cmd.Parameters.AddWithValue("@OrderByRequestId", orderByRequest.OrderByRequestId);
                db.cmd.Parameters.AddWithValue("@ProductID", orderByRequest.ProductId);
                db.cmd.Parameters.AddWithValue("@ProductName", orderByRequest.ProductName);
                db.cmd.Parameters.AddWithValue("@ArtNo", orderByRequest.ArtNo);
                db.cmd.Parameters.AddWithValue("@Quantity", orderByRequest.Quantity);
                db.cmd.Parameters.AddWithValue("@UserName", orderByRequest.UserName);
                db.cmd.Parameters.AddWithValue("@Email", orderByRequest.Email);
                db.cmd.Parameters.AddWithValue("@Phone", orderByRequest.Phone);
                db.cmd.Parameters.AddWithValue("@Comment", orderByRequest.Comment);
                db.cmd.Parameters.AddWithValue("@IsComplete", orderByRequest.IsComplete);
                db.cmd.Parameters.AddWithValue("@RequestDate", orderByRequest.RequestDate);
                db.cmd.Parameters.AddWithValue("@OfferID", orderByRequest.OfferId);
                db.cmd.Parameters.AddWithValue("@LetterComment", orderByRequest.LetterComment);
                db.cmd.Parameters.AddWithValue("@Options", orderByRequest.Options ?? string.Empty);

                db.cnOpen();
                db.cmd.ExecuteNonQuery();
                db.cnClose();
            }
        }
コード例 #3
0
        public static void AddOrderByRequest(OrderByRequest orderByRequest)
        {
            using (var db = new SQLDataAccess())
            {
                db.cmd.CommandText = " INSERT INTO [Order].[OrderByRequest] " +
                                     " ([ProductID], [ProductName], [ArtNo], [Quantity], [UserName], [Email], [Phone], [Comment], [IsComplete], [RequestDate], [OfferID], LetterComment, Options ) " +
                                     " VALUES (@ProductID, @ProductName, @ArtNo, @Quantity, @UserName, @Email, @Phone, @Comment, @IsComplete, @RequestDate, @OfferID, @LetterComment, @Options); SELECT SCOPE_IDENTITY();";
                db.cmd.CommandType = CommandType.Text;
                db.cmd.Parameters.Clear();

                db.cmd.Parameters.AddWithValue("@ProductID", orderByRequest.ProductId);
                db.cmd.Parameters.AddWithValue("@ProductName", orderByRequest.ProductName);
                db.cmd.Parameters.AddWithValue("@ArtNo", orderByRequest.ArtNo);
                db.cmd.Parameters.AddWithValue("@Quantity", orderByRequest.Quantity);
                db.cmd.Parameters.AddWithValue("@UserName", orderByRequest.UserName);
                db.cmd.Parameters.AddWithValue("@Email", orderByRequest.Email);
                db.cmd.Parameters.AddWithValue("@Phone", orderByRequest.Phone);
                db.cmd.Parameters.AddWithValue("@Comment", orderByRequest.Comment);
                db.cmd.Parameters.AddWithValue("@IsComplete", orderByRequest.IsComplete);
                db.cmd.Parameters.AddWithValue("@RequestDate", orderByRequest.RequestDate);
                db.cmd.Parameters.AddWithValue("@OfferID", orderByRequest.OfferId);
                db.cmd.Parameters.AddWithValue("@LetterComment", orderByRequest.LetterComment ?? string.Empty);
                db.cmd.Parameters.AddWithValue("@Options", orderByRequest.Options ?? string.Empty);

                db.cnOpen();
                orderByRequest.OrderByRequestId = SQLDataHelper.GetInt(db.cmd.ExecuteScalar());
                db.cnClose();
            }
        }
コード例 #4
0
        public static void UpdateOrderByRequest(OrderByRequest orderByRequest)
        {
            using (var db = new SQLDataAccess())
            {
                db.cmd.CommandText = " UPDATE [Order].[OrderByRequest] SET [ProductID] = @ProductID, [ProductName] = @ProductName, [ArtNo] = @ArtNo, [Quantity] = @Quantity, [UserName] = @UserName, [Email] = @Email, [Phone] = @Phone, [Comment] = @Comment, [IsComplete] = @IsComplete, [RequestDate] = @RequestDate, [OfferID] = @OfferID " +
                                     " WHERE OrderByRequestId = @OrderByRequestId";
                db.cmd.CommandType = CommandType.Text;
                db.cmd.Parameters.Clear();

                db.cmd.Parameters.AddWithValue("@OrderByRequestId", orderByRequest.OrderByRequestId);
                db.cmd.Parameters.AddWithValue("@ProductID", orderByRequest.ProductId);
                db.cmd.Parameters.AddWithValue("@ProductName", orderByRequest.ProductName);
                db.cmd.Parameters.AddWithValue("@ArtNo", orderByRequest.ArtNo);
                db.cmd.Parameters.AddWithValue("@Quantity", orderByRequest.Quantity);
                db.cmd.Parameters.AddWithValue("@UserName", orderByRequest.UserName);
                db.cmd.Parameters.AddWithValue("@Email", orderByRequest.Email);
                db.cmd.Parameters.AddWithValue("@Phone", orderByRequest.Phone);
                db.cmd.Parameters.AddWithValue("@Comment", orderByRequest.Comment);
                db.cmd.Parameters.AddWithValue("@IsComplete", orderByRequest.IsComplete);
                db.cmd.Parameters.AddWithValue("@RequestDate", orderByRequest.RequestDate);
                db.cmd.Parameters.AddWithValue("@OfferID", orderByRequest.OfferId);

                db.cnOpen();
                db.cmd.ExecuteNonQuery();
                db.cnClose();
            }
        }
コード例 #5
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            bool boolIsValidPast = true;
            boolIsValidPast &= IsValidText(txtName.Text);
            boolIsValidPast &= IsValidText(txtEmail.Text);
            boolIsValidPast &= IsValidText(txtPhone.Text);

            int quantity = 0;
            if (!Int32.TryParse(txtAmount.Text, out quantity) || (quantity < 1))
            {
                boolIsValidPast = false;
            }

            if (!ValidationHelper.IsValidEmail(txtEmail.Text.Trim()))
            {
                boolIsValidPast = false;
            }

            if (!CaptchaControl1.IsValid())
            {
                CaptchaControl1.TryNew();
                boolIsValidPast = false;
            }

            if (boolIsValidPast == false)
            {
                ShowMessage(Notify.NotifyType.Error, Resource.Client_Feedback_WrongData);
                return;
            }

            try
            {
                var orderByRequest = new OrderByRequest
                    {
                        OfferId = offer.OfferId,
                        ProductId = offer.Product.ID,
                        ProductName = offer.Product.Name,
                        ArtNo = offer.Product.ArtNo,
                        Quantity = quantity,
                        UserName = txtName.Text,
                        Email = txtEmail.Text,
                        Phone = txtPhone.Text,
                        Comment = txtComment.Text,
                        IsComplete = false,
                        RequestDate = DateTime.Now
                    };

                OrderByRequestService.AddOrderByRequest(orderByRequest);

                var clsParam = new ClsMailParamOnOrderByRequest
                    {
                        OrderByRequestId = orderByRequest.OrderByRequestId.ToString(),
                        ArtNo = offer.Product.ArtNo,
                        ProductName = offer.Product.Name,
                        Quantity = quantity.ToString(),
                        UserName = txtName.Text,
                        Email = txtEmail.Text,
                        Phone = txtPhone.Text,
                        Comment = txtComment.Text,
                        Color = offer.Color != null ? offer.Color.ColorName : string.Empty,
                        Size = offer.Size != null ? offer.Size.SizeName : string.Empty
                    };

                string message = SendMail.BuildMail(clsParam);

                SendMail.SendMailNow(txtEmail.Text, Resource.Client_OrderByRequest_PreOrder, message, true);
                SendMail.SendMailNow(SettingsMail.EmailForOrders, Resource.Client_OrderByRequest_PreOrder, message, true);

                lblMessage.Text = Resource.Client_Feedback_MessageSent;
                MultiView1.SetActiveView(ViewResult);
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
                ShowMessage(Notify.NotifyType.Error, Resource.Client_Feedback_MessageError);
                MultiView1.SetActiveView(ViewResult);
            }
        }