Ejemplo n.º 1
0
        private void BindData()
        {
            ManufactureRequestBO manu = this.OrderService.GetManufactureRequestById(this.ManufactureRequestId);

            if (manu != null)
            {
                lbManufactureRequestId.Text          = manu.ManufactureRequestId.ToString();
                lbManufactureRequestDate.Text        = manu.CreatedOn.ToShortDateString();
                ctrlDatePickerBeginDate.SelectedDate = manu.BeginDate;
                ctrlDatePickerEndDate.SelectedDate   = manu.EndDate;
                txtRequirement.Text = manu.Description;
                ctrlNumbericTextBoxQuantity.Value = manu.Quantity;

                decimal price = 0;
                decimal.TryParse(manu.Cost.ToString(), out price);
                ctrlDecimalTextBoxCost.Value     = price;
                ctrlManufactureSelect.CustomerId = manu.ManufactureId.ToString();
                ctrlManufactureSelect.txtCustomerCode_TextChanged(new object(), new EventArgs());
            }
            else
            {
                panelManufactureRequestID.Visible = false;
                OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);
                if (orderDetail != null)
                {
                    ctrlNumbericTextBoxQuantity.Value = orderDetail.Quantity;
                }
                ctrlDatePickerBeginDate.Visible = false;
                ctrlDatePickerEndDate.Visible   = false;
            }
        }
Ejemplo n.º 2
0
        private void BindData()
        {
            DesignRequestBO design      = this.OrderService.GetDesignRequestById(this.DesignRequestId);
            OrderItemlBO    orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            if (design != null)
            {
                lbDesignRequestId.Text   = design.DesignRequestId.ToString();
                lbDesignRequestDate.Text = design.CreatedOn.ToShortDateString();
                if (design.DesignerId != null)
                {
                    ddlDesigner.SelectedValue = design.DesignerId.ToString();
                }
                ctrlDatePickerFrom.Visible      = true;
                ctrlDatePickerFrom.SelectedDate = design.BeginDate;
                ctrlDatePickerTo.Visible        = true;
                ctrlDatePickerTo.SelectedDate   = design.EndDate;
                txtDesignRequirement.Text       = design.Description;
                decimal cost = 0;
                decimal.TryParse(design.Cost.ToString(), out cost);
                ctrlDecimalTextBoxDesignCost.Value = cost;
                cbIsDesignOfCustomer.Checked       = orderDetail.IsCustomerHasDesign;
            }
            else
            {
                panelDesignRequestId.Visible = false;
                //OrderDetailId
                lbOrderDetailId.Text = this.OrderDetailId.ToString();
                //OrderId
                lbOrderId.Text = orderDetail.OrderId.ToString();
            }
        }
Ejemplo n.º 3
0
        private void BindData()
        {
            OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            if (orderDetail != null)
            {
                lbOrderDetailID.Text          = orderDetail.OrderItemId.ToString();
                lbOrderId.Text                = orderDetail.OrderId.ToString();
                txtProduct.Text               = orderDetail.ProductName;
                txtProductRequirement.Text    = orderDetail.Specification;
                ctrltxtQuantity.Value         = orderDetail.Quantity;
                ctrltxtPrice.Value            = orderDetail.Price;
                cbIsCustomerHasDesign.Checked = orderDetail.IsCustomerHasDesign;
            }
            else
            {
                if (this.OrderId > 0)
                {
                    lbOrderId.Text = this.OrderId.ToString();
                }
                else
                {
                    panelOrderInfo.Visible = false;
                }

                panelOrderDetailId.Visible = false;

                if (this.Reproduce == 1)
                {
                    ctrltxtPrice.Value   = 0;
                    ctrltxtPrice.Enabled = false;
                }
            }
        }
        protected void cbCustomerApprove_CheckedChanged(object sender, EventArgs e)
        {
            if (cbCustomerApprove.Checked == true)
            {
                cbCustomerRefuse.Checked   = false;
                panelApproveDetail.Visible = true;

                ManufactureRequestBO manu = this.OrderService.GetManufactureRequestById(this.ManufactureRequestId);
                if (manu != null)
                {
                    if (manu.CustomerApproved == true)
                    {
                        int     approvedQuantity = 0;
                        decimal approvedPrice    = 0;
                        int.TryParse(manu.CustomerApprovedQuantity.ToString(), out approvedQuantity);
                        decimal.TryParse(manu.CustomerApprovedPrice.ToString(), out approvedPrice);
                        ctrlNumericTextBoxQuantity.Value = approvedQuantity;
                        ctrlDecimalTextBoxPrice.Value    = approvedPrice;
                    }
                    else
                    {
                        OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);
                        ctrlNumericTextBoxQuantity.Value = orderDetail.Quantity;
                        ctrlDecimalTextBoxPrice.Value    = orderDetail.Price;
                        panelApprovedDate.Visible        = false;
                    }
                }
            }
            else
            {
                cbCustomerRefuse.Checked = true;
            }
        }
Ejemplo n.º 5
0
        private void BindData()
        {
            ManufactureRequestBO manu = this.OrderService.GetManufactureRequestById(this.ManufactureRequestId);
            OrderBO order             = this.OrderService.GetOrderById(this.OrderId);

            if (manu != null)
            {
                if (!manu.BeginDate.HasValue || !manu.EndDate.HasValue)
                {
                    pnlManufactureCustomerApprove.Enabled = false;
                }
            }

            //Check whether other user can edit order
            List <WebControl> buttons = new List <WebControl>();

            buttons.Add(btSave);
            buttons.Add(btDelete);
            base.CheckNotAllowOtherUserEditOrder(buttons, order.BusinessManId);

            OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            if (orderDetail.OrderItemStatus >= OrderItemStatusEnum.ManufactureCompleted)
            {
                List <WebControl> manufactureRequestTaskControls = new List <WebControl>();
                manufactureRequestTaskControls.Add(btSave);
                manufactureRequestTaskControls.Add(btDelete);
                base.DisableDeleteAndEditButton(manufactureRequestTaskControls);
            }
        }
Ejemplo n.º 6
0
        private void BindData()
        {
            DesignRequestBO designRequest = this.OrderService.GetDesignRequestById(this.DesignRequestId);
            OrderBO         order         = this.OrderService.GetOrderById(this.OrderId);

            if (designRequest != null)
            {
                if (!designRequest.BeginDate.HasValue || !designRequest.EndDate.HasValue)
                {
                    pnlDesignRequestCustomerApprove.Visible = false;
                }
            }

            //Check whether other user can edit design request
            List <WebControl> buttons = new List <WebControl>();

            buttons.Add(btSave);
            buttons.Add(btDelete);
            base.CheckNotAllowOtherUserEditOrder(buttons, order.BusinessManId);

            OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            if (orderDetail.OrderItemStatus >= OrderItemStatusEnum.Designing)
            {
                List <WebControl> controls = new List <WebControl>();
                controls.Add(btSave);
                controls.Add(btDelete);
                base.DisableDeleteAndEditButton(controls);
            }
        }
Ejemplo n.º 7
0
        public OrderItemlBO SaveInfo(int orderId)
        {
            if (txtProduct.Text == string.Empty)
            {
                throw new Exception("Bạn phải nhập sản phẩm");
            }

            //Add product if not exist
            int       productId = 0;
            ProductBO product   = this.ProductService.GetProductByName(txtProduct.Text);

            if (product == null)
            {
                productId = this.ProductService.InsertProduct(txtProduct.Text);
            }
            else
            {
                productId = product.ProductId;
            }

            OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            if (orderDetail != null)
            {
                orderDetail.ProductId           = productId;
                orderDetail.Specification       = txtProductRequirement.Text;
                orderDetail.Quantity            = ctrltxtQuantity.Value;
                orderDetail.Price               = ctrltxtPrice.Value;
                orderDetail.LastEditedOn        = DateTime.Now;
                orderDetail.LastEditedBy        = this.LoggedInUserId;
                orderDetail.IsCustomerHasDesign = cbIsCustomerHasDesign.Checked;
                orderDetail.PrintingTypeId      = int.Parse(cblPrintingType.SelectedValue);

                this.OrderService.UpdateOrderDetail(orderDetail);
            }
            else
            {
                orderDetail = new OrderItemlBO()
                {
                    OrderId             = orderId,
                    ProductId           = productId,
                    Specification       = txtProductRequirement.Text,
                    Quantity            = ctrltxtQuantity.Value,
                    Price               = ctrltxtPrice.Value,
                    CreatedBy           = this.UserId,
                    CreatedOn           = DateTime.Now,
                    IsCustomerHasDesign = cbIsCustomerHasDesign.Checked,
                    PrintingTypeId      = int.Parse(cblPrintingType.SelectedValue)
                };

                orderDetail.OrderItemId = this.OrderService.InsertOrderDetail(orderDetail);
            }
            return(orderDetail);
        }
        private void BindData()
        {
            ManufactureRequestBO manu        = this.OrderService.GetManufactureRequestById(this.ManufactureRequestId);
            OrderItemlBO         orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            if (manu != null)
            {
                bool isCustomerApproved = false;
                bool.TryParse(manu.CustomerApproved.ToString(), out isCustomerApproved);
                cbCustomerApprove.Checked = isCustomerApproved;
                panelApprovedDate.Visible = isCustomerApproved;

                ctrlDatePickerCustomerApproveDate.SelectedDate = manu.CustomerApprovedDate;
                txtNote.Text = manu.Note;

                bool isFailed = false;
                bool.TryParse(manu.IsFailed.ToString(), out isFailed);
                cbCustomerRefuse.Checked = isFailed;

                if (manu.IsFailed == true)
                {
                    panelApprovedDate.Visible  = false;
                    panelApproveDetail.Visible = false;
                }

                if (manu.CustomerApproved == true)
                {
                    int approvedQuantity = 0;
                    int.TryParse(manu.CustomerApprovedQuantity.ToString(), out approvedQuantity);
                    ctrlNumericTextBoxQuantity.Value = approvedQuantity;

                    decimal approvedPrice = 0;
                    decimal.TryParse(manu.CustomerApprovedPrice.ToString(), out approvedPrice);
                    ctrlDecimalTextBoxPrice.Value = approvedPrice;
                }
                else
                {
                    ctrlNumericTextBoxQuantity.Value = orderDetail.Quantity;
                    ctrlDecimalTextBoxPrice.Value    = orderDetail.Price;
                }

                List <WebControl> buttons = new List <WebControl>();
                buttons.Add(btSave);
                base.CheckNotAllowOtherUserEditOrder(buttons, manu.CreatedBy);


                if (orderDetail.OrderItemStatus >= OrderItemStatusEnum.CustomerApproved)
                {
                    List <WebControl> manufactureRequestTaskControls = new List <WebControl>();
                    manufactureRequestTaskControls.Add(btSave);
                    base.DisableDeleteAndEditButton(manufactureRequestTaskControls);
                }
            }
        }
Ejemplo n.º 9
0
 protected void btSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             OrderItemlBO od = ctrlOrderDetailInfo.SaveInfo(this.OrderId);
             Response.Redirect(string.Format("/OrderDetailEdit.aspx?OrderDetailId={0}", od.OrderItemId));
         }
         catch (Exception ex)
         {
             ProcessException(ex);
         }
     }
 }
Ejemplo n.º 10
0
        private void BindData()
        {
            //Check whether other user can edit order
            OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);

            List <WebControl> buttons = new List <WebControl>();

            buttons.Add(btSave);
            buttons.Add(btDelete);
            this.CheckNotAllowOtherUserEditOrder(buttons, orderDetail.CreatedBy);

            if (orderDetail.OrderItemStatus >= OrderItemStatusEnum.Designing)
            {
                List <WebControl> controls = new List <WebControl>();
                controls.Add(btSave);
                controls.Add(btDelete);
                this.DisableDeleteAndEditButton(controls);
            }
        }
        private void BindData()
        {
            cbStartWork.Attributes.Add("onclick", "if(!confirmChangeDesignRequestStatus()) return false");
            cbCompleteWork.Attributes.Add("onclick", "if(!confirmChangeDesignRequestStatus()) return false");
            DesignRequestBO dr = this.OrderService.GetDesignRequestById(this.DesignRequestId);

            if (dr != null)
            {
                if (dr.BeginDate.HasValue)
                {
                    cbStartWork.Checked                  = true;
                    ctrlDatePickerBeginDate.Visible      = true;
                    ctrlDatePickerBeginDate.SelectedDate = dr.BeginDate;
                }

                if (dr.EndDate.HasValue)
                {
                    cbCompleteWork.Checked             = true;
                    ctrlDatePickerEndDate.Visible      = true;
                    ctrlDatePickerEndDate.SelectedDate = dr.EndDate;
                }

                List <WebControl> controls = new List <WebControl>();
                controls.Add(cbStartWork);
                controls.Add(cbCompleteWork);
                int designerId = dr.CreatedBy;
                int.TryParse(dr.DesignerId.ToString(), out designerId);
                base.CheckNotAllowOtherUserEditOrder(controls, designerId);

                OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);
                if (orderDetail.OrderItemStatus >= OrderItemStatusEnum.DesignCopmleted)
                {
                    List <WebControl> designRequestTaskControls = new List <WebControl>();
                    designRequestTaskControls.Add(cbStartWork);
                    designRequestTaskControls.Add(cbCompleteWork);
                    base.DisableDeleteAndEditButton(designRequestTaskControls);
                }
            }
        }
Ejemplo n.º 12
0
        private void BindData()
        {
            cblApprovedByCustomer.Attributes.Add("onclick", "radioMe(event);");

            DesignRequestBO designRequest = this.OrderService.GetDesignRequestById(this.DesignRequestId);

            if (designRequest != null)
            {
                bool approvedByCustomer = false;
                if (designRequest.ApprovedByCustomer != null)
                {
                    bool.TryParse(designRequest.ApprovedByCustomer.ToString(), out approvedByCustomer);
                    cblApprovedByCustomer.SelectedValue = approvedByCustomer == true ? "1" : "0";
                }
                txtApprovedByCustomerNote.Text = designRequest.Note;

                List <WebControl> buttons = new List <WebControl>();
                buttons.Add(btSave);
                base.CheckNotAllowOtherUserEditOrder(buttons, designRequest.CreatedBy);

                if (this.SettingService.GetBoolSetting(Constant.Setting.Allow_Designer_Input_Approved_By_Customer_Info))
                {
                    if (designRequest.DesignerId == LoggedInUserId)
                    {
                        btSave.Visible = true;
                    }
                }

                OrderItemlBO orderDetail = this.OrderService.GetOrderDetailById(this.OrderDetailId);
                if (orderDetail.OrderItemStatus >= OrderItemStatusEnum.DesignApprovedByCustomer)
                {
                    List <WebControl> designRequestTaskControls = new List <WebControl>();
                    designRequestTaskControls.Add(btSave);
                    base.DisableDeleteAndEditButton(designRequestTaskControls);
                }
            }
        }
Ejemplo n.º 13
0
 public int InsertOrderDetail(OrderItemlBO orderDetail)
 {
     return(orderDao.InsertOrderDetail(orderDetail));
 }
Ejemplo n.º 14
0
 public void UpdateOrderDetail(OrderItemlBO orderDetail)
 {
     orderDao.UpdateOrderDetail(orderDetail);
 }
Ejemplo n.º 15
0
        protected void grvOrderDetails_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //Design Request
                int             orderDetailId          = int.Parse(e.Row.Cells[0].Text);
                OrderBO         order                  = this.OrderService.GetOrderById(this.OrderId);
                OrderItemlBO    od                     = this.OrderService.GetOrderDetailById(orderDetailId);
                DesignRequestBO ds                     = this.OrderService.GetDesignRequestByOrderDetailId(orderDetailId);
                HyperLink       designRequestHyperLink = e.Row.Cells[7].FindControl("hlDesignRequest") as HyperLink;
                HyperLink       manufactureRequestLink = e.Row.Cells[8].FindControl("hlManufactureRequest") as HyperLink;

                if (ds != null)
                {
                    string url = string.Format("/DesignRequestEdit.aspx?OrderId={0}&OrderDetailId={1}&DesignRequestId={2}", OrderId, orderDetailId, ds.DesignRequestId);
                    designRequestHyperLink.Attributes.Add("onclick", "OpenWindow('" + url + "')");
                    designRequestHyperLink.Attributes.Add("class", "a-popup");
                    designRequestHyperLink.Text = "Xem";

                    //Manufacture Request
                    ManufactureRequestBO manu = this.OrderService.GetManufactureRequestByDesignRequest(ds.DesignRequestId);
                    if (manu != null)
                    {
                        string ManuRequestURL = string.Format("/ManufactureRequestEdit.aspx?OrderId={0}&OrderDetailId={1}&DesignRequestId={2}&ManufactureRequestId={3}", this.OrderId, orderDetailId, ds.DesignRequestId, manu.ManufactureRequestId);
                        manufactureRequestLink.Attributes.Add("onclick", "OpenWindow('" + ManuRequestURL + "')");
                        manufactureRequestLink.Attributes.Add("class", "a-popup");
                        manufactureRequestLink.Text = "Xem";
                    }
                    else
                    {
                        if (ds.ApprovedByCustomer == true)
                        {
                            string ManuRequestURL = string.Format("/ManufactureRequestAdd.aspx?OrderId={0}&OrderDetailId={1}&DesignRequestId={2}", this.OrderId, orderDetailId, ds.DesignRequestId);
                            manufactureRequestLink.Attributes.Add("onclick", "OpenWindow('" + ManuRequestURL + "')");
                            manufactureRequestLink.Attributes.Add("class", "a-popup");
                            manufactureRequestLink.Text = "Tạo";
                            List <WebControl> buttons = new List <WebControl>();
                            buttons.Add(manufactureRequestLink);
                            CheckNotAllowOtherUserEditOrder(buttons, order.BusinessManId);
                        }
                    }
                }
                else
                {
                    string url = string.Format("/DesignRequestAdd.aspx?OrderId={0}&OrderDetailId={1}", OrderId, orderDetailId);
                    designRequestHyperLink.Attributes.Add("onclick", "OpenWindow('" + url + "')");
                    designRequestHyperLink.Attributes.Add("class", "a-popup");
                    designRequestHyperLink.Text = "Tạo";
                    List <WebControl> buttons = new List <WebControl>();
                    buttons.Add(designRequestHyperLink);
                    CheckNotAllowOtherUserEditOrder(buttons, order.BusinessManId);
                }


                //Delete button disable if not allow other user edit
                Button deleteButton = e.Row.Cells[6].FindControl("btDeleteOrderDetail") as Button;
                //Check whether other user can edit order
                List <WebControl> buts = new List <WebControl>();
                buts.Add(deleteButton);
                CheckNotAllowOtherUserEditOrder(buts, order.BusinessManId);

                if (od.OrderItemStatus >= OrderItemStatusEnum.Designing)
                {
                    if (LoggedInMember.RoleName.ToLower() != Constant.ADMIN_ROLE_NAME.ToLower())
                    {
                        List <WebControl> controls = new List <WebControl>();
                        controls.Add(deleteButton);
                        this.DisableDeleteAndEditButton(controls);
                    }
                }
            }
        }