Пример #1
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            DesignRequestBO designRequest = this.OrderService.GetDesignRequestById(this.DesignRequestId);

            if (designRequest != null)
            {
                int approvedByCustomer = 0;
                if (cblApprovedByCustomer.SelectedValue != string.Empty)
                {
                    int.TryParse(cblApprovedByCustomer.SelectedValue, out approvedByCustomer);
                    designRequest.ApprovedByCustomer = approvedByCustomer == 1 ? true : false;
                    if (approvedByCustomer == 0)
                    {
                        designRequest.EndDate = null;
                    }
                }
                else
                {
                    designRequest.ApprovedByCustomer = null;
                }
                designRequest.Note         = txtApprovedByCustomerNote.Text;
                designRequest.ApprovedDate = DateTime.Now;

                this.OrderService.UpdateDesignRequest(designRequest);
            }
        }
        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);
            }
        }
Пример #3
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();
            }
        }
 protected void btSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             DesignRequestBO designRequest = ctrlDesignRequestInfo.SaveDesignRequestInfo();
         }
         catch (Exception ex)
         {
             ProcessException(ex);
         }
     }
 }
Пример #5
0
 protected void btSave_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             DesignRequestBO designRequest = ctrlDesignRequestInfo.SaveDesignRequestInfo();
             Response.Redirect(string.Format("/DesignRequestEdit.aspx?OrderId={0}&OrderDetailId={1}&DesignRequestId={2}", OrderId, OrderDetailId, designRequest.DesignRequestId));
         }
         catch (Exception ex)
         {
             ProcessException(ex);
         }
     }
 }
Пример #6
0
        protected void grvDesignRequest_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                int             designRequestId = int.Parse(e.Row.Cells[0].Text);
                DesignRequestBO ds = this.OrderService.GetDesignRequestById(designRequestId);

                if (ds != null)
                {
                    int       orderId                = ds.OrderItem.OrderId;
                    int       orderDetailId          = ds.OrderItem.OrderItemId;
                    HyperLink designRequestHyperLink = e.Row.Cells[7].FindControl("hlDesignRequest") as HyperLink;
                    string    url = string.Format("/DesignRequestEdit.aspx?OrderId={0}&OrderDetailId={1}&DesignRequestId={2}", orderId, orderDetailId, designRequestId);
                    designRequestHyperLink.Attributes.Add("onclick", "OpenWindow('" + url + "')");
                    designRequestHyperLink.Attributes.Add("class", "a-popup");
                    designRequestHyperLink.Text = "Xem";
                }
            }
        }
        protected void cbStartWork_CheckedChanged(object sender, EventArgs e)
        {
            DesignRequestBO dr = this.OrderService.GetDesignRequestById(this.DesignRequestId);

            if (dr != null)
            {
                if (cbStartWork.Checked)
                {
                    dr.BeginDate = DateTime.Now;
                }

                if (!cbStartWork.Checked)
                {
                    if (!dr.EndDate.HasValue)
                    {
                        dr.BeginDate = null;
                    }
                }

                this.OrderService.UpdateDesignRequest(dr);
            }
        }
        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);
                }
            }
        }
Пример #9
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);
                }
            }
        }
Пример #10
0
        public DesignRequestBO SaveDesignRequestInfo()
        {
            DesignRequestBO designReq = this.OrderService.GetDesignRequestById(this.DesignRequestId);

            if (designReq != null)
            {
                designReq.Description = txtDesignRequirement.Text;
                //designReq.DesignerId = int.Parse(ddlDesigner.SelectedValue);
                //designReq.BeginDate = ctrlDatePickerFrom.SelectedDate;
                //designReq.EndDate = ctrlDatePickerTo.SelectedDate;
                designReq.Cost         = ctrlDecimalTextBoxDesignCost.Value;
                designReq.LastEditedBy = LoggedInUserId;
                designReq.LastEditedOn = DateTime.Now;

                int designerId = int.Parse(ddlDesigner.SelectedValue);

                if (designerId != 0)
                {
                    designReq.DesignerId = designerId;
                }
                else
                {
                    designReq.DesignerId = null;
                }

                if (cbIsDesignOfCustomer.Checked && designerId == 0)
                {
                    designReq.BeginDate          = DateTime.Now;
                    designReq.EndDate            = DateTime.Now;
                    designReq.ApprovedByCustomer = true;
                    designReq.ApprovedDate       = DateTime.Now;
                }

                this.OrderService.UpdateDesignRequest(designReq);
            }
            else
            {
                designReq = new DesignRequestBO()
                {
                    Description = txtDesignRequirement.Text,
                    //DesignerId = int.Parse(ddlDesigner.SelectedValue),
                    //BeginDate = ctrlDatePickerFrom.SelectedDate,
                    //EndDate = ctrlDatePickerTo.SelectedDate,
                    Cost        = ctrlDecimalTextBoxDesignCost.Value,
                    CreatedBy   = LoggedInUserId,
                    CreatedOn   = DateTime.Now,
                    OrderItemId = int.Parse(lbOrderDetailId.Text)
                };
                int designerId = int.Parse(ddlDesigner.SelectedValue);

                if (designerId != 0)
                {
                    designReq.DesignerId = designerId;
                }
                else
                {
                    designReq.DesignerId = null;
                }

                if (cbIsDesignOfCustomer.Checked && designerId == 0)
                {
                    designReq.BeginDate          = DateTime.Now;
                    designReq.EndDate            = DateTime.Now;
                    designReq.ApprovedByCustomer = true;
                    designReq.ApprovedDate       = DateTime.Now;
                }

                designReq.DesignRequestId = this.OrderService.InsertDesignRequest(designReq);
            }
            return(designReq);
        }
Пример #11
0
 public void UpdateDesignRequest(DesignRequestBO designReq)
 {
     orderDao.UpdateDesignRequest(designReq);
 }
Пример #12
0
 public int InsertDesignRequest(DesignRequestBO designReq)
 {
     return(orderDao.InsertDesignRequest(designReq));
 }
Пример #13
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);
                    }
                }
            }
        }