protected override int SaveData() { int result = 1; BsDetail.EndEdit(); var tableChanged = dsDictionary.Customer.GetChanges(); if (tableChanged == null) { return((int)EnumResultInsertUpdate.Success); } else { if (tableChanged.Rows.Count == 0) { return((int)EnumResultInsertUpdate.Success); } } DictionaryDataSet.CustomerRow drObjectChange = (DictionaryDataSet.CustomerRow)tableChanged.Rows[0]; if (drObjectChange != null) { result = objBLDetail.InsertUpdate(drObjectChange); } return(result); }
protected override int SaveData() { int result = 1; BsDetail.EndEdit(); var tableChanged = dsDictionary.Unit.GetChanges(); if (tableChanged == null) { return((int)EnumResultInsertUpdate.Success); } else { if (tableChanged.Rows.Count == 0) { return((int)EnumResultInsertUpdate.Success); } } DictionaryDataSet.UnitRow drObjectChange = (DictionaryDataSet.UnitRow)tableChanged.Rows[0]; if (drObjectChange != null) { var oldID = drObjectChange.UnitID; if (FormActionMode == ActionMode.AddNew || FormActionMode == ActionMode.Copy) { drObjectChange.UnitID = Guid.NewGuid(); } result = objBLDetail.InsertUpdate(drObjectChange, oldID); } return(result); }
protected override int SaveData() { int result = 1; BsDetail.EndEdit(); //var tableChanged = dsDictionary.Booking.GetChanges(); //if (tableChanged == null) //{ // return (int)EnumResultInsertUpdate.Success; //} //else //{ // if (tableChanged.Rows.Count == 0) // return (int)EnumResultInsertUpdate.Success; //} //DictionaryDataSet.BookingRow drObjectChange = (DictionaryDataSet.BookingRow)tableChanged.Rows[0]; DictionaryDataSet.BookingDataTable table = DsDictionary.Booking; DictionaryDataSet.BookingRow drObjectChange = table.NewBookingRow(); drObjectChange.BookingID = Guid.NewGuid(); drObjectChange.BookingDate = DateTime.Now; drObjectChange.BookingStatus = 0; drObjectChange.FromTime = DateTime.Now; drObjectChange.NumberOfPeople = 1; drObjectChange.RequestMeal = ""; drObjectChange.EmployeeID = Session.UserLogin.EmployeeID; drObjectChange.CreatedDate = DateTime.Now; drObjectChange.CreatedBy = Session.UserLogin.UserName; drObjectChange.ModifiedDate = DateTime.Now; drObjectChange.ModifiedBy = Session.UserLogin.UserName; drObjectChange.BookingNo = txtBookingNo.Text; drObjectChange.BookingDate = DateTime.Parse(dteBookingDate.Text); drObjectChange.TableID = (Guid)cboTableMapping.Value; drObjectChange.NumberOfPeople = Int32.Parse(txtNumberOfPeople.Text); drObjectChange.CustomerID = Guid.Parse(cboCustomerID.Value.ToString()); drObjectChange.BookingDate = DateTime.Now; drObjectChange.CancelDescription = txtDescription.Text; if (drObjectChange != null) { drObjectChange.ModifiedDate = DateTime.Now; drObjectChange.ModifiedBy = Session.UserLogin.UserName; result = objBLDetail.InsertUpdateObject(QuizBit.Contract.CommonFunction.GetItem <Booking>(drObjectChange)); } return(result); }
protected override int SaveData() { int result = 1; int resultAccount = 0; bool checkAccount = false; BsDetail.EndEdit(); if (!string.IsNullOrEmpty(txtUserName.Text) && !string.IsNullOrEmpty(txtPassword.Text) && !string.IsNullOrEmpty(txtCofirmPassword.Text)) { if (txtPassword.Text != txtCofirmPassword.Text) { MessageBoxCommon.ShowExclamation("Mật khẩu xác nhận không khớp. Vui lòng kiểm tra lại."); return(0); } checkAccount = true; } //var tableChanged = dsDictionary.Employee.GetChanges(); //if (tableChanged == null) //{ // return (int)EnumResultInsertUpdate.Success; //} //else //{ // if (tableChanged.Rows.Count == 0) // return (int)EnumResultInsertUpdate.Success; //} System.Data.DataRow drObjectChange = ((System.Data.DataRowView)bsDetail.Current).Row; if (drObjectChange != null) { ((Desktop.Entity.DictionaryDataSet.EmployeeRow)drObjectChange).IdentifyNumberIssuedDate = DateTime.Now; result = objBLDetail.InsertUpdate(drObjectChange); if (result == 1 && checkAccount) { DictionaryDataSet.UserDataTable table = new DictionaryDataSet.UserDataTable(); Guid userID = Guid.Empty; Guid UserJoinRoleID = Guid.NewGuid(); if (FormActionMode == ActionMode.AddNew) { DictionaryDataSet.UserRow drUser = table.NewUserRow(); drUser.UserID = Guid.NewGuid(); drUser.UserName = txtUserName.Text; drUser.Password = EncryptUtil.MD5Hash(txtPassword.Text); drUser.DisplayName = txtEmployeeName.Text; drUser.ChangedPasswordTime = DateTime.Now; drUser.Inactive = false; drUser.EmployeeID = ((Desktop.Entity.DictionaryDataSet.EmployeeRow)drObjectChange).EmployeeID; resultAccount = objBLDetail.InsertUpdateUser(drUser); userID = drUser.UserID; UserJoinRoleID = drUser.UserJoinRoleID; } else { DataRow drUser = dsDictionary.User.FindByUserID(userID); resultAccount = objBLDetail.InsertUpdateUser(drUser); userID = ((Desktop.Entity.DictionaryDataSet.UserRow)drUser).UserID; UserJoinRoleID = ((Desktop.Entity.DictionaryDataSet.UserRow)drUser).UserJoinRoleID; } if (resultAccount == 1) { DictionaryDataSet.UserJoinRoleDataTable tableRole = new DictionaryDataSet.UserJoinRoleDataTable(); if (FormActionMode == ActionMode.AddNew) { DictionaryDataSet.UserJoinRoleRow drRole = tableRole.NewUserJoinRoleRow(); drRole.UserID = userID; drRole.UserJoinRoleID = Guid.NewGuid(); if (rbAdmin.Checked) { drRole.RoleID = 0; } else if (rbBep.Checked) { drRole.RoleID = 5; } else if (rbLeTan.Checked) { drRole.RoleID = 3; } else if (rbPV.Checked) { drRole.RoleID = 2; } objBLDetail.InsertUpdateRole(drRole); } else { DataRow drRole = dsDictionary.UserJoinRole.FindByUserJoinRoleID(UserJoinRoleID); if (rbAdmin.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 0; } else if (rbBep.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 5; } else if (rbLeTan.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 3; } else if (rbPV.Checked) { ((Desktop.Entity.DictionaryDataSet.UserJoinRoleRow)drRole).RoleID = 2; } resultAccount = objBLDetail.InsertUpdateUser(drRole); } } } } return(result); }
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); }