Exemple #1
0
        protected void cmdSave_ServerClick(object sender, System.EventArgs e)
        {
            PageCheckManager checkManager = new PageCheckManager();

            checkManager.Add(new LengthCheck(lblOrderStatusEdit, drpOrderStatusEdit, Int32.MaxValue, true));

            if (!checkManager.Check())
            {
                WebInfoPublish.Publish(this, checkManager.CheckMessage, this.languageComponent1);
                return;
            }

            if (orderFacade == null)
            {
                orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
            }
            object order = this.GetEditObject();

            if (order != null)
            {
                if ((order as Order).OrderStatus == OrderStatus.Completed)
                {
                    ExceptionManager.Raise(this.GetType().BaseType, "$Error_Order_Completed_CANNOT_Update");
                    return;
                }

                this.orderFacade.UpdateOrder(order as Order);;
                this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize);
                this.RequestData();
                this.buttonHelper.PageActionStatusHandle(PageActionType.Save);
            }
        }
Exemple #2
0
        protected void cmdDelete_ServerClick(object sender, System.EventArgs e)
        {
            if (orderFacade == null)
            {
                orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
            }
            ArrayList array = this.gridHelper.GetCheckedRows();

            if (array.Count > 0)
            {
                ArrayList orders = new ArrayList(array.Count);

                foreach (UltraGridRow row in array)
                {
                    object order = this.GetEditObject(row);
                    if (order != null)
                    {
                        if ((order as Order).OrderStatus == OrderStatus.Completed)
                        {
                            ExceptionManager.Raise(this.GetType().BaseType, "$Error_Order_Completed_CANNOT_Delete");
                            return;
                        }
                        orders.Add((Order)order);
                    }
                }

                this.orderFacade.DeleteOrder((Order[])orders.ToArray(typeof(Order)));

                this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize);
                this.RequestData();
                this.buttonHelper.PageActionStatusHandle(PageActionType.Delete);
            }
        }
Exemple #3
0
 private int GetRowCount()
 {
     if (orderFacade == null)
     {
         orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
     }
     return(orderFacade.QueryORDERCount(
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtOrderCodeQuery.Text)),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPartnerQuery.Text)),
                FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtConditionItem.Text)),
                drpOrderStatusQuery.SelectedValue));
 }
Exemple #4
0
        private object[] LoadDataSource(int inclusive, int exclusive)
        {
            if (orderFacade == null)
            {
                orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
            }

            return(orderFacade.QueryORDER(
                       FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtOrderCodeQuery.Text)),
                       FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPartnerQuery.Text)),
                       FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtConditionItem.Text)),
                       drpOrderStatusQuery.SelectedValue,
                       inclusive, exclusive));
        }
Exemple #5
0
        private object GetEditObject(Infragistics.WebUI.UltraWebGrid.UltraGridRow row)
        {
            if (orderFacade == null)
            {
                orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
            }

            object obj = this.orderFacade.GetOrder(row.Cells.FromKey("OrderNO").Text.ToString());

            if (obj != null)
            {
                return((Order)obj);
            }

            return(null);
        }
Exemple #6
0
        private void SetEditObject(object obj)
        {
            if (orderFacade == null)
            {
                orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
            }
            if (obj == null)
            {
                this.txtOrderCodeEdit.Text     = string.Empty;
                this.txtPlanShipDateEdit.Text  = FormatHelper.ToDateString(FormatHelper.TODateInt(DateTime.Now));
                this.txtActShipDateEdit.Text   = FormatHelper.ToDateString(FormatHelper.TODateInt(DateTime.MaxValue));
                this.txtActShipDateEdit.Enable = "false";
                return;
            }

            this.txtOrderCodeEdit.Text            = (obj as Order).OrderNumber;
            this.txtPlanShipDateEdit.Text         = FormatHelper.ToDateString((obj as Order).PlanShipDate);
            this.txtActShipDateEdit.Text          = FormatHelper.ToDateString((obj as Order).ActShipDate);
            this.txtActShipDateEdit.Enable        = "false";
            this.drpOrderStatusEdit.SelectedValue = (obj as Order).OrderStatus;
        }
Exemple #7
0
        private object GetEditObject()
        {
            if (this.ValidateInput())
            {
                if (orderFacade == null)
                {
                    orderFacade = new FacadeFactory(base.DataProvider).CreateOrderFacade();
                }

                Order order = this.orderFacade.CreateNewOrder();

                order.OrderNumber  = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtOrderCodeEdit.Text, 40));
                order.PlanShipDate = FormatHelper.TODateInt(this.txtPlanShipDateEdit.Text);
                order.OrderStatus  = drpOrderStatusEdit.SelectedValue;
                order.ActShipDate  = FormatHelper.TODateInt(this.txtActShipDateEdit.Text);
                order.MaintainUser = this.GetUserCode();

                return(order);
            }
            else
            {
                return(null);
            }
        }