Пример #1
0
 public void UpdateDesignRequest(DesignRequestBO designReq)
 {
     orderDao.UpdateDesignRequest(designReq);
 }
Пример #2
0
 public int InsertDesignRequest(DesignRequestBO designReq)
 {
     return orderDao.InsertDesignRequest(designReq);
 }
Пример #3
0
        public void UpdateDesignRequest(DesignRequestBO designReq)
        {
            using (var context = new InThuDoEntities())
            {
                DesignRequest ds = context.DesignRequests.Where(d => d.DesignRequestId == designReq.DesignRequestId).FirstOrDefault();
                ds.Description = designReq.Description;
                ds.DesignerId = designReq.DesignerId;
                ds.BeginDate = designReq.BeginDate;
                ds.EndDate = designReq.EndDate;
                ds.Cost = designReq.Cost;
                ds.LastEditedBy = designReq.LastEditedBy;
                ds.LastEditedOn = designReq.LastEditedOn;
                ds.ApprovedByCustomer = designReq.ApprovedByCustomer;
                ds.Note = designReq.Note;
                ds.ApprovedDate = designReq.ApprovedDate;

                context.SaveChanges();
            }
        }
        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;
        }
Пример #5
0
        public int InsertDesignRequest(DesignRequestBO designReq)
        {
            using (var context = new InThuDoEntities())
            {
                DesignRequest ds = new DesignRequest()
                {
                    Description = designReq.Description,
                    DesignerId = designReq.DesignerId,
                    BeginDate = designReq.BeginDate,
                    EndDate = designReq.EndDate,
                    Cost = designReq.Cost,
                    CreatedBy = designReq.CreatedBy,
                    CreatedOn= designReq.CreatedOn,
                    OrderItemId = designReq.OrderItemId
                };

                context.DesignRequests.Add(ds);
                context.Entry(ds).State = System.Data.EntityState.Added;
                context.SaveChanges();

                return ds.DesignRequestId;
            }
        }