Beispiel #1
0
        public DataRow InitNewRow(DictionaryDataSet.OrderDataTable table)
        {
            DictionaryDataSet.OrderRow drNewRow = table.NewOrderRow();
            drNewRow.OrderID        = Guid.NewGuid();
            drNewRow.OrderNo        = DateTime.Now.Year.ToString() + "." + GetNumberOrder(DateTime.Now.Year);
            drNewRow.OrderDate      = DateTime.Now;
            drNewRow.OrderStatus    = 0;
            drNewRow.NumberOfPeople = 1;
            drNewRow.EmployeeID     = Session.UserLogin.EmployeeID;
            drNewRow.CreatedDate    = DateTime.Now;
            drNewRow.CreatedBy      = Session.UserLogin.UserName;
            drNewRow.ModifiedDate   = DateTime.Now;
            drNewRow.ModifiedBy     = Session.UserLogin.UserName;

            table.Rows.InsertAt(drNewRow, 0);
            return(drNewRow);
        }
Beispiel #2
0
        protected override int SaveData()
        {
            int result = 1;

            BsDetail.EndEdit();

            //var tableChanged = dsDictionary.Order.GetChanges();
            //var tableDetailChanged = dsDictionary.OrderDetail.GetChanges();
            //if (tableChanged == null && tableDetailChanged == null)
            //{
            //    return (int)EnumResultInsertUpdate.Success;
            //}
            //else
            //{
            //    //if (tableChanged.Rows.Count == 0 && tableDetailChanged.Rows.Count == 0)
            //    //    return (int)EnumResultInsertUpdate.Success;
            //}
            //DictionaryDataSet.OrderRow drObjectChange = (DictionaryDataSet.OrderRow)CurrentRow;
            DictionaryDataSet.OrderDataTable table          = DsDictionary.Order;
            DictionaryDataSet.OrderRow       drObjectChange = table.NewOrderRow();
            if (FormActionMode == ActionMode.AddNew)
            {
                drObjectChange.OrderID = Guid.NewGuid();
            }
            else
            {
                drObjectChange.OrderID = OrderID;
            }

            drObjectChange.OrderNo        = txtOrderNo.Text;
            drObjectChange.OrderDate      = DateTime.Now;
            drObjectChange.OrderStatus    = 0;
            drObjectChange.NumberOfPeople = 1;
            drObjectChange.EmployeeID     = Session.UserLogin.EmployeeID;
            drObjectChange.CreatedDate    = DateTime.Now;
            drObjectChange.CreatedBy      = Session.UserLogin.UserName;
            drObjectChange.ModifiedDate   = DateTime.Now;
            drObjectChange.ModifiedBy     = Session.UserLogin.UserName;
            drObjectChange.TableID        = Guid.Parse(cboTableMapping.Value.ToString());
            drObjectChange.CustomerID     = Guid.Parse(cboCustomerID.Value.ToString());
            drObjectChange.NumberOfPeople = Int32.Parse(txtNumberOfPeople.Text);
            drObjectChange.OrderDate      = DateTime.Now;
            drObjectChange.CancelReason   = txtCancelReason.Text;
            if (BookingID == Guid.Empty)
            {
                drObjectChange.BookingID = _bookingID;
            }
            else
            {
                drObjectChange.BookingID = BookingID;
            }

            //////Chỗ này nhớ lấy booking id
            if (drObjectChange != null)
            {
                drObjectChange.ModifiedDate = DateTime.Now;
                drObjectChange.ModifiedBy   = Session.UserLogin.UserName;
                for (int i = 0; i < DsDictionary.Tables[10].Rows.Count; i++)
                {
                    DsDictionary.Tables[10].Rows[i][1] = drObjectChange.OrderID;
                }

                objBLDetail.InsertUpdateOrder(drObjectChange, DsDictionary);
            }
            return(result);
        }