/// <summary>
        /// Method called by Controller to insert the order with the database structure, receiving only the client description of order.
        /// </summary>
        /// <param name="orderViewModel"></param>
        /// <returns></returns>
        public static bool InsertOrder(OrderViewModel orderViewModel)
        {
            try
            {
                var           context  = new RestaurantDBContext();
                List <string> itemList = new List <string>();
                List <int>    numbers  = new List <int>();
                itemList = orderViewModel.OrderDescription.Split(",").ToList();
                OrderObj order = GetOrderObj(itemList.FirstOrDefault().ToLower().Trim());
                itemList.RemoveRange(0, 1);
                numbers = ValidateOrder(itemList);

                if (numbers != null && numbers.Count > 0)
                {
                    OrderAccess.AddOrder(order);
                    return(InsertAllOrderItems(numbers));
                }

                return(false);
            }
            catch
            {
                return(false);
            }
        }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         txtRefNo.Text = OrderAccess.GetRefNumber();
     }
 }
示例#3
0
 private void InitializeData()
 {
     this.dataGridView1.AutoGenerateColumns = true;
     DTds = SceneryAccess.selectForDistributor(DTId);
     if (DTds != null)
     {
         dataGridView1.DataSource = DTds.Tables[0];
     }
     this.dataGridView2.AutoGenerateColumns = true;
     OAds = OrderAccess.ShowOrderForDistributor(DTId);
     if (OAds != null)
     {
         this.dataGridView2.DataSource = OAds.Tables[0];
     }
     this.dataGridView3.AutoGenerateColumns = true;
     SYds = SceneryAccess.ShowScenery();
     if (SYds != null)
     {
         this.dataGridView3.DataSource = SYds.Tables[0];
     }
     this.dataGridView4.AutoGenerateColumns = true;
     ASds1 = ApplySceneryAccess.selectForApply(DTId);
     if (ASds1 != null)
     {
         this.dataGridView4.DataSource = ASds1.Tables[0];
     }
 }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        OrderIfo order   = new OrderIfo();
        string   orderID = GetOrderID();

        order.OrderID         = Convert.ToInt32(orderID);
        order.DateCreated     = txtDateCreated.Text;
        order.DateShipped     = txtShippedDate.Text;
        order.Verified        = verifiedCheckBox.Checked;
        order.Canceled        = canceledCheckBox.Checked;
        order.Completed       = completedCheckBox.Checked;
        order.Comments        = txtComments.Text;
        order.CustomerName    = txtCustomerName.Text;
        order.CustomeEmail    = txtCustomerEmail.Text;
        order.ShippingAddress = txtShippingAddress.Text;

        try
        {
            OrderAccess.OrderUpdate(order);
        }
        catch (Exception)
        {
        }
        lblStatus.Text = "İşlem Başarılı!";
        SetEditMode(false);
        DenetimlerDoldur(orderID);
    }
示例#5
0
 public ConsumerController(DatabaseInterface db)
 {
     _db      = db;
     _product = new ProductStorage(db);
     _user    = new CustomerStorage(db);
     _orders  = new OrderAccess(db);
 }
示例#6
0
        public void CanGetOrderById()
        {
            OrderAccess sut = CreateSystemUnderTest();

            Order order = sut.GetOrder(Guid.Parse("51B5CFF8-B2CE-4DE8-AB8A-16B6343E105A"));

            Assert.NotNull(order);
        }
示例#7
0
        public async Task CanCreateOrder()
        {
            OrderAccess sut = CreateSystemUnderTest();

            Order order = await sut.CreateOrderAsync(Guid.Parse("56DEF7D9-061C-4A26-BDF6-81695B074DD7"));

            Assert.NotNull(order);
        }
示例#8
0
        public void CanGetAllOrders()
        {
            OrderAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Order> orders = sut.GetAllOrders();

            Assert.NotEmpty(orders);
        }
    protected void btnMarkCalceled_Click(object sender, EventArgs e)
    {
        string orderID = GetOrderID();

        OrderAccess.OrderMarkCanceled(orderID);
        SetEditMode(false);
        lblStatus.Text = "İşlem Başarılı!";
        DenetimlerDoldur(orderID);
    }
示例#10
0
        public void CanGetCustomerOrders()
        {
            OrderAccess sut = CreateSystemUnderTest();

            IReadOnlyCollection <Order> orders =
                sut.GetCustomerOrders(Guid.Parse("56DEF7D9-061C-4A26-BDF6-81695B074DD7"));

            Assert.NotEmpty(orders);
        }
示例#11
0
    protected void btnMAWB_Imp_Click(object sender, EventArgs e)
    {
        string RefNo       = txtRefNo.Text;
        string MAWB_No     = txtMAWB_No.Text;
        string SubBL_No    = txtSubBL_No.Text;
        string BL_Vendor   = txtBL_Vendor.Text;
        string Agent       = txtAgent.Text;
        string AgentRef_No = txtAgentRef_No.Text;
        string Carrier     = txtCarrier.Text;
        string Manifest_No = txtManifest_No.Text;
        string Flight_No   = txtFlight_No.Text;
        string FltFlag     = txtFltFlag.Text;

        int    CountryID    = Int32.Parse(drpCountryID.SelectedValue);
        string DeptPortInit = txtDeptPortInit.Text;
        string DeptPortName = txtDeptPortName.Text;
        string DeptPortETD  = txtDeptPortETD.Text;

        string FirstPortInit = txtFirstPortInit.Text;
        string FirstPortName = txtFirstPortName.Text;
        string FirstPortETA  = txtFirstPortETA.Text;

        string DestPortInit = txtDestPortInit.Text;
        string DestPortName = txtDestPortName.Text;
        string DestPortETA  = txtDestPortETA.Text;

        string LastPortInit = txtLastPortInit.Text;
        string LastPortName = txtLastPortName.Text;
        string LastPortETA  = txtLastPortETA.Text;

        string FreightLoct  = txtFreightLoct.Text;
        string StorageStart = txtStorageStart.Text;
        string GO_Date      = txtGO_Date.Text;
        int    PKG_Quant    = Int32.Parse(txtPKG_Quant.Text);
        double GrossKgs     = Double.Parse(txtGrossKgs.Text);
        double ChargeKgs    = Double.Parse(txtChargeKgs.Text);
        bool   PayMethod    = true;       // CHANGE TO SELECTED VALUE LATER !!!!!!
        bool   Closed       = true;
        string ClosedBy     = txtClosedBy.Text;
        string CloseDate    = txtCloseDate.Text;

        bool flag = false;

        flag = OrderAccess.MAWB_Imp_Create(RefNo, MAWB_No, SubBL_No, BL_Vendor,
                                           Agent, AgentRef_No, Carrier, Manifest_No, Flight_No, FltFlag,
                                           CountryID, DeptPortInit, DeptPortName, DeptPortETD, FirstPortInit, FirstPortName, FirstPortETA,
                                           DestPortInit, DestPortName, DestPortETA, LastPortInit, LastPortName, LastPortETA, FreightLoct,
                                           StorageStart, GO_Date, PKG_Quant, GrossKgs, ChargeKgs, PayMethod, Closed, ClosedBy, CloseDate);

        lblStatus.Text = flag ? "MAWB IMPORT  CREATED" : "ERROR ! FAILED TO CREATE MAWB IMPORT";
        if (flag == true)
        {
            GetRefNo();
        }
    }
        public static List <OrderViewModel> GetOrders()
        {
            List <OrderViewModel> orders = new List <OrderViewModel>();
            var orderObjs = OrderAccess.GetOrderObjs();

            foreach (var order in orderObjs)
            {
                orders.Add(GetOrder(order));
            }

            return(orders);
        }
    public static List <CustomerLibGetOrderDetailInfo> GetOrderDetails(string orderID)
    {
        DataTable dt = OrderAccess.GetOrderDetails(orderID);

        List <CustomerLibGetOrderDetailInfo> orderDetails = new List <CustomerLibGetOrderDetailInfo>(dt.Rows.Count);

        foreach (DataRow od in dt.Rows)
        {
            orderDetails.Add(new CustomerLibGetOrderDetailInfo(od));
        }
        return(orderDetails);
    }
 protected void btnByDate_Click(object sender, EventArgs e)
 {
     if ((Page.IsValid) && (txtStartDate.Text + txtStartDate.Text != ""))
     {
         string stDate  = txtStartDate.Text;
         string endDate = txtEndDate.Text;
         grid.DataSource = OrderAccess.GetOrdersByDate(stDate, endDate);
     }
     else
     {
         lblStatus.Text = "Lütfen İşleminizi Kontrol Ediniz!";
     } grid.DataBind();
 }
示例#15
0
    protected void GetRefNo()
    {
        DateTime date         = System.DateTime.Now;
        string   refNo        = date.ToString("yy") + date.ToString("MM"); //System.DateTime.Now.Year.ToString();
        string   currentRefNo = OrderAccess.GetRefNumber();
        string   last3        = currentRefNo.Substring(currentRefNo.Length - 3);

        refNo = refNo + last3;

        int newRefNo = Int32.Parse(refNo);

        txtRefNo.Text = (newRefNo + 1).ToString();
        lblRefNo.Text = "Last Ref. No  : " + currentRefNo;    // "Last Ref. No. :  " + refNo;
    }
    protected void btnByRecent_Click(object sender, EventArgs e)
    {
        //
        int recordCount;

        if (int.TryParse(txtRecent.Text, out recordCount))
        {
            grid.DataSource = OrderAccess.GetOrdersByRecent(recordCount);
        }
        else
        {
            lblStatus.Text = "Lütfen İşleminizi Kontrol Ediniz!";
        } grid.DataBind();
    }
示例#17
0
        public IHttpActionResult GetStatus(Guid orderId)
        {
            OrderAccess oAccess = new OrderAccess();
            string      status  = oAccess.GetStatusByOrderId(orderId);

            if (!string.IsNullOrEmpty(status))
            {
                return(Ok(new { orderId = orderId, status = status }));
            }
            else
            {
                return(BadRequest("Order not found"));
            }
        }
示例#18
0
    protected void btnHAWB_Imp_Click(object sender, EventArgs e)
    {
        int    MAWB_ImpID       = 1; // Int32.Parse(lblMAWB_ImpID.Text);
        string HAWB_No          = txtHAWB_No.Text;
        string Agent            = txtAgent.Text;
        string AgentRef_No      = txtAgentRef_No.Text;
        string Customer         = txtCustomer.Text;
        string CustomerRef      = txtCustomerRef.Text;
        string CustomBroker     = txtCustomBroker.Text;
        string Shipper          = txtShipper.Text;
        string Consignee        = txtConsignee.Text;
        string NotifyParty      = txtNotifyParty.Text;
        string FinalDest        = txtFinalDest.Text;
        string FinalETA         = txtFinalETA.Text;
        string ForeignDest      = txtForeignDest.Text;
        string FinalWareHouse   = txtFinalWareHouse.Text;
        string StorageDate      = txtStorageDate.Text;
        string GO_Date          = txtGO_Date.Text;
        string Commodity        = txtCommodity.Text;
        int    PKG_Quant        = Int32.Parse(txtPKG_Quant.Text);
        double GrossKgs         = Double.Parse(txtGrossKgs.Text);
        double ChargeKgs        = Double.Parse(txtChargeKgs.Text);
        string AgentRate        = txtAgentRate.Text;
        string AgentAmount      = txtAgentAmount.Text;
        string CustomerRate     = txtCustomerRate.Text;
        string CustomerAmount   = txtCustomerAmount.Text;
        string WH_Arrive        = txtWH_Arrive.Text;
        string DOC_PickUp       = txtDOC_PickUp.Text;
        string DOC_PickUpName   = txtDOC_PickUpName.Text;
        string CargoRelease     = txtCargoRelease.Text;
        string CargoReleaseName = txtCargoReleaseName.Text;
        bool   PayMethod        = true; // change to from dropdown
        int    LoadMethod       = Int32.Parse(drpLoadMethod.SelectedValue);
        int    UserID           = 1;    // change to lblUserID
        string Salesman         = txtSalesman.Text;
        bool   Closed           = true;
        string ClosedBy         = txtClosedBy.Text;
        string PostDate         = txtPostDate.Text;

        bool flag = false;

        flag = OrderAccess.HAWB_Imp_Create(MAWB_ImpID, HAWB_No, Agent, AgentRef_No, Customer, CustomerRef, CustomBroker,
                                           Shipper, Consignee, NotifyParty, FinalDest, FinalETA, ForeignDest, FinalWareHouse, StorageDate, GO_Date, Commodity,
                                           PKG_Quant, GrossKgs, ChargeKgs, AgentRate, AgentAmount, CustomerRate, CustomerAmount,
                                           WH_Arrive, DOC_PickUp, DOC_PickUpName, CargoRelease, CargoReleaseName, PayMethod, LoadMethod,
                                           UserID, Salesman, Closed, ClosedBy, PostDate);

        lblStatus.Text = flag ? "HAWB IMPORT  CREATED" : "ERROR ! FAILED TO CREATE HAWB IMPORT";
    }
示例#19
0
        public IHttpActionResult Create([FromBody] WishroundProject.API.Objects.Wish wish)
        {
            OrderAccess oAccess  = new OrderAccess();
            var         newOrder = oAccess.CreateForWish(wish.wishId);

            if (newOrder != null)
            {
                return(Ok <WishroundProject.API.Objects.Order>(new Objects.Order {
                    orderId = newOrder.PublicId
                }));
            }
            else
            {
                return(BadRequest("Wish not found"));
            }
        }
示例#20
0
        private void InitializeData()
        {
            DataSet ds1 = OrderAccess.ShowOrder(UserId);

            if (ds1 != null)
            {
                this.dataGridView1.AutoGenerateColumns = true;
                this.dataGridView1.DataSource          = ds1.Tables[0];
            }
            DataSet ds2 = OrderAccess.ShowOrderOfDate(UserId);

            if (ds2 != null)
            {
                this.dataGridView2.AutoGenerateColumns = true;
                this.dataGridView2.DataSource          = ds2.Tables[0];
            }
        }
示例#21
0
        public void TestIfGetOrdersCallsGetOrdersInRepo()
        {
            // Arrange

            var repo    = new Mock <IOrderRepository>();
            var manager = new OrderAccess(repo.Object);


            // Act

            manager.GetOrders();


            // Assert

            repo.Verify(x => x.GetOrders(), Times.Exactly(1));
        }
示例#22
0
        public void TestIfDeleteOrderCallsDeleteOrderInRepo()
        {
            // Arrange

            var repo    = new Mock <IOrderRepository>();
            var manager = new OrderAccess(repo.Object);


            // Act

            manager.DeleteOrder(It.IsAny <int>());


            // Assert

            repo.Verify(x => x.DeleteOrder(It.IsAny <int>()), Times.Exactly(1));
        }
示例#23
0
    protected void GetRefNo()
    {
        DateTime date         = System.DateTime.Now;
        string   refNo        = date.ToString("yy") + date.ToString("MM");       //System.DateTime.Now.Year.ToString();
        string   currentRefNo = OrderAccess.GetRefNumber();
        string   last3        = currentRefNo.Substring(currentRefNo.Length - 3); // error !!!!! what if value is less than 3 digits ????>

        if (last3 == "999")
        {
            last3 = "000";
        }
        refNo = refNo + last3;

        int newRefNo = Int32.Parse(refNo);

        txtRefNo.Text = (newRefNo + 1).ToString();
        lblRefNo.Text = "Last Ref. No  : " + currentRefNo;    // "Last Ref. No. :  " + refNo;
    }
    private void DenetimlerDoldur(string orderID)
    {
        OrderIfo o = OrderAccess.GetOrderInfo(orderID);

        lblTotalAmount.Text       = String.Format("{0:c}", o.TotalAmount);
        txtDateCreated.Text       = o.DateCreated;
        txtShippedDate.Text       = o.DateShipped;
        verifiedCheckBox.Checked  = o.Verified;
        completedCheckBox.Checked = o.Completed;
        canceledCheckBox.Checked  = o.Canceled;
        txtComments.Text          = o.AuthCode;
        txtCustomerName.Text      = o.CustomerName;
        txtCustomerEmail.Text     = o.CustomeEmail;
        txtShippingAddress.Text   = o.ShippingAddress;



        btnEdit.Enabled   = true;
        btnUpdate.Enabled = false;
        btnCancel.Enabled = false;

        if (canceledCheckBox.Checked || completedCheckBox.Checked)
        {
            btnMarkVerified.Enabled  = false;
            btnMarkCompleted.Enabled = false;
            btnMarkCalceled.Enabled  = false;
        }
        else if (verifiedCheckBox.Checked)
        {
            btnMarkVerified.Enabled  = false;
            btnMarkCompleted.Enabled = true;
            btnMarkCalceled.Enabled  = true;
        }
        else
        {
            btnMarkVerified.Enabled  = true;
            btnMarkCompleted.Enabled = false;
            btnMarkCalceled.Enabled  = true;
        }

        grid.DataSource = OrderAccess.GetOrderDetails(orderID);
        grid.DataBind();
    }
示例#25
0
 private void label3_Click(object sender, EventArgs e)
 {
     if (TKId != -1)
     {
         string Content = this.tbContent.Text;
         if (OrderAccess.RemarkOrder(TKId, Content))
         {
             if (UserId != -1)
             {
                 UserAccess.CountofUpdate(UserId);
                 MessageBox.Show("点评成功...");
             }
         }
         else
         {
             MessageBox.Show("您已经点评过了...");
         }
     }
 }
        public async Task <IActionResult> Post([FromBody] Order order)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var orderAccess = new OrderAccess(this.ConnectionString);
                var resut       = await orderAccess.SaveOrder(order);

                return(Ok(resut));
            }
            catch (Exception)
            {
                throw new Exception("something went wrong");
            }
        }
 /// <summary>
 /// Calls the Access label to insert all the order items
 /// </summary>
 /// <param name="items"></param>
 /// <returns></returns>
 public static bool InsertAllOrderItems(List <int> items)
 {
     try
     {
         foreach (var item in items)
         {
             OrderItem order = new OrderItem
             {
                 OrderId = OrderAccess.GetOrderObjs().Last().Id,
                 DishId  = item
             };
             OrderItemAccess.AddOrderItem(order);
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
示例#28
0
 private void lbCancleTicket_Click(object sender, EventArgs e)
 {
     if (indexer != -1)
     {
         DialogResult dr = MessageBox.Show("确定删除景点ID为" + ORId + "订单吗?", "确定", MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             bool isSuccess = OrderAccess.DeleteOrder(DTId);
             if (isSuccess)
             {
                 MessageBox.Show("景点删除成功");
             }
             DataSet ds = OrderAccess.ShowOrderForDistributor(DTId);
             if (ds != null)
             {
                 dataGridView2.DataSource = ds.Tables[0];
                 this.Refresh();
             }
         }
     }
 }
示例#29
0
 private void label3_Click(object sender, EventArgs e)
 {
     if (indexer != -1)
     {
         DialogResult dr = MessageBox.Show("确定删除?", "确定", MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             dataGridView1.DataSource = dTable;
             bool isSuccess = OrderAccess.DeleteOrder(TKId);
             if (isSuccess)
             {
                 MessageBox.Show("订单删除成功");
             }
             DataSet ds = OrderAccess.ShowOrder(UserID);
             dataGridView1.DataSource = ds.Tables[0];
             if (ds != null)
             {
                 this.Refresh();
             }
         }
     }
 }
示例#30
0
        public IHttpActionResult SetStatus([FromBody] Status status)
        {
            var     jsonData   = Base64Decode(status.data);
            BuyInfo info       = JsonConvert.DeserializeObject <BuyInfo>(jsonData);
            var     privateKey = Config.LiqPayPrivateKey;
            var     hash       = System.Convert.ToBase64String(sha1Hash(privateKey + status.data + privateKey));

            if (!hash.Equals(status.signature))
            {
                return(BadRequest("Signature is'n correct"));
            }
            OrderAccess oAccess = new OrderAccess();
            bool        result  = oAccess.SetStatusByOrderId(info.order_id, info.status);

            if (result)
            {
                return(Ok("Success"));
            }
            else
            {
                return(BadRequest("Data is'n correct"));
            }
        }